/* Stock Photo DB Custom Styles */

/* ── Base (theme-neutral) ────────────────────────────────── */
body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
}

.navbar span, .navbar i.fas, .navbar i.fa,
.me-1 { margin-right: 2px !important; }
.me-2 { margin-right: 4px !important; }
.ms-1 { margin-left: 2px !important; }
.ms-2 { margin-left: 4px !important; }
.gap-1 { gap: 2px !important; }

.container {
    max-width: 100% !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

.navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.navbar-brand { font-size: 1.25rem; letter-spacing: 0.5px; }

.stat-card {
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .card-body { padding: 1.25rem; }
.stat-card h2 { font-size: 2rem; font-weight: 700; }

.subject-card .card {
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.subject-card .card:hover { transform: translateY(-5px); }

.card-img-top-wrapper { position: relative; overflow: hidden; }
.card-img-top { transition: transform 0.3s ease; }
.card:hover .card-img-top { transform: scale(1.05); }

.card-title {
    font-size: 1.1rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.badge { font-weight: 500; letter-spacing: 0.3px; }

.form-control, .form-select {
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn {
    border-radius: 8px; font-weight: 500;
    padding: 0.5rem 1rem; transition: all 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }

.alert { border-radius: 10px; }
footer { margin-top: auto; }

.hover-lift { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.hover-lift:hover { transform: translateY(-3px); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { border-radius: 4px; }

.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state i { opacity: 0.3; }

@media (max-width: 768px) {
    .stat-card h2 { font-size: 1.5rem; }
    .card-title { font-size: 1rem; }

    .settings-key-mobile-list {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .settings-key-mobile {
        border-radius: 12px;
    }

    .settings-key-mobile .card-body {
        padding: 0.95rem;
    }

    .settings-key-mobile code {
        word-break: break-all;
        white-space: normal;
    }

    .settings-key-mobile .badge {
        white-space: normal;
        line-height: 1.2;
    }

    .settings-key-mobile .mobile-summary-row {
        align-items: center !important;
    }

    .settings-key-mobile .mobile-summary-row .fw-semibold {
        line-height: 1.15;
    }

    .settings-key-mobile .mobile-summary-row .text-muted {
        line-height: 1.15;
    }
}


/* ── Dark mode ───────────────────────────────────────────── */
[data-bs-theme="dark"] body {
    background-color: #0d1117;
    color: #e6edf3;
}
[data-bs-theme="dark"] .stat-card {
    background-color: #161b22;
    border: 1px solid #30363d;
    box-shadow: none;
}
[data-bs-theme="dark"] .stat-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.4); }
[data-bs-theme="dark"] .subject-card .card {
    background-color: #161b22;
    border: 1px solid #30363d !important;
}
[data-bs-theme="dark"] .subject-card .card:hover {
    box-shadow: 0 12px 35px rgba(0,0,0,0.5) !important;
    border-color: #58a6ff !important;
}
[data-bs-theme="dark"] .card-img-top-placeholder {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
}
[data-bs-theme="dark"] .card:hover .card-img-top-placeholder {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}
[data-bs-theme="dark"] .card-footer {
    background: #161b22;
    border-top: 1px solid #30363d;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #0d1117;
    border: 1px solid #30363d;
    color: #e6edf3;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
    background-color: #0d1117;
    color: #e6edf3;
}
[data-bs-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #388bfd 0%, #8957e5 100%);
    border: none;
}
[data-bs-theme="dark"] .btn-primary:hover {
    background: linear-gradient(135deg, #58a6ff 0%, #a371f7 100%);
}
[data-bs-theme="dark"] .alert { border: 1px solid #30363d; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
[data-bs-theme="dark"] footer { background-color: #161b22 !important; border-top: 1px solid #30363d; }
[data-bs-theme="dark"] .modal-content { background-color: #161b22; border: 1px solid #30363d; }
[data-bs-theme="dark"] .modal-header, [data-bs-theme="dark"] .modal-footer { border-color: #30363d; }
[data-bs-theme="dark"] .table {
    --bs-table-bg: #161b22; --bs-table-striped-bg: #0d1117;
    --bs-table-border-color: #30363d; color: #e6edf3;
}
[data-bs-theme="dark"] .input-group-text { background-color: #21262d; border-color: #30363d; color: #e6edf3; }
[data-bs-theme="dark"] .dropdown-menu { background-color: #161b22; border-color: #30363d; }
[data-bs-theme="dark"] .dropdown-item { color: #e6edf3; }
[data-bs-theme="dark"] .dropdown-item:hover { background-color: #21262d; }
[data-bs-theme="dark"] .map-stats, [data-bs-theme="dark"] .map-legend {
    background: #161b22; border: 1px solid #30363d;
}
[data-bs-theme="dark"] .map-stats .stat-count { color: #58a6ff; }
[data-bs-theme="dark"] ::-webkit-scrollbar-track { background: #0d1117; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: #30363d; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #58a6ff; }
[data-bs-theme="dark"] .hover-lift:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important; }


/* ── Light mode ──────────────────────────────────────────── */
[data-bs-theme="light"] body {
    background-color: #f0f2f5;
    color: #333;
}
[data-bs-theme="light"] .stat-card {
    background-color: #fff;
    border: 1px solid #dee2e6;
}
[data-bs-theme="light"] .stat-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.12); }
[data-bs-theme="light"] .subject-card .card {
    background-color: #fff;
    border: 1px solid #dee2e6 !important;
}
[data-bs-theme="light"] .subject-card .card:hover {
    box-shadow: 0 12px 35px rgba(0,0,0,0.12) !important;
    border-color: #667eea !important;
}
[data-bs-theme="light"] .card-img-top-placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
[data-bs-theme="light"] .card:hover .card-img-top-placeholder {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
[data-bs-theme="light"] .card-footer {
    background: #fff;
    border-top: 1px solid #dee2e6;
}
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #333;
}
[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
[data-bs-theme="light"] .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}
[data-bs-theme="light"] .btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
[data-bs-theme="light"] .alert { border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
[data-bs-theme="light"] footer { background-color: #1a1a2e !important; }
[data-bs-theme="light"] .modal-content { background-color: #fff; border: 1px solid #dee2e6; }
[data-bs-theme="light"] .modal-header, [data-bs-theme="light"] .modal-footer { border-color: #dee2e6; }
[data-bs-theme="light"] .input-group-text { background-color: #f8f9fa; border-color: #dee2e6; color: #333; }
[data-bs-theme="light"] .map-stats, [data-bs-theme="light"] .map-legend {
    background: #fff; border: 1px solid #dee2e6;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
[data-bs-theme="light"] .map-stats .stat-count { color: #667eea; }
[data-bs-theme="light"] ::-webkit-scrollbar-track { background: #f1f1f1; }
[data-bs-theme="light"] ::-webkit-scrollbar-thumb { background: #aaa; }
[data-bs-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #667eea; }
[data-bs-theme="light"] .hover-lift:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important; }
