/*
    === CORPORATE DESIGN SYSTEM ===

    This file contains the core corporate design system for RidgeCommand and all PenguinRidge applications.
    It implements the four-component layout system and corporate styling standards.
*/

/* === CSS VARIABLES === */
:root {
    /* Primary Brand Colors */
    --primary-color: #5A6F9C;
    --secondary-color: #6A7DAA;
    --accent-blue: #7A8BB8;
    --accent-orange: #DD6B20;
    --accent-orange-muted: #ED8936;
    --accent-orange-light: #F6AD55;
    
    /* Status Colors */
    --success-color: #38A169;
    --warning-color: #D69E2E;
    --danger-color: #E53E3E;
    
    /* Background Colors */
    --light-bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --border-color: #E2E8F0;
    
    /* Text Colors */
    --text-primary: #2D3748;
    --text-muted: #718096;
    --text-light: #A0AEC0;
    
    /* Gradients (Extensively Used) */
    --gradient-primary: linear-gradient(135deg, #5A6F9C, #6A7DAA);
    --gradient-secondary: linear-gradient(135deg, #6A7DAA, #7A8BB8);
    --gradient-accent: linear-gradient(135deg, #7A8BB8, #8DA1C6);
    --gradient-light: linear-gradient(135deg, #8DA1C6, #A4B8D4);
    --gradient-success: linear-gradient(135deg, #38A169, #48BB78);
    --gradient-warning: linear-gradient(135deg, #D69E2E, #ECC94B);
    --gradient-orange: linear-gradient(135deg, #DD6B20, #ED8936);
    --gradient-orange-muted: linear-gradient(135deg, #ED8936, #F6AD55);
}

/* === BASE STYLES === */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    padding: 0;
}

/* === FOUR-COMPONENT LAYOUT SYSTEM === */

/* 1. Fixed Top Navigation Bar */
.navbar-top {
    background: var(--gradient-primary);
    height: 40px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0.25rem 0.75rem;
}

.navbar-top .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* Navbar Center Content */
.navbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Navbar Stats Display */
.navbar-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-number {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.125rem;
}


/* 2. Overlapping Logo System */
.logo-wrapper {
    position: fixed;
    top: 3px;
    left: 0;
    width: 200px;
    height: 80px;
    z-index: 1051;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none !important;
    border-bottom: 0px solid rgba(255, 255, 255, 0.1);
    box-shadow: none !important;
    outline: none !important;
}

.sidebar-logo-overlapping {
    max-height: 70px;
    width: auto;
    margin: 0;
    padding: 0;
    filter: none;
}

/* 3. Left Sidebar Navigation */
.sidebar {
    width: 250px;
    background: var(--gradient-primary);
    flex-shrink: 0;
    overflow-y: auto;
    transition: width 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 2px 0 4px rgba(90, 111, 156, 0.08);
    position: fixed;
    top: 40px;
    left: 0;
    height: calc(100vh - 40px);
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-inner {
    padding-top: 4rem !important;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.sidebar-nav,
.sidebar-nav ul,
.sidebar-nav li {
    list-style: none !important;
    margin: 0;
    padding: 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 0.75rem 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-right: 3px solid white;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(2px);
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
}

.sidebar.collapsed .sidebar-nav .nav-link span,
.sidebar.collapsed .sidebar-section-title {
    display: none;
}

.sidebar.collapsed .sidebar-nav .nav-link {
    text-align: center;
    padding: 0.75rem 0.5rem;
}

.sidebar.collapsed .sidebar-nav .nav-link i {
    margin-right: 0;
    font-size: 1rem;
}

.sidebar-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

/* 4. Main Content Area */
.content-area {
    flex: 1;
    padding: 0.5rem;
    background: var(--light-bg);
    overflow-y: auto;
    transition: all 0.3s ease;
    margin-top: 60px;
    margin-left: 250px;
}

.content-area.expanded {
    margin-left: 60px;
}

/* Main Layout Container */
.main-layout {
    display: flex;
    min-height: calc(100vh - 60px);
    margin-top: 60px;
}

/* === NAVBAR COMPONENTS === */

/* Navbar content styling */
.navbar-top .navbar-nav {
    display: flex;
    align-items: center;
    margin: 0;
}

.navbar-top .nav-link {
    color: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.navbar-top .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.navbar-top .dropdown-toggle {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.navbar-top .dropdown-toggle:hover {
    color: white;
}

.navbar-top .dropdown-menu {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
}

.navbar-top .dropdown-item {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.navbar-top .dropdown-item:hover {
    background: var(--light-bg);
    color: var(--text-primary);
}

.navbar-top .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: 0.2s ease;
}

.navbar-top .avatar:hover {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.navbar-top .dropdown-toggle {
    padding: 0.5rem;
    color: white;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.navbar-top .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar-top .dropdown-toggle::after {
    display: none;
}

/* Sidebar toggle button styling */
.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-toggle:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* === CORPORATE COMPONENTS === */

/* Cards with Equal Height Management */
.card {
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(90, 111, 156, 0.08);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(90, 111, 156, 0.12);
}

.card-header {
    background: var(--gradient-primary);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    border: none;
}

.card-body {
    padding: 1rem;
    background: white;
    color: var(--text-primary);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Corporate Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(90, 111, 156, 0.15);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.btn-secondary {
    background: var(--gradient-secondary);
    border: none;
    color: white;
}

.btn-success {
    background: var(--gradient-success);
    border: none;
    color: white;
}

.btn-warning {
    background: var(--gradient-warning);
    border: none;
    color: white;
}

.btn-orange {
    background: var(--gradient-orange);
    border: none;
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* Status Badges */
.badge {
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.2rem 0.5rem;
}

.badge-primary {
    background: var(--gradient-primary);
    color: white;
}

.badge-success {
    background: var(--gradient-success);
    color: white;
}

.badge-warning {
    background: var(--gradient-warning);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-primary-muted {
    background: var(--gradient-secondary);
    color: white;
}

/* Form Elements */
.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(90, 111, 156, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* === FOOTER === */
.footer {
    background: var(--card-bg);
    border-top: none;
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-logo {
    max-height: 40px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* === RESPONSIVE DESIGN === */

/* Mobile: 320px - 767px */
@media (max-width: 767px) {
    /* Base layout adjustments */
    .main-layout {
        position: relative;
        margin-top: 40px;
    }
    
    .content-area {
        margin-left: 0;
        width: 100%;
        padding: 0.25rem;
    }
    
    /* Sidebar mobile behavior */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        width: 280px;
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* Mobile sidebar overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Navigation adjustments */
    .navbar-stats {
        display: none !important;
    }
    
    .logo-wrapper {
        display: none;
    }
    
    .navbar-center {
        justify-content: flex-start;
    }
    
    /* Typography adjustments */
    body {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    /* Heading adjustments */
    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.875rem;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    h4 {
        font-size: 1.1rem;
        line-height: 1.4;
        margin-bottom: 0.625rem;
    }
    
    h5 {
        font-size: 1rem;
        line-height: 1.4;
        margin-bottom: 0.5rem;
    }
    
    h6 {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 0.5rem;
    }
    
    /* Paragraph adjustments */
    p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    
    /* Small text adjustments */
    small {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    /* List adjustments */
    ul, ol {
        padding-left: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    li {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 0.25rem;
    }
    
    /* Blockquote adjustments */
    blockquote {
        font-size: 0.9rem;
        line-height: 1.5;
        margin: 1rem 0;
        padding: 0.75rem 1rem;
        border-left: 3px solid var(--primary-color);
        background: var(--light-bg);
    }
    
    /* Card adjustments */
    .card {
        margin-bottom: 0.5rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Form adjustments */
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 44px;
    }
    
    /* Stats overview */
    .stats-overview {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-card {
        flex: none;
        padding: 0.75rem;
    }
    
    /* Container adjustments */
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Spacing adjustments */
    .mb-1 { margin-bottom: 0.25rem !important; }
    .mb-2 { margin-bottom: 0.5rem !important; }
    .mb-3 { margin-bottom: 0.75rem !important; }
    .mb-4 { margin-bottom: 1rem !important; }
    .mb-5 { margin-bottom: 1.25rem !important; }
    
    .mt-1 { margin-top: 0.25rem !important; }
    .mt-2 { margin-top: 0.5rem !important; }
    .mt-3 { margin-top: 0.75rem !important; }
    .mt-4 { margin-top: 1rem !important; }
    .mt-5 { margin-top: 1.25rem !important; }
    
    .p-1 { padding: 0.25rem !important; }
    .p-2 { padding: 0.5rem !important; }
    .p-3 { padding: 0.75rem !important; }
    .p-4 { padding: 1rem !important; }
    .p-5 { padding: 1.25rem !important; }
    
    /* Section spacing */
    .section {
        margin-bottom: 1.5rem;
    }
    
    .section-header {
        margin-bottom: 1rem;
    }
    
    .section-content {
        margin-bottom: 1rem;
    }
    
    /* Grid spacing */
    .row {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    .row > * {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Tablet: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-layout {
        position: relative;
        margin-top: 40px;
    }
    
    .content-area {
        margin-left: 0;
        width: 100%;
        padding: 0.5rem;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        width: 250px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    .navbar-stats {
        display: none !important;
    }
    
    .logo-wrapper {
        display: none;
    }
    
    .stats-overview {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .stat-card {
        flex: 1;
        min-width: 200px;
    }
}

/* Small desktop: 1024px - 1439px */
@media (min-width: 1024px) and (max-width: 1439px) {
    .content-area {
        margin-left: 250px;
        padding: 0.5rem;
    }
    
    .sidebar {
        transform: translateX(0);
        width: 250px;
    }
    
    .navbar-stats {
        display: flex !important;
        gap: 0.5rem;
    }
    
    .logo-wrapper {
        display: flex;
    }
    
    .stats-overview {
        flex-direction: row;
        gap: 1rem;
    }
    
    .stat-card {
        flex: 1;
    }
}

/* Large desktop: 1440px+ */
@media (min-width: 1440px) {
    .content-area {
        margin-left: 250px;
        padding: 1rem;
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
        margin-left: calc(250px + (100vw - 1400px) / 2);
    }
    
    .sidebar {
        transform: translateX(0);
        width: 250px;
    }
    
    .navbar-stats {
        display: flex !important;
        gap: 0.75rem;
    }
    
    .logo-wrapper {
        display: flex;
    }
    
    .stats-overview {
        flex-direction: row;
        gap: 1.5rem;
    }
    
    .stat-card {
        flex: 1;
    }
}

/* === ACCESSIBILITY & UTILITIES === */
[aria-current="page"] {
    font-weight: 600;
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent-orange);
    outline-offset: 2px;
}

/* === BORDER OVERRIDES === */
/* Ensure no borders on any navigation elements */
.navbar {
    border: none !important;
}

.navbar-dark {
    border: none !important;
}

.navbar-nav,
.nav-item,
.nav-link {
    border: none !important;
}

.container-fluid {
    border: none !important;
}

.dropdown-menu {
    border: none !important;
}

.dropdown-item {
    border: none !important;
}

.navbar-expand-lg {
    border: none !important;
}

.navbar > .container-fluid {
    border: none !important;
}

.border-0 {
    border: none !important;
}

.btn,
.form-control,
.card,
.list-group {
    border: none !important;
}
