.glass-bg {
    background-color: #f0f4f8;
    background-image: 
        radial-gradient(at 0% 0%, rgba(255, 166, 158, 0.3) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(134, 239, 172, 0.3) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(147, 197, 253, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(196, 181, 253, 0.3) 0px, transparent 50%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* HarmonyOS NEXT Light Source Aesthetics */
:root {
    --mouse-x: 50%;
    --mouse-y: 50%;
    --spotlight-color: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

.dark {
    --spotlight-color: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    color-scheme: dark; /* Helps browser default controls */
}

/* Global Dark Mode Text Overrides */
.dark .text-gray-900 { color: #f3f4f6 !important; }
.dark .text-gray-800 { color: #e5e7eb !important; }
.dark .text-gray-700 { color: #d1d5db !important; }
.dark .text-gray-600 { color: #cbd5e1 !important; }
.dark .text-gray-500 { color: #9ca3af !important; }
.dark .text-gray-400 { color: #6b7280 !important; }

/* Global Dark Mode Background Overrides for common white backgrounds */
.dark .bg-white { background-color: rgba(30, 41, 59, 0.5) !important; }
.dark .bg-gray-50 { background-color: rgba(30, 41, 59, 0.3) !important; }
.dark .bg-gray-100 { background-color: rgba(51, 65, 85, 0.5) !important; }

/* Global Dark Mode Border Overrides */
.dark .border-gray-200 { border-color: rgba(255, 255, 255, 0.1) !important; }
.dark .border-gray-100 { border-color: rgba(255, 255, 255, 0.05) !important; }
.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: rgba(255, 255, 255, 0.05) !important; }

/* Global Light Source Overlay */
.light-source {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y), 
        rgba(255, 255, 255, 0.06),
        transparent 40%
    );
    mix-blend-mode: overlay;
}

.dark .light-source {
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y), 
        rgba(255, 255, 255, 0.03),
        transparent 40%
    );
}

/* Harmony Card - The core component */
.harmony-card, .glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

/* Interactive Spotlight on Cards */
.harmony-card::before, .glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 24px;
    padding: 1px; /* Border width */
    background: radial-gradient(
        800px circle at var(--mouse-x) var(--mouse-y), 
        rgba(255, 255, 255, 0.6), 
        transparent 40%
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.7;
}

.harmony-card:hover, .glass-card:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Harmony Button */
.harmony-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.harmony-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle at var(--mouse-x) var(--mouse-y), 
        rgba(255, 255, 255, 0.4), 
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.3s;
}

.harmony-btn:hover::after {
    opacity: 1;
}

.metric-chip {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 14px;
    padding: 12px;
}
.dark .metric-chip {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

.visit-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.5);
}
.dark .visit-item {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.06);
}

.visit-dot {
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.1);
    margin-top: 6px;
    flex-shrink: 0;
}

.visit-meta {
    font-size: 12px;
    color: #6b7280;
}
.dark .visit-meta {
    color: #94a3b8;
}

.harmony-input {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.harmony-input:focus {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.1);
    outline: none;
}

.dark .harmony-input {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.dark .harmony-input:focus {
    background: rgba(30, 41, 59, 0.8);
}

.dark .glass-bg {
    background-color: #0f172a;
    background-image: 
        radial-gradient(at 0% 0%, rgba(255, 166, 158, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(134, 239, 172, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(147, 197, 253, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(196, 181, 253, 0.1) 0px, transparent 50%);
}
.theme-transition body,
.theme-transition nav,
.theme-transition .glass-bg,
.theme-transition .glass-card,
.theme-transition .modal-panel,
.theme-transition .lightbox-panel {
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

body { color: #0f172a; }
.dark body { color: #e5e7eb; }

nav {
    transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}
.dark nav {
    background-color: rgba(15, 23, 42, 0.55);
    border-color: rgba(226, 232, 240, 0.15);
}
.dark nav a,
.dark nav button {
    color: #e2e8f0 !important;
}
.dark nav a:hover,
.dark nav button:hover {
    color: #a5b4fc !important;
}

.announcement-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(239, 246, 255, 0.85));
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 1rem;
    padding: 12px 14px;
    box-shadow: 0 16px 32px rgba(99,102,241,0.08);
}
.dark .announcement-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.9));
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

.admin-row {
    transition: background 0.2s ease;
}
.dark .admin-row:hover {
    background: rgba(51, 65, 85, 0.7);
}
.admin-row:hover {
    background: rgba(249, 250, 251, 0.9);
}

.announcement-overlay {
    position: fixed;
    inset: 0;
    z-index: 140;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.25s ease;
    display: grid;
    place-items: center;
}
.announcement-overlay.show { opacity: 1; }

.announcement-modal {
    width: min(92vw, 600px);
    padding: 10px;
}

.ann-glass {
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.9), rgba(239, 246, 255, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(99, 102, 241, 0.18);
    position: relative;
    overflow: hidden;
}
.dark .ann-glass {
    background: radial-gradient(circle at 20% 20%, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.92));
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.45);
}

.ann-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.ann-eyebrow { font-size: 12px; letter-spacing: 0.08em; color: #6366f1; text-transform: uppercase; }
.dark .ann-eyebrow { color: #a5b4fc; }
.ann-title { font-size: 22px; font-weight: 700; color: #0f172a; }
.dark .ann-title { color: #e2e8f0; }
.ann-content { color: #475569; line-height: 1.6; white-space: pre-wrap; }
.dark .ann-content { color: #cbd5f5; }
.ann-image { border-radius: 14px; box-shadow: 0 16px 36px rgba(0,0,0,0.12); max-height: 240px; object-fit: cover; }
.ann-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ann-date { font-size: 12px; color: #94a3b8; }
.ann-ok {
    padding: 10px 16px;
    border-radius: 12px;
    background: linear-gradient(120deg, #a78bfa, #60a5fa);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(96, 165, 250, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ann-ok:hover { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(96, 165, 250, 0.45); }
.ann-ok:active { transform: translateY(0); }
.ann-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.8);
    color: #0f172a;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.dark .ann-close { background: rgba(51,65,85,0.9); color: #e2e8f0; border-color: rgba(148,163,184,0.4); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    z-index: 200;
}

.modal-card {
    width: min(92vw, 420px);
    background: linear-gradient(145deg, rgba(255,255,255,0.94), rgba(241,245,255,0.9));
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    padding: 18px;
}
.dark .modal-card {
    background: linear-gradient(145deg, rgba(30,41,59,0.95), rgba(15,23,42,0.94));
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}
.dark .modal-header h3 { color: #e2e8f0; }
.modal-body {
    margin: 12px 0;
    color: #475569;
    line-height: 1.6;
}
.dark .modal-body { color: #cbd5f5; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.toast {
    position: fixed;
    top: 18px;
    right: 18px;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    background: #0ea5e9;
    color: white;
    opacity: 0;
    transform: translateY(-6px);
    transition: all 0.22s ease;
    z-index: 220;
}
.toast-error { background: #f97316; }
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.maintenance-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    z-index: 180;
}

.maintenance-card {
    width: min(92vw, 520px);
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(239,246,255,0.92));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 25px 70px rgba(15, 23, 42, 0.3);
    text-align: center;
}
.dark .maintenance-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.94));
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}
.maintenance-card h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 10px;
    color: #0f172a;
}
.dark .maintenance-card h3 { color: #e2e8f0; }
.maintenance-card p {
    color: #475569;
    margin-bottom: 16px;
    line-height: 1.6;
}
.dark .maintenance-card p { color: #cbd5f5; }
.maintenance-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(255,255,255,0.65), rgba(239, 246, 255, 0.8));
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.12);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s ease;
}
.theme-toggle:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 14px 36px rgba(99, 102, 241, 0.18);
}
.theme-toggle:active {
    transform: translateY(0) scale(0.99);
}
.dark .theme-toggle {
    background: linear-gradient(120deg, rgba(30, 41, 59, 0.85), rgba(51, 65, 85, 0.9));
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
}
/* .glass-card replaced by harmony-card styles above */
.glass-input {
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    transition: all 0.3s;
}
.glass-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.5);
}
.glass-button {
    background-color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.75rem;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s;
    font-weight: 500;
}
.glass-button:hover {
    background-color: rgba(255, 255, 255, 0.8);
}
.glass-button:active {
    transform: scale(0.95);
}

/* Announcement Navigation */
.ann-nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.ann-nav-btn:hover {
    background: white;
    color: #6366f1;
    transform: scale(1.1);
}
.ann-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}
.dark .ann-nav-btn {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}
.dark .ann-nav-btn:hover {
    background: rgba(51, 65, 85, 0.9);
    color: #a5b4fc;
}
.ann-counter {
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.5);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.dark .ann-counter {
    background: rgba(15, 23, 42, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
    color: #64748b;
}

/* Lightbox viewer */
#lightbox {
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
#lightbox.show {
    opacity: 1;
    pointer-events: auto;
}
#lightbox.hidden {
    display: none !important; /* ensure hidden truly hides overlay */
}
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    /* animation: fadeIn 0.2s ease; Removed to allow JS control */
    opacity: 1;
    transition: opacity 0.3s ease;
}
.lightbox-panel {
    position: relative;
    max-width: min(90vw, 1100px);
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1.25rem;
    padding: 1rem 1rem 1.5rem;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
    animation: scaleIn 0.22s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.dark .lightbox-panel {
    background: rgba(15, 23, 42, 0.92);
    color: #e5e7eb;
}
.lightbox-img {
    max-height: 70vh;
    object-fit: contain;
    border-radius: 1rem;
    width: 100%;
}
.lightbox-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.lightbox-title {
    font-weight: 700;
    font-size: 1.125rem;
}
.lightbox-desc {
    color: #64748b;
}
.dark .lightbox-desc {
    color: #cbd5f5;
}
.lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    font-size: 14px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
}
.lightbox-close:hover {
    background: rgba(255,255,255,0.9);
    transform: scale(1.05);
}
.dark .lightbox-close {
    background: rgba(51,65,85,0.9);
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.4);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.18);
}
.tag-btn {
    padding: 8px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tag-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}
.animate-fade-in {
    animation: fadeIn 0.2s ease, scaleIn 0.22s ease;
}

/* Modal for inline edits */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

.modal-panel {
    background: rgba(255,255,255,0.92);
    border-radius: 1rem;
    padding: 1.25rem;
    width: min(90vw, 520px);
    box-shadow: 0 24px 80px rgba(0,0,0,0.18);
}

.dark .modal-panel {
    background: rgba(15,23,42,0.95);
    color: #e2e8f0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Gallery lazy image states */
.img-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(255,255,255,0.6) 8%, rgba(245,245,245,0.9) 18%, rgba(255,255,255,0.6) 33%);
    background-size: 200% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
    filter: blur(10px);
}

.img-blur-loading {
    filter: blur(12px) saturate(90%);
    transform: scale(1.02);
    opacity: 0.8;
}

.img-loaded {
    filter: none;
    transform: none;
    opacity: 1;
    transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
