/* ========================================
   MAIN.CSS - Responsive Two-Column Layout
   ======================================== */

/* Variables CSS - Theme Emerald/Stone */
:root {
    /* Colors */
    --primary-color: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-text: #065f46;

    --bg-color: #fafaf9;
    --bg-secondary: #f5f5f4;
    --card-bg: #ffffff;
    --text-color: #292524;
    --text-muted: #57534e;

    --border-color: #e7e5e4;
    --bg-input: #ffffff;
    --success-color: #059669;
    --danger-color: #dc2626;

    /* Spacing & Radius */
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;

    /* Layout */
    --sidebar-width: 280px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

/* Global Input Styles (Light Mode Default) */
input,
select,
textarea {
    background-color: #ffffff;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    border-color: transparent;
}

/* Main Container - Two Column Layout */
.main-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
}

/* Mobile: Sidebar as drawer */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

/* Hamburger Button (Mobile Only) */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

@media (max-width: 768px) {
    .content {
        padding: 80px 16px 16px 16px;
    }
}

/* Sidebar Sections */
.nav-section-title {
    padding: 24px 16px 8px 24px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    display: none; /* Hidden by default to prevent FOUC */
    align-items: center;
    gap: 12px;
    opacity: 0.8;
}

.nav-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
}

/* Nav Items */
.nav-item {
    margin: 4px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: none; /* Hidden by default to prevent FOUC */
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    color: var(--text-muted);
}

/* Nav Items that don't need permission checks */
.nav-item:not([data-tab-slug]) {
    display: flex;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary-text);
    box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.1);
}

/* App Tab Panel (Dashboard) */
.app-tab-panel {
    display: none;
}

.app-tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
}

h2 {
    margin-top: 0;
    color: var(--text-color);
    font-weight: 700;
}

/* Settings Drawer (Right Side) */
.settings-drawer {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 400px;
    max-width: 90vw;
    background-color: var(--card-bg);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 102;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
}

.settings-drawer.open {
    transform: translateX(0);
}

.settings-drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-light) 0%, #d1fae5 100%);
}

.settings-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 101;
}

.settings-overlay.active {
    display: block;
}

/* Settings Toggle Button */
.settings-toggle-btn {
    position: fixed;
    right: 24px;
    top: 24px;
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 50;
    transition: all 0.2s;
}

.settings-toggle-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .settings-toggle-btn {
        right: 16px;
        top: 16px;
    }

    .settings-overlay.active {
        display: block;
    }
}

/* ========================================
   HEADER RESPONSIVE STYLES
   ======================================== */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
}

.global-settings {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-item label {
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.setting-item input[type="number"],
.setting-item select {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.setting-item select {
    width: 140px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.btn-logout {
    padding: 8px 16px;
    background: var(--danger-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #b91c1c;
}

/* Responsive adjustments for narrow screens */
@media (max-width: 1024px) {
    .global-settings {
        gap: 10px;
    }

    .setting-item input[type="number"] {
        width: 60px;
    }

    .setting-item select {
        width: 120px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 12px 16px;
        gap: 10px;
    }

    .header-left {
        width: 100%;
        gap: 12px;
    }

    .global-settings {
        width: 100%;
        gap: 8px;
    }

    .setting-item {
        flex: 1;
        min-width: 0;
    }

    .setting-item input[type="number"] {
        width: 100%;
        min-width: 50px;
        max-width: 70px;
    }

    .setting-item select {
        width: 100%;
        max-width: 140px;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .setting-item label {
        font-size: 0.75rem;
    }

    .setting-item input[type="number"],
    .setting-item select {
        font-size: 0.75rem;
        padding: 4px 6px;
    }

    .setting-item input[type="number"] {
        max-width: 55px;
    }
}

   