/* ========== GLOBAL LAYOUT ========== */
:root {
    /* Light mode colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-hero: linear-gradient(120deg, #0ea5e9, #22c55e);
    --bg-body: linear-gradient(135deg, #0ea5e9, #6366f1);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-card: 0 8px 18px rgba(15, 23, 42, 0.08);
    --shadow-main: 0 24px 60px rgba(15, 23, 42, 0.35);
}

[data-theme="dark"] {
    /* Dark mode colors - Three distinct layers */
    --bg-primary: #1a202c;                 /* dashboard background (medium dark) */
    --bg-secondary: #2d3748;               /* cards (lightest dark layer) */
    --bg-hero: linear-gradient(120deg, #0ea5e9, #22c55e);
    --bg-body: linear-gradient(135deg, #0a0e14, #0f1419); /* main background (darkest) */

    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-muted: #718096;

    --border-color: #4a5568;
    --shadow-card: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-main: 0 25px 60px rgba(0, 0, 0, 0.8);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Centered app shell */
.app-shell {
    width: 100%;
    max-width: 1400px;
    padding: 16px;
}

/* Main card */
.dashboard {
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-main);
    padding: 24px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Top header area */
.header-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-date-info {
    display: flex;
    align-items: center;
}

.current-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Header auth buttons */
.header-actions {
    display: flex;
    gap: 10px;
}

#headerSignedIn {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-btn {
    padding: 10px 14px;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.18);
}

/* Secondary auth button (Sign in) */
.auth-btn-secondary {
    background: #22c55e; /* green */
    color: white;
}

.auth-btn-secondary:hover {
    background: #16a34a;
    text-decoration: none;
}

/* Report Issue Button */
.report-btn {
    padding: 10px 14px;
    border-radius: 10px;
    background: #ef4444;
    color: white;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    border: none;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.report-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.18);
}

[data-theme="dark"] .report-btn {
    color: white !important;
}

[data-theme="dark"] .report-btn:hover {
    color: white !important;
}

/* My Tickets Button */
.my-tickets-btn {
    padding: 10px 14px;
    border-radius: 10px;
    background: #fbbf24;
    color: #1f2937;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    border: none;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.my-tickets-btn:hover {
    background: #f59e0b;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.18);
}

[data-theme="dark"] .my-tickets-btn {
    background: #fbbf24;
    color: #1f2937 !important;
}

[data-theme="dark"] .my-tickets-btn:hover {
    background: #f59e0b;
    color: #1f2937 !important;
}

/* Ticket Message (feedback for ticket submission) */
#ticketMessage {
    min-height: 24px;
    font-size: 0.95rem;
}

/* Tickets List Page */
.ticket-page-wrap {
    width: 100%;
    margin-top: 24px;
}

.ticket-list-card {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.ticket-list-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.ticket-list-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tickets-message {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ticket-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ticket-row:hover {
    background: rgba(37, 99, 235, 0.05);
    border-color: #2563eb;
    transform: translateX(2px);
}

.ticket-row-main {
    flex: 1;
    min-width: 0;
}

.ticket-row-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    word-break: break-word;
}

.ticket-row-meta {
    display: flex;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ticket-row-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

.ticket-row-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    white-space: nowrap;
}

/* Ticket Pills (severity & status) */
.ticket-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.severity-low {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.severity-medium {
    background: rgba(234, 179, 8, 0.15);
    color: #d97706;
}

.severity-high {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.severity-urgent {
    background: #7f1d1d;
    color: #fca5a5;
}

.severity-default {
    background: rgba(148, 163, 184, 0.15);
    color: #64748b;
}

.status-open {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

.status-in-progress {
    background: rgba(168, 85, 247, 0.15);
    color: #7c3aed;
}

.status-fixed {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.status-default {
    background: rgba(148, 163, 184, 0.15);
    color: #64748b;
}

/* Empty State */
.empty-tickets-state {
    text-align: center;
    padding: 40px 24px;
}

.empty-tickets-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-tickets-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: relative;
}

.toggle-checkbox {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-inner {
    position: relative;
    width: 52px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 2px solid #cbd5e1;
}

.toggle-switch {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.toggle-switch::before {
    content: "☀️";
    transition: opacity 0.3s ease;
}

.toggle-text {
    display: none; /* Hide external icons */
}

/* When dark mode is ON */
.toggle-checkbox:checked + .toggle-label .toggle-inner {
    background: #3b82f6;
    border-color: #2563eb;
}

.toggle-checkbox:checked + .toggle-label .toggle-switch {
    transform: translateX(24px);
    background: #1e293b;
}

.toggle-checkbox:checked + .toggle-label .toggle-switch::before {
    content: "🌙";
}

/* ========== HOME HERO ========== */
.hero {
    background: var(--bg-hero);
    border-radius: 16px;
    padding: 20px;
    color: white;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 380px; /* left hero copy + right stats */
    gap: 18px;
    align-items: start;
    transition: background 0.3s ease;
}

.hero-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.hero-text {
    font-size: 0.95rem;
    opacity: 0.95;
}

.hero-bullets {
    font-size: 0.85rem;
    margin-top: 8px;
    padding-left: 20px;
}

.hero-bullets li {
    margin-bottom: 4px;
}

/* Simple fake “stats” on the right */
.hero-stats {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.8rem;
}

.hero-stat-label {
    color: #dbeafe;
}

.hero-stat-value {
    font-weight: 700;
}

/* === Calendar section: horizontal cards === */
.calendar-section {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr; /* Today card slightly smaller than Upcoming */
    gap: 16px;
    margin-bottom: 20px;
}

/* Today Mini Card */
.today-mini-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-card);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.today-header {
    margin-bottom: 12px;
}

.today-day {
    font-size: 24px;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.2;
}

.today-week {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.today-next {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 12px;
}

.next-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.next-event {
    color: var(--text-primary);
    font-weight: 700;
}

.calendar-open-btn {
    display: inline-flex;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    text-decoration: none;
    border: 1px solid rgba(37, 99, 235, 0.2);
    transition: all 0.2s ease;
}

.calendar-open-btn:hover {
    background: rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}

/* Upcoming Events */
.upcoming-events {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-card);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.upcoming-header {
    font-size: 16px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upcoming-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.upcoming-item-main {
    flex: 1;
}

.upcoming-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.upcoming-item-date {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.upcoming-item-pill {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.upcoming-item-pill.academic {
    background: rgba(34, 197, 94, 0.15);
    color: rgb(21, 128, 61);
}

.upcoming-item-pill.deadline {
    background: rgba(239, 68, 68, 0.15);
    color: rgb(185, 28, 28);
}

.upcoming-item-pill.holiday {
    background: rgba(168, 85, 247, 0.15);
    color: rgb(124, 58, 237);
}

/* Dark mode adjustments */
[data-theme="dark"] .upcoming-item-pill.academic {
    background: rgba(34, 197, 94, 0.15);
    color: rgb(74, 222, 128);
}

[data-theme="dark"] .upcoming-item-pill.deadline {
    background: rgba(239, 68, 68, 0.15);
    color: rgb(248, 113, 113);
}

[data-theme="dark"] .upcoming-item-pill.holiday {
    background: rgba(168, 85, 247, 0.15);
    color: rgb(196, 181, 253);
}

[data-theme="dark"] .calendar-open-btn {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .calendar-open-btn:hover {
    background: rgba(59, 130, 246, 0.2);
}

/* Mobile: stack vertically */
@media (max-width: 980px) {
    .calendar-section {
        grid-template-columns: 1fr;
    }
}

/* Module grid (home) */
.modules-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.resources-section {
    margin-top: 32px; /* change this number to get more/less space */
}

/* Training modules - native scrolling with fade edges */
.modules-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 16px 0;
    margin-bottom: 20px;
    position: relative;
    width: 100%;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    /* Make focusable */
    outline: none;
    cursor: grab;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.modules-carousel:focus {
    background-color: rgba(59, 130, 246, 0.02);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .modules-carousel:focus {
    background-color: rgba(56, 189, 248, 0.05);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.modules-carousel:active {
    cursor: grabbing;
}

.modules-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Fade edges to indicate scrollable content - REMOVED for clean display */
.modules-carousel::before,
.modules-carousel::after,
.resources-carousel::before,
.resources-carousel::after {
    content: none;
}

/* Study Resources - native scrolling with fade edges */
.resources-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 16px 0;
    margin-bottom: 20px;
    position: relative;
    width: 100%;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    /* Make focusable */
    outline: none;
    cursor: grab;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.resources-carousel:focus {
    background-color: rgba(59, 130, 246, 0.02);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .resources-carousel:focus {
    background-color: rgba(56, 189, 248, 0.05);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.resources-carousel:active {
    cursor: grabbing;
}

.resources-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}



.module-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 260px;
    max-width: 260px;
    flex-shrink: 0;
    cursor: pointer;
    white-space: normal;
    outline: none;
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #22c55e);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.module-card:hover::before {
    opacity: 1;
}

.module-card:focus {
    outline: none;
}

.module-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    color: var(--text-primary);
    text-decoration: none;
    border-color: rgba(14, 165, 233, 0.3);
}

[data-theme="dark"] .module-card:hover {
    border-color: rgba(14, 165, 233, 0.5);
    background: #374151;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.module-card:active {
    transform: translateY(-1px) scale(1.01);
    transition: transform 0.1s ease;
}

.module-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.module-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.module-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.module-meta span:first-child {
    color: #0ea5e9;
    font-weight: 600;
}

.module-meta span:last-child {
    color: var(--text-muted);
    font-weight: 500;
}

.resource-card {
    background: var(--bg-secondary);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 320px;
    max-width: 320px;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border-color 0.3s ease;
    cursor: default;
    white-space: normal;
    outline: none;
}

.resource-card:focus {
    outline: none;
}

.resource-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
    border-color: #0ea5e9;
}

[data-theme="dark"] .resource-card:hover {
    border-color: #38BDF8;
    background: #203245;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
}

/* ========== MODULE PAGE STYLES ========== */

/* Module Hero Section */
.module-hero {
    background: var(--bg-hero);
    border-radius: 16px;
    padding: 24px;
    color: white;
    margin-bottom: 32px;
    transition: background 0.3s ease;
}

.module-hero-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.module-hero-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.module-hero-text {
    font-size: 1rem;
    opacity: 0.95;
    line-height: 1.6;
    max-width: 80%;
}

.module-hero-stats {
    display: flex;
    gap: 32px;
    margin-top: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Quiz Modules Section */
.quiz-modules-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.quiz-module-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease, border-color 0.3s ease;
}

.quiz-module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    border-color: #3b82f6;
}

.quiz-module-card.featured {
    border-color: #22c55e;
    background: linear-gradient(135deg, var(--bg-secondary), rgba(34, 197, 94, 0.05));
}

.quiz-badge {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.quiz-module-card.featured .quiz-badge {
    background: #dcfce7;
    color: #166534;
}

/* Clickable card link styling */
.quiz-module-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border-color: #3b82f6;
    background: linear-gradient(135deg, var(--bg-secondary), rgba(59, 130, 246, 0.05));
}

.quiz-module-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
    border-color: #2563eb;
    background: linear-gradient(135deg, var(--bg-secondary), rgba(59, 130, 246, 0.1));
}

.quiz-module-link .quiz-badge {
    background: #dbeafe;
    color: #1e40af;
}

.quiz-module-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.quiz-module-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.quiz-module-info {
    flex: 1;
}

.quiz-module-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.quiz-module-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.quiz-module-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
}

.quiz-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.meta-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-ready {
    color: #4ADE80 !important;
}

.status-completed {
    color: #22c55e !important;
    font-weight: 700;
}

.status-cooldown {
    color: #f59e0b !important;
    font-weight: 600;
}

.status-locked {
    color: #94a3b8 !important;
}

.quiz-module-card.is-completed {
    border: 1px solid rgba(34,197,94,0.4);
}

.status-coming-soon {
    color: #d97706 !important;
}

.quiz-start-btn {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-size: 0.9rem;
}

.quiz-start-btn.primary {
    background: #3b82f6;
    color: white !important;
}

.quiz-start-btn.primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    color: white !important;
}

.quiz-start-btn:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Dark mode override for quiz start buttons */
[data-theme="dark"] .quiz-start-btn.primary {
    background: #3b82f6;
    color: white !important;
}

[data-theme="dark"] .quiz-start-btn.primary:hover {
    background: #2563eb;
    color: white !important;
}

/* Phase 4-5: Quiz button states (completed/unlocked/locked) */
.quiz-btn {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: white !important;
}

.quiz-btn.completed {
    background: #10b981 !important;
}

.quiz-btn.completed:hover {
    background: #059669 !important;
    transform: translateY(-1px);
}

.quiz-btn.unlocked {
    background: #2563eb !important;
}

.quiz-btn.unlocked:hover {
    background: #1d4ed8 !important;
    transform: translateY(-1px);
}

.quiz-btn.locked {
    background: #9ca3af !important;
    color: #111827 !important;
    cursor: not-allowed;
}

.quiz-btn.locked:hover {
    background: #9ca3af !important;
    transform: none;
}

[data-theme="dark"] .quiz-btn.locked {
    color: #e5e7eb !important;
}

/* Resources Grid */
.resources-section {
    margin-top: 32px;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.resource-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.resource-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #22c55e, #8b5cf6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.resource-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
    border-color: #0ea5e9;
}

.resource-item:hover::before {
    opacity: 1;
}

[data-theme="dark"] .resource-item:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: #0ea5e9;
}

.resource-icon {
    font-size: 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(34, 197, 94, 0.1));
    border-radius: 12px;
    margin-top: 2px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.resource-item:hover .resource-icon {
    transform: scale(1.1);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(34, 197, 94, 0.2));
}

.resource-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resource-title {
    font-size: 1rem;
    font-weight: 650;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.resource-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.resource-actions {
    margin-top: auto;
}

.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resource-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.resource-status {
    font-size: 0.75rem;
    color: #0ea5e9;
    font-weight: 600;
    background: rgba(14, 165, 233, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    flex-shrink: 0;
}

[data-theme="dark"] .resource-status {
    background: rgba(14, 165, 233, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-modules-grid {
        grid-template-columns: 1fr;
    }
    
    .module-hero-text {
        max-width: 100%;
    }
    
    .module-hero-stats {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .quiz-module-meta {
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* Footer note */
.footer-note {
    margin-top: 18px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    transition: color 0.3s ease;
}

.copyright {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.resource-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.resource-icon {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: 8px;
    flex-shrink: 0;
    color: var(--text-primary);
}

.resource-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.resource-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.resource-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.resource-btn {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.resource-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
    text-decoration: none;
    color: white;
}

.resource-btn.disabled {
    background: #e2e8f0;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
}

.resource-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.resource-link {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.resource-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
    text-decoration: none;
    color: white;
}

.resource-status {
    font-size: 0.75rem;
    color: #0ea5e9;
    font-weight: 600;
    background: rgba(14, 165, 233, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
}

.resource-status.coming-soon {
    color: #94a3b8;
}

/* ========== QUIZ PAGE (TABS) ========== */

#quizContent {
    margin-top: 10px;
}

/* Tabs row */
.quiz-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.quiz-tab {
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
    background: #e0f2fe;
    color: #0369a1;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.quiz-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.quiz-tab.active {
    background: #0ea5e9;
    color: #f9fafb;
}

.quiz-tab[aria-disabled="true"] {
    pointer-events: none;
    cursor: default;
}

/* Sections */
.quiz-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow-card);
    margin-top: 4px;
    display: none;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Only show the active quiz section */
.quiz-section.active {
    display: block;
}

/* Question cards */
.question {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    margin-bottom: 10px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.question-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.question-tag {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* Options */
.options,
.sim-options {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.option-label input {
    margin-top: 2px;
}

/* Buttons */
.primary-btn {
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #f9fafb;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    margin-top: 6px;
}

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

/* Feedback + score */
.feedback {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.feedback.positive {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 8px;
    padding: 4px 6px;
}

.feedback.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    padding: 4px 6px;
}

.quiz-score {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #22c55e;
    font-weight: 600;
}

/* Textareas (written answers) */
textarea {
    width: 100%;
    min-height: 70px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Simulation box */
.sim-header {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.sim-progress {
    font-size: 0.8rem;
    color: #64748b;
}

.sim-question {
    margin-top: 6px;
    font-size: 0.9rem;
}

/* Mobile tweaks */
@media (max-width: 700px) {
    .dashboard {
        padding: 16px;
        border-radius: 16px;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
    }

    body {
        padding: 8px;
        align-items: stretch;
    }
}

/* ===== Wizard-style MC quiz extras ===== */

.mc-header {
    margin-bottom: 8px;
}

.mc-progress-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    transition: color 0.3s ease;
}

.mc-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 999px;
    overflow: hidden;
    transition: background 0.3s ease;
}

.mc-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #0ea5e9, #22c55e);
    transition: width 0.2s ease;
}

.mc-nav {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mc-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Secondary button (for Back) */
.primary-btn.secondary {
    background: var(--border-color);
    color: #000;
    box-shadow: none;
    transition: background 0.3s ease, color 0.3s ease;
    font-weight: 700;
}

.primary-btn.secondary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

/* Dark mode improvements for secondary button visibility */
[data-theme="dark"] .primary-btn.secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 700;
}

[data-theme="dark"] .primary-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

/* Quiz Results Styling */
.quiz-results-recommendation {
    background: var(--bg-secondary);
    transition: background 0.3s ease;
}

.recommendation-text {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.quiz-results-community {
    background: var(--bg-secondary);
    transition: background 0.3s ease;
}

.community-text {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

/* Safety Quiz Results Styling */
.quiz-results {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 20px;
}

.results-header {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    transition: background 0.3s ease;
}

.results-header.passed {
    border: 2px solid #22c55e;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

[data-theme="dark"] .results-header.passed {
    background: linear-gradient(135deg, #052e16, #14532d);
    border-color: #22c55e;
}

.results-header.failed {
    border: 2px solid #ef4444;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
}

[data-theme="dark"] .results-header.failed {
    background: linear-gradient(135deg, #450a0a, #7f1d1d);
    border-color: #ef4444;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.results-header h2 {
    margin: 0 0 16px 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.percentage {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pass-message,
.requirement-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.missed-questions {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: var(--shadow-card);
    transition: background 0.3s ease;
}

.missed-questions h3 {
    margin: 0 0 16px 0;
    text-align: center;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.missed-list {
    margin-bottom: 16px;
}

.missed-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #f1f5f9;
    border-radius: 8px;
    border-left: 4px solid #ef4444;
    transition: background 0.3s ease;
}

[data-theme="dark"] .missed-item {
    background: var(--bg-primary);
}

.question-number {
    font-weight: 600;
    color: #ef4444;
    display: block;
    margin-bottom: 4px;
}

.question-text {
    color: var(--text-primary);
    line-height: 1.4;
}

.review-note {
    text-align: center;
    font-style: italic;
    color: var(--text-secondary);
    margin: 16px 0 0 0;
    font-size: 0.95rem;
}

.quiz-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Improve link visibility in dark mode */
[data-theme="dark"] a {
    color: #60a5fa !important; /* Lighter blue for better contrast */
}

[data-theme="dark"] a:hover {
    color: #93c5fd !important; /* Even lighter blue on hover */
}

/* Keep resource links white in dark mode */
[data-theme="dark"] .resource-link {
    color: white !important;
}

[data-theme="dark"] .resource-link:hover {
    color: white !important;
}

/* Keep auth buttons white in dark mode */
[data-theme="dark"] .auth-btn {
    color: white !important;
}

[data-theme="dark"] .auth-btn:hover {
    color: white !important;
}

/* Keep resource buttons white in dark mode */
[data-theme="dark"] .resource-btn {
    color: white !important;
}

[data-theme="dark"] .resource-btn:hover {
    color: white !important;
}

/* Specific styling for review links in quiz cards */
[data-theme="dark"] .quiz-module-card a,
[data-theme="dark"] .module-card a {
    color: #60a5fa !important;
    text-decoration: none;
}

[data-theme="dark"] .quiz-module-card a:hover,
[data-theme="dark"] .module-card a:hover {
    color: #93c5fd !important;
    text-decoration: underline;
}

/* Debug Tools */
.debug-btn {
    padding: 10px 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: rgba(255,255,255,0.92);
    color: #0f172a;
    font-weight: 700;
    cursor: pointer;
}

html[data-theme="dark"] .debug-btn {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    border-color: rgba(255,255,255,0.15);
}

/* Review Button (for passed quizzes) */
.review-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: none !important;
}

.review-btn:hover {
    opacity: 0.95;
    transform: translateY(-2px);
}

html[data-theme="dark"] .review-btn {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%) !important;
}

/* Responsive media query for ticket system */
@media (max-width: 900px) {
    .ticket-form {
        grid-template-columns: 1fr;
    }

    .ticket-list {
        grid-template-columns: 1fr;
    }

    .ticket-row {
        flex-direction: column;
        gap: 12px;
    }

    .ticket-description {
        order: 3;
    }

    .ticket-pills {
        gap: 8px;
    }

    .ticket-pill {
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .ticket-page-wrap {
        margin-top: 16px;
        padding: 0 12px;
    }

    .ticket-card {
        padding: 16px;
        border-radius: 12px;
    }

    .empty-tickets-state {
        padding: 40px 16px;
    }

    .empty-state-icon {
        font-size: 2.5rem;
    }

    .empty-state-text h3 {
        font-size: 1.2rem;
    }

    .empty-state-text p {
        font-size: 0.9rem;
    }
}

/* ===== Admin Tickets Styling ===== */
.ticket-admin-wrap {
    width: 100%;
    margin-top: 24px;
}

.ticket-admin-card {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.ticket-admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.ticket-admin-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-primary);
}

.ticket-admin-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-admin-controls select {
    min-width: 170px;
}

.admin-tickets-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-ticket-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-ticket-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.admin-ticket-main {
    flex: 1;
    min-width: 0;
}

.admin-ticket-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.admin-ticket-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-ticket-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.admin-ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.admin-ticket-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
}

.admin-ticket-side {
    width: 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.admin-status-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 42px 10px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    min-width: 160px;
    height: 42px;
    width: 100%;
}

.admin-status-select:hover {
    border-color: rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.admin-status-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.admin-status-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.ticket-admin-controls select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 42px 10px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    min-width: 180px;
    height: 42px;
}

.ticket-admin-controls select:hover {
    border-color: rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.ticket-admin-controls select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.ticket-admin-controls select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .ticket-admin-controls select,
[data-theme="dark"] .admin-status-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ===== Ticket Detail Page Styling ===== */
.ticket-detail-wrap {
    width: 100%;
    margin-top: 24px;
}

.ticket-detail-card {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.ticket-detail-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.ticket-detail-title {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.ticket-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.ticket-detail-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.ticket-field {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px;
}

.ticket-field-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.ticket-field-value {
    font-size: 0.96rem;
    color: var(--text-primary);
    word-break: break-word;
}

.ticket-long-field {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
}

.ticket-long-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ticket-long-value {
    color: var(--text-primary);
    line-height: 1.6;
    word-break: break-word;
}

.ticket-detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

@media (max-width: 760px) {
    .ticket-field-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Clickable Row Styling ===== */
.ticket-row-link,
.admin-ticket-row-link {
    cursor: pointer;
}

.ticket-row-link:hover,
.admin-ticket-row-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

@media (max-width: 860px) {
    .admin-ticket-row {
        flex-direction: column;
    }

    .admin-ticket-side {
        width: 100%;
        align-items: flex-start;
    }

    .admin-status-select {
        width: 100%;
    }
}

/* ========== GLOBAL MOBILE BASE RULES ========== */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== 768PX TABLET BREAKPOINT ========== */
@media (max-width: 768px) {
    .app-shell,
    .dash,
    .container,
    .page,
    .wrap {
        padding: 14px !important;
    }

    .dashboard,
    .card,
    .panel,
    .ticket-card,
    .modal-card {
        padding: 16px;
        border-radius: 14px;
    }

    .dash-header,
    .header,
    .page-header,
    .header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-right,
    .header-actions,
    .top-actions,
    .ticket-actions,
    .ticket-admin-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }

    .header-right .btn,
    .header-actions .btn,
    .header-actions .auth-btn,
    .top-actions .btn,
    .ticket-actions .btn,
    .ticket-admin-controls .auth-btn,
    .ticket-admin-controls button,
    .ticket-admin-controls select,
    .report-btn,
    .my-tickets-btn,
    .auth-btn,
    .ticket-badge-link {
        width: 100%;
        min-width: 0;
        justify-content: center;
    }

    h1 {
        font-size: 20px;
        line-height: 1.15;
    }

    h2 {
        font-size: 18px;
    }

    .muted,
    .subtitle,
    .brand-subtitle {
        font-size: 14px;
    }

    .filters,
    .ticket-filters,
    .ticket-admin-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .filters select,
    .filters input,
    .filters .btn,
    .ticket-filters select,
    .ticket-filters input,
    .ticket-filters .btn,
    .ticket-admin-controls select,
    .ticket-admin-controls button {
        width: 100%;
    }

    .modal-banner {
        height: 140px;
    }
}

/* ========== 520PX SMALL PHONE BREAKPOINT ========== */
@media (max-width: 520px) {
    .app-shell,
    .dash,
    .container,
    .page,
    .wrap {
        padding: 12px;
    }

    .dashboard,
    .card,
    .panel,
    .ticket-card,
    .modal-card {
        padding: 14px;
        border-radius: 12px;
    }

    .header-right,
    .header-actions,
    .top-actions,
    .ticket-actions,
    .ticket-admin-controls {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .btn,
    .report-btn,
    .my-tickets-btn,
    .auth-btn,
    .ticket-badge-link {
        padding: 12px 14px;
        font-size: 14px;
    }

    h1 {
        font-size: 18px;
        line-height: 1.2;
    }

    h2 {
        font-size: 16px;
    }

    .brand-title {
        font-size: 1.3rem;
    }

    .brand-subtitle,
    .muted,
    .subtitle {
        font-size: 13px;
    }

    .ticket-meta,
    .ticket-row,
    .admin-ticket-row {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .ticket-admin-top {
        flex-direction: column;
        gap: 10px;
    }

    .ticket-admin-title {
        font-size: 16px;
    }

    .modal-banner {
        height: 120px;
    }

    .current-date {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}
