/*
 * TAX OFFICE COMMAND CENTER - GORGEOUS & IMPRESSIVE STYLESHEET
 * Version: 3.0
 * Description: A complete visual overhaul focusing on a modern, clean, and consistent
 *              SaaS-like aesthetic with superior UX and attention to detail.
 */

/* ------------------------------------------- */
/* --- FONT IMPORT & GLOBAL SETUP          --- */
/* ------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--surface-app);
    color: var(--text-primary);
}

/* ------------------------------------------- */
/* --- DESIGN TOKENS (CSS VARIABLES)       --- */
/* ------------------------------------------- */
:root {
    --font-sans: 'Inter', sans-serif;

    /* Spacing & Radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --spacing-base: 4px;

    /* Light Theme Palette */
    --brand-primary: hsl(221, 83%, 53%);      /* blue-600 */
    --brand-primary-hover: hsl(221, 83%, 48%); /* blue-700 */

    --surface-app: hsl(210, 40%, 98%);       /* slate-50 */
    --surface-card: hsl(0, 0%, 100%);        /* white */
    --surface-header: hsl(222, 47%, 11%);     /* slate-900 - Keep nav dark */
    --surface-inset: hsl(210, 40%, 96%);      /* slate-100 */

    --text-primary: hsl(222, 47%, 21%);      /* slate-800 */
    --text-secondary: hsl(215, 16%, 47%);     /* slate-500 */
    --text-on-brand: hsl(0, 0%, 100%);

    --border-subtle: hsl(210, 40%, 93%);      /* slate-200 */
    --border-interactive: hsl(215, 20%, 65%); /* slate-400 */
    --border-focus: var(--brand-primary);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark-mode {
    /* Dark Theme Palette */
    --brand-primary: hsl(217, 91%, 60%);      /* blue-500 */
    --brand-primary-hover: hsl(217, 91%, 65%); /* blue-400 */

    --surface-app: hsl(222, 47%, 11%);        /* slate-900 */
    --surface-card: hsl(222, 47%, 18%);       /* slate-800 */
    --surface-header: hsl(222, 47%, 14%);     /* Mid-way slate */
    --surface-inset: hsl(222, 47%, 11%);       /* slate-900 */

    --text-primary: hsl(210, 40%, 98%);       /* slate-50 */
    --text-secondary: hsl(215, 20%, 65%);     /* slate-400 */

    --border-subtle: hsl(215, 28%, 27%);      /* slate-700 */
    --border-interactive: hsl(215, 19%, 39%); /* slate-600 */
    --border-focus: var(--brand-primary);
}

/* ------------------------------------------- */
/* --- GLOBAL & UTILITY STYLES             --- */
/* ------------------------------------------- */
.bg-page { background-color: var(--surface-app); }
.bg-card { background-color: var(--surface-card); }
.text-text-primary { color: var(--text-primary); }
.text-text-secondary { color: var(--text-secondary); }
.border-border-color { border-color: var(--border-subtle); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-inset); }
::-webkit-scrollbar-thumb {
    background-color: var(--border-interactive);
    border-radius: 10px;
    border: 2px solid var(--surface-inset);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-secondary); }


/* ------------------------------------------- */
/* --- LAYOUT & NAVIGATION                   --- */
/* ------------------------------------------- */
nav {
    background-color: var(--surface-header);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    padding: calc(var(--spacing-base) * 3) calc(var(--spacing-base) * 6);
}

nav h1 { font-weight: 600; }

nav button, nav a {
    color: var(--text-secondary);
    font-weight: 500;
    gap: calc(var(--spacing-base) * 2);
    padding: var(--spacing-base) calc(var(--spacing-base) * 3);
    border-radius: var(--border-radius-md);
    transition: background-color 0.2s ease, color 0.2s ease;
}

nav button:hover, nav a:hover {
    background-color: hsl(0 0% 100% / 0.1);
    color: var(--text-on-brand);
}

/* ------------------------------------------- */
/* --- FORMS, BUTTONS & MODALS               --- */
/* ------------------------------------------- */
.modal {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.modal > div { /* The modal panel */
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal:not(.hidden) > div {
    transform: scale(1) translateY(0);
}

input, select {
    background-color: var(--surface-inset);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius-md);
    padding: calc(var(--spacing-base) * 2.5);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 25%, transparent);
}

label.uppercase {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Primary Button Style */
button.bg-blue-600 {
    background-color: var(--brand-primary);
    border-radius: var(--border-radius-md);
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
button.bg-blue-600:hover {
    background-color: var(--brand-primary-hover);
    transform: translateY(-1px);
}


/* ------------------------------------------- */
/* --- LOBBY BOARD (KANBAN)                  --- */
/* ------------------------------------------- */
.bg-board { background-color: var(--surface-inset); }

/* Column Styles */
#view-lobby .bg-card {
    border: 1px solid var(--border-subtle);
    border-top-width: 4px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

/* Column Header */
#view-lobby .bg-card > div:first-child {
    background-color: color-mix(in srgb, var(--surface-app) 50%, var(--surface-card));
    font-weight: 600;
}

/* Lobby Cards */
.lobby-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-left-width: 4px;
    padding: calc(var(--spacing-base) * 3);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.lobby-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.lobby-card:active {
    cursor: grabbing;
}
.lobby-card.opacity-50 { /* During drag */
    transform: rotate(2deg) scale(1.02);
    box-shadow: var(--shadow-lg);
    opacity: 0.9;
}

/* Drop Zones */
.drop-zone {
    border-radius: var(--border-radius-lg);
    transition: background-color 0.3s ease;
    padding: var(--spacing-base) * 2;
}
.drop-zone.bg-blue-100 { /* This is the dragover class from JS */
    background-color: color-mix(in srgb, var(--brand-primary) 10%, transparent) !important;
}


/* ------------------------------------------- */
/* --- CLIENTS DATABASE TABLE                --- */
/* ------------------------------------------- */
#view-clients table { border-collapse: separate; border-spacing: 0; }
#view-clients .rounded-lg { border-radius: var(--border-radius-lg); }

#view-clients th {
    background-color: var(--surface-inset);
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}
#view-clients th:first-child { border-top-left-radius: var(--border-radius-lg); }
#view-clients th:last-child { border-top-right-radius: var(--border-radius-lg); }

#view-clients td {
    border-bottom: 1px solid var(--border-subtle);
    padding-top: calc(var(--spacing-base) * 4);
    padding-bottom: calc(var(--spacing-base) * 4);
}
#view-clients tr:last-child td { border-bottom: none; }
#view-clients .client-row { transition: background-color 0.2s ease; }
#view-clients .client-row:hover { background-color: var(--surface-inset); }
#view-clients .data-client-name { color: var(--text-primary); font-weight: 500; }

/* ------------------------------------------- */
/* --- FULL CALENDAR OVERRIDES               --- */
/* ------------------------------------------- */
#calendar {
    --fc-border-color: var(--border-subtle);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--surface-inset);
    --fc-today-bg-color: color-mix(in srgb, var(--brand-primary) 10%, transparent);
    --fc-list-event-hover-bg-color: var(--surface-inset);
}
.fc .fc-toolbar { color: var(--text-primary); margin-bottom: 1.5em !important; }
.fc .fc-toolbar-title { font-size: 1.75em; font-weight: 700; }

.fc .fc-button {
    background-color: var(--surface-card) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: all 0.2s ease;
    font-weight: 500;
}
.fc .fc-button:hover {
    background-color: var(--surface-inset) !important;
    border-color: var(--border-interactive) !important;
    color: var(--text-primary) !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--text-on-brand) !important;
}

.fc .fc-col-header-cell, .fc .fc-daygrid-day-number { color: var(--text-secondary); font-weight: 500; }
.fc .fc-timegrid-slot-label { color: var(--text-secondary); }

/* Calendar Events */
.fc-event {
    border-radius: var(--border-radius-sm) !important;
    border: 1px solid transparent !important;
    padding: 4px 6px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: none;
    transition: transform 0.15s ease, filter 0.15s ease;
}
.fc-event:hover { filter: brightness(1.1); }
.fc-event.event-completed {
    opacity: 0.65;
    background-color: var(--text-secondary) !important;
}
.fc-event.event-completed .fc-event-title { text-decoration: line-through; }
.fc-event .fa-fw { margin-right: 6px; }

/* SweetAlert2 Theming */
.swal2-popup {
    background-color: var(--surface-card) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius-lg) !important;
}
.swal2-title { color: var(--text-primary) !important; }
.swal2-html-container { color: var(--text-secondary) !important; }

/* =========================================== */
/* === PRINTER-FRIENDLY STYLES             === */
/* =========================================== */
@media print {
    /* General Resets */
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 10pt;
    }

    *, *::before, *::after {
        box-shadow: none !important;
        background: transparent !important;
        color: #000000 !important;
        border-color: #ccc !important;
    }

    /* Hide Non-Essential UI */
    nav, #view-calendar .w-64, #view-lobby, .modal, button, a[href*="logout"], .fc-header-toolbar {
        display: none !important;
    }

    /* Optimize Main Layout for Print */
    main, .fc-view, .fc-view-harness {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* FullCalendar Print Styles */
    .fc-event { border: 1px solid #ccc !important; padding: 2px 4px !important; }
    .fc-event.event-completed .fc-event-title { text-decoration: line-through; }
    .fc-event .fa-fw { display: none; }
    .fc-daygrid-event { white-space: normal !important; }
    .fc-daygrid-day-bottom { display: none !important; }
    .fc-timegrid-now-indicator-line { display: none !important; }
    .fc-timegrid-event .fc-event-title { white-space: normal !important; }

    /* Client Table Print Styles */
    #view-clients table { width: 100%; border-collapse: collapse; font-size: 9pt; }
    #view-clients th, #view-clients td { border: 1px solid #ccc; padding: 4px; }
    #view-clients .fa-sort { display: none; }
}