/* public/style.css */
:root {
    /* Modern Palette */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #7c3aed;
    /* Changed to a rich violet */
    --success-color: #10b981;
    --danger-color: #f43f5e;
    --warning-color: #f59e0b;

    /* Backgrounds & Text */
    --bg-color: #f9fafb;
    --text-color: #1f2937;
    --text-muted: #6b7280;

    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --backdrop-blur: 16px;

    /* Spacing */
    --radius-lg: 1.5rem;
    --radius-md: 1rem;
    --radius-sm: 0.5rem;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Mesh Gradient Background */
    background:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background: conic-gradient(from 0deg at 50% 50%, #eff6ff 0deg, #e0e7ff 180deg, #eff6ff 360deg);
    background-attachment: fixed;
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Glass Card 2.0 */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1);
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.025em;
}

/* Responsive Grid Utility Class */
.grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    /* Stack automatically < 280px */
    gap: 1.5rem;
}

/* Specific Column Classes with Responsive Overrides */
.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.grid-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* Force Stack on Mobile */
@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
    }

    .container {
        padding: 1rem;
    }

    .glass-card {
        padding: 1.5rem;
        border-radius: var(--radius-md);
    }
}

/* Table Card View for Mobile */
/* Table Card View for Mobile */
@media (max-width: 768px) {

    /* Apply Card View ONLY to responsive data tables, exclude layout tables */
    table:not(.card-table):not(.layout-table),
    table:not(.card-table):not(.layout-table) thead,
    table:not(.card-table):not(.layout-table) tbody,
    table:not(.card-table):not(.layout-table) th,
    table:not(.card-table):not(.layout-table) td,
    table:not(.card-table):not(.layout-table) tr {
        display: block;
    }

    /* Ensure layout tables inside physical-card maintain table structure */
    .physical-card table,
    .physical-card thead,
    .physical-card tbody,
    .physical-card tr,
    .physical-card th,
    .physical-card td {
        display: table !important;
    }

    .physical-card thead {
        display: table-header-group !important;
    }

    .physical-card tbody {
        display: table-row-group !important;
    }

    .physical-card tr {
        display: table-row !important;
    }

    .physical-card th,
    .physical-card td {
        display: table-cell !important;
    }


    table:not(.card-table):not(.layout-table) thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        margin-bottom: 1rem;
        background: rgba(255, 255, 255, 0.5);
        border-radius: var(--radius-md);
        border: 1px solid var(--glass-border);
        padding: 1rem;
    }

    td {
        border: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        position: relative;
        padding-left: 40%;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        text-align: right;
    }

    td:last-child {
        border-bottom: 0;
    }

    td:before {
        position: absolute;
        top: 0.5rem;
        left: 0;
        width: 35%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        text-align: left;
        color: var(--text-muted);
        content: attr(data-label);
        /* Requires data-label in HTML */
    }

    /* Revert .table-responsive scroll since we use Card View */
    .table-responsive {
        overflow-y: visible;
        max-height: none;
        border: none;
    }
}

/* Desktop Table Defaults */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    padding: 1rem;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

@media (min-width: 769px) {
    tr {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        transition: background 0.2s;
    }

    tr:hover {
        background: rgba(255, 255, 255, 0.4);
    }

    .table-responsive {
        overflow-y: auto;
        max-height: 65vh;
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 0.5rem;
    }
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(209, 213, 219, 0.8);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s;
    font-family: inherit;
    font-size: 1rem;
    /* Better for touch */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #e11d48);
    box-shadow: 0 4px 6px -1px rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 10px 15px -3px rgba(244, 63, 94, 0.3);
}

/* Utilities */
.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.flex {
    display: flex;
    gap: 1rem;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

/* Mobile Navigation Drawer Base Styles */
.nav-wrapper {
    /* Styles handled in Header due to dynamic toggle ID but can be centralized here */
}

/* Animations included in Header now, or can be moved here */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-entry {
    animation: fadeInUp 0.5s ease-out forwards;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    background-color: #e0e7ff;
    /* Opaque background for sticky */
    color: var(--secondary-color);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

tr:last-child td {
    border-bottom: none;
}

/* Table Responsive Wrapper */
.table-responsive {
    overflow-y: auto;
    max-height: 65vh;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: var(--secondary-color);
}

.btn-danger {
    background-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Utility */
.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.flex {
    display: flex;
    gap: 1rem;
}

.justify-between {
    justify-content: space-between;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-title {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Missing Utilities */
.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}