/* Modern Dark Theme Design System with Light/Dark Mode accents and Glassmorphism */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --font-sans: 'Inter', 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sidebar-width: 280px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.brand-logo {
    font-size: 1.75rem;
    color: var(--accent-blue);
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.quarter-selector-container {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.quarter-selector-container label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.select-wrapper select {
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
}

#btn-new-quarter {
    width: 100%;
    margin-top: 0.5rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background-color: rgba(59, 130, 246, 0.15);
    border-left: 4px solid var(--accent-blue);
    padding-left: calc(1rem - 4px);
}

.sidebar-footer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Main Area Layout */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: 70px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 5;
}

.top-bar-left h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.user-profile i {
    font-size: 1.1rem;
    color: var(--accent-blue);
}

.content-body {
    padding: 2rem;
    flex: 1;
}

/* Tab panes */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards Layout */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    right: -50px;
    top: -50px;
}

.bg-gradient-blue { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.bg-gradient-green { background: linear-gradient(135deg, #065f46, #10b981); }
.bg-gradient-purple { background: linear-gradient(135deg, #5b21b6, #8b5cf6); }
.bg-gradient-orange { background: linear-gradient(135deg, #9a3412, #f59e0b); }

.kpi-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.kpi-info p {
    font-size: 1.85rem;
    font-weight: 700;
}

.kpi-card i {
    font-size: 2.2rem;
    opacity: 0.3;
}

/* Dashboard Charts */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.chart-card {
    padding: 1.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-top: 1rem;
}

/* Card layout */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-premium);
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.25s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-blue);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn-full {
    width: 100%;
}

.btn-icon-only {
    padding: 0.5rem;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-radius: 50%;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-excel {
    background-color: #107c41;
    color: white;
}

.btn-excel:hover {
    background-color: #0e6735;
}

.btn-pdf {
    background-color: #c42f2f;
    color: white;
}

.btn-pdf:hover {
    background-color: #aa2727;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.alert-info code {
    color: #fff;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Drag and Drop Zone */
.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.dropzone-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.dropzone p span {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Preview Table Section */
.import-preview-section {
    margin-top: 2rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Table styling */
.table-container {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-top: 1rem;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th, .table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
}

.table tr:last-child td {
    border-bottom: none;
}

.table-reconciliation {
    font-size: 0.85rem;
}

.text-right { text-align: right; }
.font-bold { font-weight: 700; }

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-match { background-color: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-shortage { background-color: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.badge-excess { background-color: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.badge-unexpected { background-color: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }

/* Count Layout Grid */
.count-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .count-layout {
        grid-template-columns: 1fr;
    }
}

.switch-toggle-mode {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 1rem;
}

.btn-mode {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-mode.active {
    background: var(--accent-blue);
    color: #fff;
}

.check-sn-wrapper {
    margin-top: -0.25rem;
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 2rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 1.25rem;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: rgba(255,255,255,0.15);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.history-table-wrapper {
    max-height: 480px;
    overflow-y: auto;
}

/* Movement Layout Grid */
.movement-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .movement-layout {
        grid-template-columns: 1fr;
    }
}

/* Report View Filter Styling */
.report-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-action-buttons {
    display: flex;
    gap: 1rem;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 10% auto;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-premium);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.close-modal, .close-quarter-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover, .close-quarter-modal:hover {
    color: var(--text-primary);
}

/* Toast System */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 1rem;
    position: fixed;
    z-index: 200;
    right: 30px;
    bottom: 30px;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
    from { bottom: 30px; opacity: 1; }
    to { bottom: 0; opacity: 0; }
}

.toast-success { border-left: 6px solid var(--accent-green); }
.toast-error { border-left: 6px solid var(--accent-red); }

/* Print styling (Hidden on screen) */
.print-only {
    display: none;
}

/* Print Stylesheet */
@media print {
    body * {
        visibility: hidden;
    }
    
    .print-only, .print-only * {
        visibility: visible;
    }
    
    .print-only {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        color: #000;
        background-color: #fff;
        padding: 2rem;
    }
    
    .print-header {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .print-header h2 {
        font-family: var(--font-sans);
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 3rem;
        font-size: 0.8rem;
    }
    
    .print-table th, .print-table td {
        border: 1px solid #000;
        padding: 0.5rem;
        text-align: left;
    }
    
    .print-table th {
        background-color: #f2f2f2;
    }
    
    .print-signature-section {
        display: flex;
        justify-content: space-between;
        margin-top: 4rem;
        page-break-inside: avoid;
    }
    
    .signature-box {
        text-align: center;
        width: 30%;
        font-size: 0.85rem;
    }
    
    .signature-box p {
        margin-top: 0.5rem;
    }
}

/* Right Panel Sub-Tabs & Lookup Table */
.panel-tab-switcher {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.btn-panel-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-panel-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-panel-tab.active {
    color: #fff;
    background: var(--accent-blue);
}

.card-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-header-simple h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.lookup-filter-wrapper {
    margin-bottom: 0.75rem;
}

.lookup-filter-wrapper input {
    background: rgba(15, 23, 42, 0.4);
    font-size: 0.85rem;
}

/* ================= LOGIN SCREEN STYLING ================= */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-primary);
    background-image: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-premium);
    animation: fadeIn 0.4s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-family: 'Prompt', sans-serif;
}

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

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background: rgba(15, 23, 42, 0.7);
}

.login-footer-info {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-footer-info code {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    color: var(--accent-orange);
}

.sidebar-user-section {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-user-role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    align-self: flex-start;
}

.btn-logout {
    width: 100%;
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--accent-red) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.btn-logout:hover {
    background: var(--accent-red) !important;
    color: white !important;
}


