/* Base styles - Dark Theme is now default */
:root {
    --bg-main: #0f0c29;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --panel-bg: rgba(38, 38, 38, 0.5);
    --panel-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-border: rgba(255, 255, 255, 0.2);
    --input-focus-shadow: rgba(167, 139, 250, 0.5);
    --input-focus-border: rgba(167, 139, 250, 0.8);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --table-header-bg: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: rgba(167, 139, 250, 0.2);
    --sidebar-active-border: #a78bfa;
}

body { 
    font-family: 'Inter', sans-serif;
    background: linear-gradient(-45deg, #250000, #1e2432);
    background-attachment: fixed;
    color: var(--text-primary);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* --- Main Layout Stacking Order --- */
main {
    height: calc(100vh - 5rem); 
    overflow-y: auto;
    position: relative;
    z-index: 10; /* Base layer for page content */
}
header {
    position: relative;
    z-index: 20; /* Ensures header is always on top of main content */
}
/* --- End of Stacking Fix --- */

h2 {
    text-shadow: 0px 1px 3px rgba(0,0,0,0.1);
}

/* Glass Panel with Interactive Glow */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--panel-border);
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0,0,0, 0.2);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    left: var(--mouse-x, 0);
    top: var(--mouse-y, 0);
    width: 200px;
    height: 200px;
    background-image: radial-gradient(circle at center, rgba(167, 139, 250, 0.25), transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.glass-panel:hover::before {
    opacity: 1;
}

/* --- Form & Interaction Refinements --- */
.form-input, .form-select {
    width: 100%;
    padding: .75rem;
    border-radius: .75rem;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: all .2s ease-in-out;
    font-size: .875rem;
}
.form-input:focus, .form-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    border-color: var(--input-focus-border);
}
.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}
.form-input:read-only, .form-input:disabled {
    background-color: rgba(0,0,0,0.3);
    cursor: not-allowed;
    opacity: 0.7;
}

input[type="date"] {
    color-scheme: dark;
}

.form-select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right .75rem center;
    background-repeat: no-repeat;
    background-size: 1.2em 1.2em
}
.form-select option {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

/* --- Buttons --- */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}
.btn-primary {
    background: #6d28d9;
    color: white;
    box-shadow: 0 4px 15px -5px rgba(109, 40, 217, 0.5);
}
.btn-primary:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px rgba(109, 40, 217, 0.6);
}

/* --- Sidebar --- */
#sidebar {
    transition: transform 0.3s ease;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: var(--text-secondary);
    font-weight: 500;
}
.sidebar-link:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}
.sidebar-link.active {
    background-color: var(--sidebar-active-bg);
    border-right: 3px solid var(--sidebar-active-border);
    color: var(--text-primary);
}

/* --- Modal, Notification and other styles --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, .1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, .5);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

/* --- CRITICAL FIX FOR NOTIFICATION BLOCKING --- */
#notification-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    z-index: 200; /* High z-index to appear on top */
    pointer-events: none; /* Allows clicks to pass through the container to what's underneath */
}
.notification {
    pointer-events: auto; /* Re-enables clicks for the actual notification pop-ups */
    display: flex;
    align-items: center;
    min-width: 300px;
    max-width: 400px;
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 1.5rem;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    animation: fadeIn 0.5s, fadeOut 0.5s 4.5s;
}
/* --- END OF FIX --- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

.action-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(129, 140, 248, 0.2);
    transition: background-color 0.2s;
    font-size: 1rem;
}
.action-btn:hover {
    background-color: rgba(129, 140, 248, 0.4);
}
.action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

thead {
    background-color: var(--table-header-bg) !important;
    backdrop-filter: blur(4px);
}
tbody tr:hover {
    background-color: var(--hover-bg);
}
.report-table thead th {
    border-bottom: 1px solid var(--input-border);
}
.report-table .total-row td {
    border-top: 1px solid var(--input-border);
    font-weight: bold;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #invoice-print-container, #invoice-print-container * {
        visibility: visible;
    }
    #invoice-print-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        background-color: white !important;
        color: black !important;
        padding: 2rem;
        font-family: sans-serif;
    }
    .no-print {
        display: none !important;
    }
    .print-text-black {
        color: black !important;
    }
    .print-bg-white {
        background-color: white !important;
    }
    .print-border {
        border: 1px solid #ccc;
    }
}
/* Style for active reconcile tab */
.reconcile-tab-btn.active {
    background-color: var(--sidebar-active-bg);
    border-bottom: 2px solid var(--sidebar-active-border);
    color: var(--text-primary);
    font-weight: 600;
}