/* ---------------- Premium GERP Dark Theme ---------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors */
    --primary: #1D4ED8;       /* Deep Blue for buttons */
    --primary-hover: #2563EB;
    --primary-light: rgba(29, 78, 216, 0.1);
    --accent: #B45309;        /* Darker Gold/Orange for light mode */
    
    /* Light Mode Palette */
    --bg-main: #F9FAFB;       /* Lightest gray for background */
    --bg-surface: #FFFFFF;    /* White for sidebar/header */
    --bg-card: #FFFFFF;       /* Card backgrounds */
    --bg-input: #FFFFFF;      /* Search input background */
    
    /* Text Colors */
    --text-white: #111827;    /* Dark text for headings */
    --text-main: #374151;     /* Standard text */
    --text-muted: #6B7280;    /* Muted text */
    --text-dim: #9CA3AF;      /* Dim text */
    
    /* Borders */
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* Utils */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    /*line-height: 1.5;*/
    font-size: 12px; /* Smaller base font size to match screenshot */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hide number input spinners globally */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* ---------------- Layout ---------------- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ---------------- Sidebar ---------------- */
.sidebar {
    width: 280px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

/* Sidebar Logo Area */
.sidebar-brand {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.brand-text h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-white);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.brand-text p {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin: 2px 0 0 0;
}

/* Sidebar Generate Button */
.sidebar-action-box {
    padding: 1rem;
}

.btn-generate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}
.btn-generate:hover {
    border-color: var(--accent);
    background-color: rgba(251, 191, 36, 0.05);
}
.btn-generate-text h4 {
    font-size: 0.8rem;
    margin: 0;
    font-weight: 600;
}
.btn-generate-text p {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin: 0;
}

/* Sidebar Menu */
.nav-menu {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem 1rem 1rem;
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0.5rem 0.5rem 0.5rem;
    /*margin-top: 0.5rem;*/
    cursor: pointer;
    color: var(--text-white);
}

.nav-group-header .group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-group-header .group-title svg {
    color: var(--primary);
}

.nav-group-header .chevron {
    color: var(--text-dim);
    transition: transform 0.2s ease;
}

.nav-group-items {
    list-style: none;
    padding: 0;
    margin: 0;
}
/*
.nav-group-items .nav-item {
    margin-bottom: 2px;
}*/

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 2.5rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

/* Connection line */
.nav-menu a::before {
    content: '';
    position: absolute;
    left: 1.15rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--text-dim);
    opacity: 0;
    transition: var(--transition);
}

.nav-menu a:hover {
    color: var(--text-white);
    background-color: rgba(0,0,0,0.03);
}
.nav-menu a:hover::before {
    opacity: 1;
    background-color: var(--primary);
}


/* ---------------- Main Content ---------------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------------- Top Header ---------------- */
.top-header {
    height: 60px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

/* Context Pill */
.header-context {
    display: flex;
    align-items: center;
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 9999px;
    padding: 0.4rem 1.25rem;
    font-size: 0.85rem;
    color: #1D4ED8; /* Blue text */
    gap: 0.85rem;
    font-weight: 500;
}

.header-context svg {
    color: #64748B; /* Slate icons */
    margin-right: -0.25rem; /* pull icon slightly closer to text */
}

.header-context-divider {
    width: 1px;
    height: 14px;
    background-color: #E2E8F0;
}

.btn-switch {
    background-color: var(--border-light);
    color: var(--text-white);
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Right Header Actions */
.header-actions-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-source-code {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    text-decoration: none;
    font-weight: 500;
}
.btn-source-code:hover {
    background-color: rgba(251, 191, 36, 0.05);
    border-color: var(--accent);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bg-main);
    border: 1px solid var(--primary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-white);
}
.user-role {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.btn-logout {
    color: var(--text-muted);
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
}
.btn-logout:hover {
    color: white;
}


/* ---------------- Page Content ---------------- */
.page-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* ---------------- Global Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-light);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: rgba(0,0,0,0.02);
    border-color: var(--text-muted);
}

.btn-accent {
    background-color: transparent;
    border-color: var(--accent);
    color: var(--accent);
}
.btn-accent:hover {
    background-color: rgba(251, 191, 36, 0.1);
}

/* ---------------- Cards / Layout ---------------- */
.content-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.card-header-row {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-title h1 {
    font-size: 1.4rem;
    color: #111827; /* Darkest black/navy for strong contrast */
    margin: 0;
    font-weight: 600;
}

.total-badge {
    background-color: #EEF2FF; /* Very soft indigo background */
    color: #4338CA; /* Deep indigo text */
    padding: 4px 12px;
    border-radius: 9999px; /* Perfect pill shape */
    font-size: 0.75rem;
    font-weight: 600;
}

.header-btn-group {
    display: flex;
    gap: 0.75rem;
}

/* ---------------- Forms ---------------- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.6rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-control[readonly], .form-control:disabled {
    background-color: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
}

/* ---------------- Auth Pages (Login & Context) ---------------- */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-main);
    padding: 2rem;
}

.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

.auth-card.context-card {
    max-width: 500px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 0.5rem;
}

.auth-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Professional Select2 Overrides
   ========================================================================== */
.select2-container--default .select2-selection--single {
    height: 38px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main);
    line-height: normal;
    padding-left: 0.8rem;
    font-size: 0.85rem;
}

/* Fix the Arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    width: 30px;
}

/* Dropdown Menu styling */
.select2-dropdown {
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1050;
    overflow: hidden;
}

/* Search input inside dropdown */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    outline: none;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary);
}

/* Results list styling */
.select2-results__option {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-main);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--bg-main);
    color: var(--primary);
    font-weight: 500;
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(37, 99, 235, 0.05);
    color: var(--primary);
    font-weight: 600;
}

/* ---------------- Toolbar & Filters ---------------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.search-container { position: relative; width: 300px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.search-input { width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem; background-color: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; color: var(--text-main); transition: var(--transition); }
.search-input:focus { outline: none; border-color: var(--primary); }
.filter-tabs { display: flex; gap: 0.5rem; background-color: var(--bg-main); padding: 0.25rem; border-radius: var(--radius-sm); border: 1px solid var(--border-light); }
.filter-btn { background: transparent; border: none; padding: 0.4rem 1rem; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-radius: 4px; transition: var(--transition); }
.filter-btn:hover { color: var(--text-main); }
.filter-btn.active { background-color: var(--bg-surface); color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
/* ---------------- Grid ---------------- */
.styled-grid { width: 100%; border-collapse: collapse; }
.styled-grid th { text-align: left; padding: 0.75rem 1rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); background-color: var(--bg-main); }
.styled-grid td { padding: 0.75rem 1rem; font-size: 0.8rem; color: var(--text-main); border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.styled-grid tr:hover td { background-color: rgba(0,0,0,0.01); }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 0.25rem 0.6rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; }
.status-active { background-color: #d1fae5; color: #065f46; }
.status-inactive { background-color: #fee2e2; color: #991b1b; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 4px; color: var(--text-muted); transition: var(--transition); margin-right: 0.25rem; }
.icon-btn:hover { background-color: var(--border-light); color: var(--primary); }

/* ==========================================================================
   Responsive / Mobile Support
   ========================================================================== */
/* Hamburger Menu Button */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.desktop-spacer {
    display: block;
}

@media (max-width: 992px) {
    /* Hide sidebar by default */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    }
    
    .sidebar.open {
        left: 0;
    }

    .mobile-nav-toggle {
        display: block; /* Show hamburger button */
    }
    
    .desktop-spacer {
        display: none !important;
    }

    /* Top Header Adjustments */
    .top-header {
        padding: 0 1rem;
        justify-content: flex-start;
        gap: 1rem;
    }
    
    .top-header > div:first-child {
        width: auto !important;
    }

    .header-context {
        display: none; /* Hide context pill on mobile to save space */
    }

    .header-actions-right {
        margin-left: auto; /* Push user profile to the right */
    }

    /* Grids & Cards */
    .styled-grid {
        display: block;
        width: 100%;
        overflow-x: auto; /* Enable horizontal scrolling for tables */
        white-space: nowrap;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .search-container {
        width: 100%;
    }
    
    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Purchase Add/Edit forms details grid horizontal scroll */
    .details-table-wrapper {
        overflow-x: auto;
    }
}



