/* Core theme */
:root {
    --app-bg: #f4f6f9;
    --app-bg-2: #eef1f5;
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --border: #e2e8f0;
    --text: #1f2937;
    --muted: #6b7280;
    --brand-dark: #212529;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --radius-sm: 12px;
    --transition: 180ms ease;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: radial-gradient(1200px 500px at 10% -10%, #ffffff 0%, var(--app-bg) 45%, var(--app-bg-2) 100%);
    color: var(--text);
    font-family: "Space Grotesk", "IBM Plex Sans", "Work Sans", sans-serif;
    letter-spacing: -0.2px;
}

a {
    text-decoration: none;
    transition: color var(--transition), background var(--transition), transform var(--transition);
}

.app-shell {
    min-height: 100vh;
    padding-bottom: 88px;
}

.app-header {
    background: linear-gradient(90deg, #1d232b, #212529);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.app-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.brand img {
    height: 34px;
    margin-top: -15px;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.app-nav__link {
    color: #e5e7eb;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.app-nav__link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateY(-1px);
}

.app-nav__link.is-active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.app-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-content {
    padding: 2rem 0 3rem;
}

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

.page-title {
    font-size: 1.6rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--muted);
    margin-top: 0.25rem;
}

.card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1.25rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-card--primary {
    border-left: 4px solid #0d6efd;
}

.stat-card--success {
    border-left: 4px solid #198754;
}

.stat-card--warning {
    border-left: 4px solid #ffc107;
}

.stat-card--danger {
    border-left: 4px solid #dc3545;
}

.stat-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 600;
    margin-top: 0.35rem;
}

.form-control,
.form-select {
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    background: #fff;
    transition: border var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: #ced4da;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
}

.input-group-text {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.btn {
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-weight: 600;
    transition: transform var(--transition), box-shadow var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.table {
    margin: 0;
}

.table thead th {
    border-bottom: 1px solid var(--border);
    background: #1f2937;
    color: #fff;
    font-weight: 600;
}

.table th,
.table td {
    vertical-align: middle;
    padding: 0.9rem;
}

.table td .btn {
    padding: 0.35rem 0.7rem;
}

.modal-content {
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.modal-backdrop.show {
    opacity: 0.65;
    backdrop-filter: blur(3px);
}

/* FullCalendar modern styling */
.fc {
    font-family: inherit;
}

.fc .fc-toolbar-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.fc .fc-button {
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.35rem 0.8rem;
    font-weight: 600;
    box-shadow: none;
    transition: background var(--transition), transform var(--transition);
}

.fc .fc-button:hover {
    background: var(--surface-2);
    color: var(--text);
    transform: translateY(-1px);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: #212529;
    border-color: #212529;
    color: #fff;
}

.fc .fc-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
}

.fc .fc-button .fc-icon {
    display: none;
}

.fc .fc-prev-button::before {
    content: "‹";
    font-size: 1.2rem;
}

.fc .fc-next-button::before {
    content: "›";
    font-size: 1.2rem;
}

.fc-theme-standard .fc-scrollgrid {
    border: none;
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: var(--border);
}

.fc .fc-daygrid-day-frame,
.fc .fc-timegrid-col-frame {
    background: #fff;
}

.fc .fc-daygrid-day-top {
    padding: 0.4rem 0.6rem;
}

.fc .fc-daygrid-day-number {
    color: var(--text);
    font-weight: 600;
}

.fc .fc-timegrid-slot {
    height: 2.4rem;
}

.fc .fc-event {
    border-radius: 12px;
    border: none;
    padding: 2px 6px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}

.fc .fc-event-title {
    font-weight: 600;
}

.fc .fc-timegrid-now-indicator-line {
    border-color: #dc3545;
}

.fc .fc-day-today {
    background: #fdf6e9;
}

.fc .fc-col-header-cell-cushion {
    color: var(--muted);
    font-weight: 600;
    padding: 0.6rem 0.5rem;
}

.fc .fc-timegrid-axis-cushion {
    color: var(--muted);
    font-size: 0.8rem;
}

.fc .fc-timegrid-slot-label-cushion {
    color: var(--muted);
}

.fc-event.status-active {
    background: rgba(25, 135, 84, 0.9);
}

.fc-event.status-upcoming {
    background: rgba(13, 110, 253, 0.9);
}

.fc-event.status-completed {
    background: rgba(108, 117, 125, 0.9);
}

.fc-event-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    color: #fff;
}

.fc-event-card__time {
    font-size: 0.78rem;
    opacity: 0.85;
}

.fc-event-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}

.fc-event-card__status {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
}

.fc-list {
    border: none;
}

.fc-list-day-cushion {
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    padding: 0.75rem 0.25rem 0.5rem;
}

.fc-list-event {
    background: transparent;
    border: none;
}

.fc-list-event:hover td {
    background: transparent;
}

.fc-list-event .fc-list-event-title {
    padding: 0;
}

.fc-list-event-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.5rem;
}

.fc-list-event-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.fc-list-event-card__title {
    font-weight: 600;
    font-size: 1rem;
}

.fc-list-event-card__time {
    color: var(--muted);
    font-size: 0.85rem;
}

.fc-status-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    color: #fff;
}

.fc-status-pill.status-active {
    background: #198754;
}

.fc-status-pill.status-upcoming {
    background: #0d6efd;
}

.fc-status-pill.status-completed {
    background: #6c757d;
}

.fc-event-modal .modal-body {
    display: grid;
    gap: 0.75rem;
}

.fc-event-modal .btn[disabled] {
    opacity: 0.5;
}

@media (max-width: 768px) {
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.6rem;
    }
    .fc .fc-button {
        width: 100%;
    }
    .fc .fc-toolbar-chunk {
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 0.5rem;
    }
    .fc .fc-timegrid-slot-label {
        font-size: 0.75rem;
    }

    .fc .fc-daygrid-event,
    .fc .fc-timegrid-event {
        border-radius: 12px;
        padding: 2px 6px;
    }

    .fc .fc-daygrid-event .fc-event-title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.78rem;
        line-height: 1.2;
    }

    .fc .fc-timegrid-event .fc-event-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.78rem;
        line-height: 1.2;
    }

    .fc .fc-timegrid-event {
        min-height: 34px;
    }

    .fc .fc-event-card__title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.08);
    padding: 0.35rem 0.75rem;
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
    z-index: 1030;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--muted);
    gap: 0.2rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: 12px;
}

.bottom-nav a.is-active {
    color: var(--text);
    background: var(--surface-2);
}

.mobile-only {
    display: none;
}

.fab-scan {
    position: fixed;
    right: 1rem;
    bottom: 5.5rem;
    z-index: 1040;
    background: #198754;
    color: #fff;
    border-radius: 999px;
    padding: 0.75rem 1.1rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fab-scan:hover {
    color: #fff;
    transform: translateY(-1px);
}

.qr-scanner {
    width: 100%;
    min-height: 280px;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-flex;
    }
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: radial-gradient(900px 450px at 15% 10%, rgba(25, 135, 84, 0.15), transparent 60%),
        radial-gradient(900px 450px at 90% 20%, rgba(255, 193, 7, 0.15), transparent 60%),
        #111418;
}

.auth-card {
    width: min(420px, 100%);
    background: rgba(25, 28, 33, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    color: #f8fafc;
}

.auth-card .form-control {
    background: rgba(17, 20, 24, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.auth-card .form-control::placeholder {
    color: rgba(248, 250, 252, 0.6);
}

.auth-card .btn {
    width: 100%;
}

@media (max-width: 992px) {
    .app-nav {
        display: none;
    }
    .app-actions .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-title {
        font-size: 1.35rem;
    }
}

@media (max-width: 768px) {
    .app-content {
        padding: 1.5rem 0 2rem;
    }
    .table-responsive {
        border: none;
        box-shadow: none;
        background: transparent;
    }
    .table thead {
        display: none;
    }
    .table tbody tr {
        display: block;
        background: #fff;
        margin-bottom: 1rem;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        padding: 0.75rem 1rem;
        box-shadow: var(--shadow);
    }
    .table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.5rem 0;
        border: none;
    }
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
    }
    .table tbody td:last-child {
        justify-content: flex-end;
    }
    .table tbody td:last-child::before {
        display: none;
    }
    .modal-dialog {
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
    .modal-content {
        border-radius: 18px 18px 0 0;
    }
}

@media (min-width: 993px) {
    .bottom-nav {
        display: none;
    }
}
