/* theme.css - Premium LimoHawk Design System Variables */

:root {
    /* Premium Dark Mode (Default - WordPress Green & Gold) */
    --primary-bg: #0e241b;
    --secondary-bg: #162e24;
    --accent-gold: #c2a262;
    --accent-gold-hover: #d4b67a;
    --text-main: #ffffff;
    --text-secondary: #c0d0c8;
    /* Brighter for better contrast in dark mode */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #000000;
    --header-bg: #000000;
    --success: #2ecc71;
    --warning: #f1c40f;
    --error: #e74c3c;
    --status-success: #2ecc71;
    --status-warning: #f1c40f;
    --status-danger: #e74c3c;
    --status-info: #3498db;
    --status-gold: #c2a262;
    --status-secondary: #c0d0c8;
    --badge-success-bg: rgba(46, 204, 113, 0.1);
    --badge-success-text: #2ecc71;
    --badge-warning-bg: rgba(241, 196, 15, 0.1);
    --badge-warning-text: #f1c40f;
    --radius: 12px;
    --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-tint-bg: rgba(194, 162, 98, 0.12);
    /* Balanced 12% Gold Tint */
    --input-placeholder: rgba(255, 255, 255, 0.65);
    /* High-visibility soft white */

    /* Legacy Compatibility Layer (Maps style.css variables to Theme) */
    --color-background-white: var(--secondary-bg);
    --color-background-light: rgba(255, 255, 255, 0.05);
    --color-background-body: var(--primary-bg);
    --color-text: var(--text-main);
    --color-text-light: var(--text-secondary);
    --color-border: var(--glass-border);
}

body.light-theme {
    /* Premium Lite Mode (Beige & Gold) */
    --primary-bg: #f9f8f4;
    --secondary-bg: #ffffff;
    --accent-gold: #b28e46;
    --accent-gold-hover: #9a7a3d;
    --text-main: #0a1a14;
    --text-secondary: #4a5a54;
    --glass-bg: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(194, 162, 98, 0.2);
    --sidebar-bg: #ffffff;
    --header-bg: #ffffff;
    --card-shadow: 0 10px 30px rgba(194, 162, 98, 0.1);
    --input-bg: #ffffff;
    --input-tint-bg: rgba(178, 142, 70, 0.12);
    /* Balanced 12% Gold Tint */
    --input-placeholder: rgba(0, 0, 0, 0.55);
    /* Clear but muted placeholder */

    /* Legacy Compatibility for Lite Mode */
    --color-background-white: #ffffff;
    --color-background-light: #f5f5f5;
    --color-background-body: #f9f8f4;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #e0e0e0;
    --badge-success-bg: rgba(39, 174, 96, 0.15);
    --badge-success-text: #1b5e20;
    --badge-warning-bg: rgba(243, 156, 18, 0.15);
    --badge-warning-text: #7f5f01;
    --status-success: #1b5e20;
    --status-warning: #7f5f01;
    --status-danger: #c0392b;
    --status-info: #217dbb;
    --status-gold: #8b6e35;
    --status-secondary: #4a5a54;
}

/* Base resets as part of the theme */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

html,
body {
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: row;
}

/* Layout Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background-color: var(--primary-bg);
    height: 100dvh;
    /* Force wrapper to fill viewport */
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    height: 100px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    flex-shrink: 0;
}

/* Desktop Layout - Default */
@media (min-width: 1401px) {
    body {
        display: flex;
        flex-direction: row;
    }
    
    .sidebar {
        position: relative;
        left: 0;
    }
    
    .main-wrapper {
        flex: 1;
        min-width: 0;
    }
}

/* Tablet/Mobile Responsive Logic */
@media (max-width: 1400px) {
    body {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar.collapsed {
        left: -280px;
        width: 280px;
        /* Keep full width when sliding out on mobile */
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

.logo-box {
    width: 44px;
    height: 44px;
    background: var(--accent-gold);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(194, 162, 98, 0.3);
}

.logo-box i {
    font-size: 1.5rem;
    color: white !important;
}

.logo-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-main);
    transition: opacity 0.3s;
    white-space: nowrap;
    text-transform: uppercase;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
}

.sidebar-toggle-btn {
    margin-left: auto;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: var(--accent-gold);
    color: white;
    border-color: var(--accent-gold);
}

.sidebar.collapsed .sidebar-toggle-btn {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    z-index: 10;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 8px;
    /* Tightened */
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Reduced gap */
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    /* Reduced vertical padding */
    margin: 2px 8px;
    /* Reduced margin */
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
    /* Subtle opacity for inactive */
}


.nav-link:hover {
    background: var(--glass-bg);
    color: var(--text-main);
}

.nav-link.active {
    background: var(--accent-gold);
    color: white !important;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(194, 162, 98, 0.2);
}

.nav-link.active i {
    color: white !important;
}

.nav-link.sub-link {
    padding: 8px 16px 8px 48px;
    /* Adjusted padding since icon is gone */
    font-size: 0.9rem;
    margin: 1px 8px;
    background: transparent !important;
}

.nav-link.sub-link.active {
    color: var(--accent-gold) !important;
    background: transparent !important;
    font-weight: 700;
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    display: flex;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.nav-link.sub-link i {
    font-size: 0.6rem;
    margin-right: 12px;
}

/* Accordion Specific */
.menu-item {
    list-style: none;
}

.menu-parent {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    /* Reduced vertical padding */
    margin: 2px 8px;
    /* Reduced margin */
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.menu-parent:hover {
    background: var(--glass-bg);
    color: var(--text-main);
}

.menu-parent.active {
    background: var(--accent-gold);
    color: white !important;
    opacity: 1;
}

.menu-parent.active i {
    color: white !important;
}

.menu-parent i:first-child {
    font-size: 1.1rem;
    width: 20px;
    display: flex;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar.collapsed .accordion-arrow {
    display: none;
}

.menu-children {
    display: none;
    list-style: none;
    margin: 4px 0;
    padding-left: 0;
    position: relative;
}

.menu-children::before {
    content: '';
    position: absolute;
    left: 27px;
    /* Adjusted for tighter layout */
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--glass-border);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .menu-parent span {
    display: none;
}

.sidebar-footer {
    padding: 32px 24px;
    border-top: 1px solid var(--glass-border);
}

.theme-switcher {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 4px;
    border-radius: 100px;
    display: flex;
    gap: 4px;
    transition: all 0.3s;
}

.sidebar.collapsed .theme-switcher {
    flex-direction: column;
    border-radius: 12px;
    padding: 6px;
}

.theme-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-btn.active {
    background: var(--accent-gold);
    color: white !important;
    box-shadow: 0 4px 12px rgba(194, 162, 98, 0.3);
}

.sidebar.collapsed .theme-btn span {
    display: none;
}

.sidebar.collapsed .theme-btn {
    padding: 8px;
}

.sidebar.collapsed .sidebar-footer {
    padding: 24px 12px;
}

/* Top Bar */
.top-bar {
    height: calc(80px + env(safe-area-inset-top, 0px));
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) 40px 0 40px;
    padding-top: max(env(safe-area-inset-top, 0px), 20px);
    background: var(--header-bg-color, var(--header-bg));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 90;
    transition: all 0.3s ease;
}

/* iPad-specific fix for Safari viewport */
@supports (-webkit-touch-callout: none) {
    .top-bar {
        padding-top: max(env(safe-area-inset-top, 20px), 44px);
        min-height: 100px;
    }
}

.top-bar-left {
    display: flex;
    align-items: center;
}

#mobile-menu-toggle {
    margin-right: 15px;
    background: none;
    border: none;
    color: var(--header-text-color, var(--text-main));
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    min-width: 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 999;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

#mobile-menu-toggle:hover,
#mobile-menu-toggle:active {
    background-color: var(--glass-bg);
}

/* Force visibility on all touch devices and smaller screens */
@media (max-width: 1400px), (pointer: coarse) {
    .top-bar {
        padding: 20px 20px 0 20px;
        padding-top: max(20px, env(safe-area-inset-top, 20px));
        height: auto;
        min-height: calc(70px + env(safe-area-inset-top, 0px));
    }

    #mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Additional Safari-specific fix - MUST come after media query for higher specificity */
@supports (-webkit-touch-callout: none) {
    .top-bar {
        padding-top: 45px !important;
        min-height: 110px !important;
        height: auto !important;
    }
    
    .top-bar-left {
        margin-top: 5px !important;
    }
    
    #mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        top: auto !important;
        z-index: 9999 !important;
    }
}

/* iPad Safari specific - using -webkit-min-device-pixel-ratio which Safari recognizes */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (-webkit-min-device-pixel-ratio: 2) {
    
    /* Force visibility in Safari on iPad */
    @supports (-webkit-touch-callout: none) {
        .top-bar {
            padding-top: 50px !important;
            min-height: 115px !important;
        }
        
        .top-bar-left {
            margin-top: 5px !important;
        }
    }
}

/* Ultimate fallback for Safari on any iOS device */
@supports (padding: max(0px)) and (-webkit-touch-callout: none) {
    @media (pointer: coarse) {
        .top-bar {
            padding-top: 48px !important;
            min-height: 112px !important;
        }
    }
}

.top-bar-left h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.2;
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-gold);
    color: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Content Area */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 60px 40px;
    background-color: var(--primary-bg);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Ensure content starts at top */
    transition: padding 0.3s ease;
}

@media (max-width: 1400px) {
    .content-scroll {
        padding: 30px 20px;
    }
}

@media (max-width: 640px) {
    .content-scroll {
        padding: 20px 15px;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    /* Reduced for better focus */
    margin: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        margin-bottom: 32px;
    }

    .page-header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.page-header-text h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -1px;
    margin-bottom: 12px;
    font-family: 'Outfit', sans-serif;
}

.page-header-text p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
    margin: 0;
}

@media (max-width: 768px) {
    .page-header-text h1 {
        font-size: 1.75rem;
    }
}

.page-header-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}