/* static/css/style.css */

/* --- CSS Variables for Easy Theme Management --- */
:root {
    --bg-dark-primary: #101418;
    --bg-dark-secondary: #1B2128;
    --bg-elevated: #202833;
    --glass-bg: rgba(24, 34, 45, 0.72);
    --glass-bg-strong: rgba(20, 29, 39, 0.84);
    --glass-border: rgba(154, 204, 255, 0.2);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 14px 35px rgba(5, 10, 16, 0.45);
    --text-primary: #EAECEF;
    --text-secondary: #C5D1DE;
    --text-faint: #8ea0b5;
    --accent-blue: #00BFFF;
    --accent-orange: #FFA500;
    --accent-red: #FF4747;
    --accent-green: #28a745;
    --border-color: rgba(0, 191, 255, 0.2);
    --soft-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-dark-primary);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(0, 191, 255, 0.14), transparent 32%),
        radial-gradient(circle at 86% 2%, rgba(255, 165, 0, 0.09), transparent 24%),
        radial-gradient(circle at 70% 88%, rgba(40, 167, 69, 0.08), transparent 26%),
        linear-gradient(180deg, #0f141a 0%, #111922 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    text-rendering: optimizeLegibility;
}

.app-shell {
    opacity: 1;
    transition: opacity 0.18s ease;
}

.app-shell.page-ready {
    opacity: 1;
}

.app-shell.page-leaving {
    opacity: 0.76;
}

.route-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    z-index: 5000;
    opacity: 0;
    background: linear-gradient(90deg, #00d4ff, #58ffb6);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.7);
    transition: width 0.25s ease, opacity 0.2s ease;
}

.route-progress.is-active {
    opacity: 1;
}

/* --- Motion System (Subtle + Professional) --- */
@keyframes fadeUpSoft {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInSoft {
    from { opacity: 0; }
    to { opacity: 1; }
}

.main-content > * {
    opacity: 0;
    animation: fadeUpSoft 360ms ease-out forwards;
}

.main-content > *:nth-child(1) { animation-delay: 30ms; }
.main-content > *:nth-child(2) { animation-delay: 80ms; }
.main-content > *:nth-child(3) { animation-delay: 130ms; }
.main-content > *:nth-child(4) { animation-delay: 180ms; }
.main-content > *:nth-child(5) { animation-delay: 230ms; }

.table tbody tr {
    animation: fadeInSoft 240ms ease-out both;
}

.table tbody tr:nth-child(1) { animation-delay: 20ms; }
.table tbody tr:nth-child(2) { animation-delay: 35ms; }
.table tbody tr:nth-child(3) { animation-delay: 50ms; }
.table tbody tr:nth-child(4) { animation-delay: 65ms; }
.table tbody tr:nth-child(5) { animation-delay: 80ms; }

.btn,
.nav-link,
.list-group-item,
.attendance-item,
.form-control,
.form-select,
.page-link,
.card {
    transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:active {
    transform: translateY(1px) scale(0.99);
}

.form-control,
.form-select {
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.attendance-item,
.list-group-item,
.table-modern tbody tr {
    will-change: transform, opacity;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

p {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-secondary) !important;
}

hr {
    border-color: var(--border-color);
}

/* --- Main Layout & Sidebar --- */
.sidebar {
    background: linear-gradient(180deg, rgba(24, 33, 43, 0.9), rgba(15, 21, 28, 0.92));
    border-right: 1px solid var(--glass-border);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    width: 260px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-nav-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    max-height: 50px;
    margin-bottom: 1rem;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.sidebar .nav-link {
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 4px 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar .nav-link:hover {
    background-color: rgba(0, 191, 255, 0.18);
    color: #fff;
    transform: translateX(3px);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(0, 191, 255, 0.9), rgba(0, 191, 255, 0.65));
    color: #fff;
    font-weight: 500;
}

.sidebar-heading {
    color: var(--accent-blue);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-dark-primary);
}

.main-content {
    margin-left: 260px;
    padding: 30px;
}
.main-content.no-sidebar {
    margin-left: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Futuristic Card Style --- */
.card {
    background: linear-gradient(160deg, var(--glass-bg), var(--glass-bg-strong));
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-highlight), transparent);
    pointer-events: none;
}
.card:hover {
    box-shadow: 0 18px 36px rgba(0, 191, 255, 0.12);
    transform: translateY(-3px);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

.card-title {
    color: var(--text-primary);
}

.card-text {
    color: var(--text-primary);
}

/* --- Tables --- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: rgba(0, 191, 255, 0.07);
    --bs-table-hover-bg: rgba(0, 191, 255, 0.1);
    --bs-table-hover-color: var(--text-primary);
}

.table th, .table td {
    color: var(--text-primary);
    vertical-align: middle;
}

.table-responsive {
    border-radius: 12px;
}

.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(12, 20, 28, 0.96);
}

.table thead th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    border-bottom-width: 1px;
}

.table-light {
    --bs-table-bg: rgba(0, 191, 255, 0.1);
    --bs-table-border-color: var(--border-color);
}

/* --- Forms & Inputs --- */
.form-label {
    color: var(--text-primary);
    font-weight: 500;
}

.form-control, .form-select {
    background-color: rgba(11, 19, 27, 0.8);
    color: var(--text-primary);
    border: 1px solid rgba(134, 188, 243, 0.28);
    border-radius: 10px;
    padding: 10px 12px;
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.form-control:focus, .form-select:focus {
    background-color: rgba(11, 19, 27, 0.95);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 0.16rem rgba(0, 191, 255, 0.35);
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bg-dark-secondary);
    color: var(--text-secondary);
    opacity: 0.7;
    cursor: not-allowed;
}



/* --- START: DEFINITIVE FIX FOR CALENDAR ICON --- */
/* This tells the browser to use dark-themed controls for the date input */
input[type="date"] {
    color-scheme: dark;
}

/* This specifically targets the calendar icon in WebKit browsers (Chrome, Safari, Edge) */
input[type="date"]::-webkit-calendar-picker-indicator {
    /* filter: invert(1) brightness(1.2); /* This filter turns the black icon to bright white */
    
    /* Step 1: Set the icon's color directly using your CSS variable */
    background-color: var(--accent-blue);

    /* Step 2: Use an SVG mask to shape the background into a calendar icon */
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" viewBox="0 0 16 16"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg>');
    mask-size: contain;
    mask-position: center;
    mask-repeat: no-repeat;

    cursor: pointer;
    transition: all 0.2s ease;
}

/* Adds a nice glow on hover */
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: drop-shadow(0 0 5px var(--accent-blue));
    /* filter: invert(1) brightness(1.5) drop-shadow(0 0 5px var(--accent-blue));*/
}
/* --- END: DEFINITIVE FIX FOR CALENDAR ICON --- */


/* --- Buttons --- */
.btn { border-radius: 8px; font-weight: 500; transition: all 0.3s ease; padding: 10px 20px; }
.btn-primary { background-color: var(--accent-blue); border-color: var(--accent-blue); color: white; }
.btn-primary:hover { box-shadow: 0 10px 20px rgba(0, 191, 255, 0.24); transform: translateY(-2px); }
.btn-danger { background-color: var(--accent-red); border-color: var(--accent-red); }
.btn-danger:hover { box-shadow: 0 10px 20px rgba(255, 71, 71, 0.24); transform: translateY(-2px); }
.btn-info { background-color: var(--accent-orange); border-color: var(--accent-orange); color: white; }
.btn-info:hover { box-shadow: 0 10px 20px rgba(255, 165, 0, 0.22); transform: translateY(-2px); }
.btn-success { background-color: var(--accent-green); border-color: var(--accent-green); }
.btn-success:hover { box-shadow: 0 10px 20px rgba(40, 167, 69, 0.22); transform: translateY(-2px); }
.btn-secondary { background-color: var(--bg-dark-secondary); border-color: var(--border-color); }
.btn-secondary:hover { background-color: #313a46; border-color: var(--accent-blue); }
.btn-outline-danger { color: var(--accent-red); border-color: var(--accent-red); }
.btn-outline-danger:hover { background-color: var(--accent-red); color: white; box-shadow: 0 0 15px var(--accent-red); }

.btn,
.form-control,
.form-select,
.input-group-text {
    min-height: 42px;
}

.input-group-text {
    background: rgba(0, 191, 255, 0.14);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

/* --- List Group & Other Components --- */
.list-group-item {
    background: linear-gradient(160deg, rgba(26, 36, 47, 0.72), rgba(18, 27, 36, 0.78));
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.25rem;
    border-radius: 14px;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.list-group-item-action:hover, .list-group-item-action:focus { background-color: rgba(0, 191, 255, 0.1); border-color: var(--accent-blue); transform: translateY(-3px); box-shadow: 0 4px 15px rgba(0, 191, 255, 0.15); z-index: 2; }
.list-group-item h5 { color: var(--text-primary); }
.list-group-item .due-warning { color: var(--accent-orange); font-weight: 600; }

.login-container { height: 100vh; display: flex; align-items: center; justify-content: center; }
.alert { border-radius: 10px; border-width: 1px; border-style: solid; }
.alert-success { background-color: rgba(40, 167, 69, 0.1); color: #9fdfaf; border-color: rgba(40, 167, 69, 0.5); }
.alert-danger { background-color: rgba(255, 71, 71, 0.1); color: #ff9a9a; border-color: rgba(255, 71, 71, 0.5); }
.alert-warning { background-color: rgba(255, 165, 0, 0.1); color: #ffd580; border-color: rgba(255, 165, 0, 0.5); }
.alert-info { background-color: rgba(0, 191, 255, 0.1); color: #87ceeb; border-color: rgba(0, 191, 255, 0.5); }
.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

.badge { border-radius: 6px; font-weight: 500; }
.bg-primary { background-color: var(--accent-blue) !important; }
.bg-success { background-color: var(--accent-green) !important; }

.summary-card { border-left-width: 5px; transition: all 0.3s ease; }
.summary-card-blue { border-left-color: var(--accent-blue); }
.summary-card-orange { border-left-color: var(--accent-orange); }
.summary-card-green { border-left-color: var(--accent-green); }
.summary-card .card-title { font-weight: 500; color: var(--text-primary); }
.summary-card .card-text { font-size: 2.5rem; font-weight: 700; color: var(--text-primary); }

.metric-card {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 45%);
}

.metric-value {
    font-size: 2.35rem;
    line-height: 1;
    font-weight: 700;
}

.metric-label {
    color: var(--text-faint);
    margin-bottom: 0.4rem;
}

.chart-card .card-header {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.form-card .card-header {
    font-weight: 600;
}

.form-help {
    color: var(--text-faint);
    font-size: 0.82rem;
}

.member-card { border-left: 5px solid var(--accent-blue); }
.member-card.is-due { border-left: 5px solid var(--accent-red); }
.product-card { text-align: center; cursor: pointer; border-radius: 10px; background-color: var(--bg-dark-secondary); border: 1px solid var(--border-color); }
.product-card:hover { transform: translateY(-5px); border-color: var(--accent-blue); box-shadow: 0 0 15px rgba(0, 191, 255, 0.3); }

.modal-content {
    background: linear-gradient(160deg, rgba(21, 31, 42, 0.84), rgba(17, 24, 32, 0.92));
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-dark-secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-blue); }

/* --- Navbar Fix --- */
.navbar.navbar-dark .navbar-nav .nav-link {
    color: var(--text-secondary);
    padding: 8px 15px;
    margin: 0 5px;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.navbar.navbar-dark .navbar-nav .nav-link:hover { color: rgb(255, 255, 255); background-color: rgba(0, 191, 255, 0.22); }
.navbar.navbar-dark .navbar-nav .nav-link.active { color: white; background: linear-gradient(90deg, rgba(0, 191, 255, 0.95), rgba(0, 191, 255, 0.7)); font-weight: 600; }
.navbar.navbar-dark .navbar-brand { color: var(--text-primary); }
.navbar.navbar-dark .navbar-text { color: var(--text-secondary); }

a {
    color: #72d8ff;
}

a:hover {
    color: #9ee6ff;
}

:focus-visible {
    outline: 3px solid #ffd166;
    outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible,
a:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(255, 209, 102, 0.35);
}

/* --- UI Polish Layer --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-subtitle {
    margin-bottom: 0;
    color: var(--text-faint);
}

.action-cluster {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-shell .card-body,
.filter-shell .card-body {
    padding: 1.2rem;
}

.panel-title {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.receptionist-toolbar {
    position: sticky;
    top: 12px;
    z-index: 30;
    border: 1px solid var(--glass-border);
    background: linear-gradient(140deg, rgba(26, 38, 50, 0.86), rgba(19, 28, 38, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chip-help {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.kbd-hint {
    display: inline-block;
    min-width: 1.4rem;
    padding: 0.08rem 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.74rem;
    background: rgba(0, 0, 0, 0.22);
    color: #e8f3ff;
    text-align: center;
}

.member-card {
    border-left: 4px solid rgba(0, 191, 255, 0.8);
}

.member-card.is-due {
    border-left: 4px solid var(--accent-red);
}

.attendance-list {
    max-height: 500px;
    overflow-y: auto;
}

.attendance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    margin-bottom: 0.55rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(0, 191, 255, 0.18);
    border-radius: 10px;
    background: rgba(16, 20, 24, 0.62);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.attendance-item:hover {
    border-color: rgba(0, 191, 255, 0.45);
    background: rgba(0, 191, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
}

.table-modern tbody tr {
    transition: background-color 0.2s ease;
}

.table-modern tbody tr:hover {
    background-color: rgba(0, 191, 255, 0.08);
}

.pagination .page-link {
    background: rgba(27, 33, 40, 0.8);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.pagination .page-item.active .page-link {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.pagination .page-link:hover {
    background: rgba(0, 191, 255, 0.14);
    color: #fff;
}

.overdue-expand-wrap {
    display: flex;
    justify-content: center;
}

.overdue-expand-btn {
    min-width: 220px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: static;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-nav-wrapper {
        max-height: 320px;
    }

    .main-content {
        margin-left: 0;
        padding: 18px;
    }

    .page-header {
        flex-direction: column;
    }

    .receptionist-toolbar {
        position: static;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .app-shell {
        opacity: 1;
    }

    .route-progress {
        display: none;
    }

    .main-content > *,
    .table tbody tr {
        opacity: 1 !important;
        animation: none !important;
    }
}