/* static/styles.css */

/* ===========================
   Visual tokens & variables
   =========================== */
:root {
    --clock-font-size: clamp(3rem, 8vw, 6rem);
    --clock-date-size: clamp(1.2rem, 3vw, 2rem);
    --clock-padding: 0.6rem 1.2rem;
    --clock-bg: rgba(0, 0, 0, 0.45);
    --clock-border-radius: 0.8rem;
    --clock-text-color: #f5f5f5;

    --accent: #4da3ff;
    --danger: #e74c3c;
    --bg-dark: #111827;
    --bg-card: #1f2933;
    --border-subtle: #2d3a4b;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
}

/* Reset-ish */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Segoe UI", sans-serif;
    background: #000;
    color: var(--text-main);
}

/* ---------- Display / wall mode ---------- */

#app-root {
    position: fixed;
    inset: 0;
    overflow: hidden;
}

/* Background container */
#background-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* Photo background (behind video) */
#photo-background {
    position: absolute;
    inset: 0;
    background-color: #000;
    background-size: cover;
    background-position: center center;
    z-index: 0;
}

/* Video background (YouTube or other) */
#video-background,
#video-background iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    object-fit: cover;
    z-index: 1;
}

/* Dim overlay manipulated at night */
#dim-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
    transition: background 0.8s ease;
    z-index: 2;
}

/* Manual quick-dim overlay (above auto dim, below widgets) */
#manual-dim-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 3;
}

/* Foreground overlay */
#overlay-content {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
}

/* ---------- Clock ---------- */

#clock-container {
    position: absolute;
    top: 10%;
    left: 10%;
    transform: translate(-50%, -50%);
    padding: var(--clock-padding);
    background: var(--clock-bg);
    border-radius: var(--clock-border-radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
    color: var(--clock-text-color);
    text-align: center;
    min-width: 7rem;
    transition: top 20s linear, left 20s linear, transform 20s linear, opacity 0.8s ease;
    transform-origin: top left;
}

#clock-time {
    font-size: var(--clock-font-size);
    letter-spacing: 0.08em;
    font-weight: 600;
}

#clock-date {
    margin-top: 0.35rem;
    font-size: var(--clock-date-size);
    color: rgba(249, 250, 251, 0.88);
}

/* ---------- Unified top-right control buttons ---------- */
/* Settings, dim, mute, fullscreen all share exact same size + style */

#settings-btn,
#dim-toggle-btn,
#mute-btn,
#fullscreen-btn {
    position: absolute;
    top: 1.2rem;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(15, 23, 42, 0.65);
    color: #f9fafb;
    cursor: pointer;
    font-size: 1.1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    z-index: 12;
}

/* Individual positions (desktop) */
#fullscreen-btn {
    right: 1.2rem;
}

#mute-btn {
    right: 5.0rem;
}

#dim-toggle-btn {
    right: 8.8rem;
}

#settings-btn {
    right: 12.6rem;
}

/* Hover / active states for all four */
#settings-btn:hover,
#dim-toggle-btn:hover,
#mute-btn:hover,
#fullscreen-btn:hover {
    background: rgba(37, 99, 235, 0.9);
    box-shadow: 0 0 0 1px rgba(191, 219, 254, 0.4);
    transform: translateY(-1px);
}

#settings-btn:active,
#dim-toggle-btn:active,
#mute-btn:active,
#fullscreen-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Mute "on" state */
#mute-btn.muted {
    background: rgba(235, 59, 90, 0.85);
    border-color: rgba(239, 68, 68, 0.9);
}

/* ---------- Quick settings panel ---------- */

.quick-settings-panel {
    position: absolute;
    right: 1.2rem;
    top: 3.4rem;
    width: min(320px, 92vw);
    background: rgba(15, 23, 42, 0.96);
    border-radius: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    padding: 0.8rem 0.9rem;
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    font-size: 0.85rem;
    z-index: 15;
    display: none;
}

.quick-settings-panel.open {
    display: block;
}

.quick-settings-panel .qs-row {
    margin-bottom: 0.55rem;
}

.quick-settings-panel label {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.quick-settings-panel input[type="text"],
.quick-settings-panel select {
    margin-top: 0.25rem;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    width: 100%;
    background: #020617;
    border-radius: 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: var(--text-main);
    outline: none;
}

.quick-settings-panel input[type="text"]:focus,
.quick-settings-panel select:focus {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.6);
}

.quick-settings-panel .qs-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.3rem;
}

.quick-settings-panel .qs-actions button {
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.65);
    transition: transform 0.08s ease, box-shadow 0.1s ease;
}

.quick-settings-panel .qs-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.8);
}

.quick-settings-panel .qs-actions button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.9);
}

/* ---------- Admin UI ---------- */

.admin-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1f2937, #020617);
    padding: 2rem 1rem;
}

.admin-card {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 1rem;
    padding: 1.8rem 2rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow:
        0 22px 45px rgba(15, 23, 42, 0.9),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.admin-card.admin-wide {
    max-width: 960px;
}

.admin-card h1 {
    margin-bottom: 1.4rem;
    font-size: 1.6rem;
    letter-spacing: 0.03em;
}

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

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.9);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-link:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(59, 130, 246, 0.9);
    transform: translateY(-1px);
}

.btn-link.danger:hover {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(239, 68, 68, 0.9);
}

/* Forms */

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

label.inline {
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    background: #020617;
    border-radius: 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: var(--text-main);
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.6);
}

button.primary,
.admin-card button[type="submit"] {
    margin-top: 0.5rem;
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.6);
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

button.primary:hover,
.admin-card button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.8);
    filter: brightness(1.05);
}

button.primary:active,
.admin-card button[type="submit"]:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.9);
}

/* Flash messages */

.flash-messages {
    margin-bottom: 1rem;
}

.flash {
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.flash-success {
    background: rgba(22, 163, 74, 0.15);
    border: 1px solid rgba(22, 163, 74, 0.7);
}

.flash-error {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.8);
}

/* Fieldsets */

fieldset {
    border-radius: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 0.9rem 1rem 1rem;
}

legend {
    padding: 0 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Layout helpers */

.settings-form {
    gap: 1rem;
}

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

.stats-grid .stat-item {
    padding: 0.7rem 0.8rem;
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ---------- Weather card (responsive sizing) ---------- */

#weather-container {
    position: absolute;
    top: 5%;
    right: 5%;
    transform-origin: top right;

    /* Tighter, responsive padding */
    padding: clamp(0.4rem, 1vw, 0.7rem) clamp(0.6rem, 1.4vw, 0.9rem);

    background: rgba(0, 0, 0, 0.55);
    border-radius: clamp(0.6rem, 1.6vw, 0.9rem);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    z-index: 6;

    /* Let content define width, but cap on big screens */
    min-width: 0;
    max-width: min(80vw, 320px);

    transition: top 20s linear, left 20s linear, transform 20s linear, opacity 0.6s ease;
    display: none; /* JS sets to inline-block when enabled */
}

#weather-inner {
    display: flex;
    align-items: center;
    gap: clamp(0.4rem, 1.2vw, 0.8rem);
}

#weather-container img#weather-icon {
    width: clamp(40px, 8vw, 72px);
    height: clamp(40px, 8vw, 72px);
    display: block;
    flex-shrink: 0;
}

#weather-main {
    display: flex;
    flex-direction: column;
    gap: clamp(0.15rem, 0.4vw, 0.25rem);
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    text-align: left;
}

#weather-temp {
    font-size: clamp(1.3rem, 3.2vw, 2rem);
    font-weight: 800;
}

#weather-desc {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: rgba(255, 255, 255, 0.9);
    text-transform: capitalize;
}

#weather-city {
    font-size: clamp(0.75rem, 1.6vw, 0.95rem);
    color: rgba(255, 255, 255, 0.78);
}

/* ---------- Brand logo + like cluster bottom-right ---------- */

#brand-corner-cluster {
    position: absolute;
    right: 1.4rem;
    bottom: 1.2rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

#brand-logo-link {
    position: static;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

#brand-logo-link img {
    max-width: 30px;
    height: auto;
    opacity: 0.9;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.85));
    transition: opacity 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

#brand-logo-link:hover img {
    opacity: 1;
    transform: translateY(-1px) scale(1.02);
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.95));
}

/* Like button wrapper */
#like-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

/* Thumbs up left of logo, no circle */
#like-btn {
    position: absolute;
    bottom: 1.2rem;         /* same vertical as logo */
    right: 4.6rem;          /* moves it LEFT of the logo */
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    opacity: 0.9;
    transition: transform 0.15s ease, opacity 0.2s ease;
    z-index: 12;
}

#like-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

/* Subtle like count under the icon */
#like-count {
    position: absolute;
    bottom: 0.2rem;         /* tiny subtle label under the icon */
    right: 4.9rem;          /* adjust slightly under the icon */
    font-size: 0.75rem;
    color: #ccc;
    opacity: 0.7;
    z-index: 12;
}

#like-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.75));
    transition: transform 0.15s ease, filter 0.15s ease;
}

#like-btn:hover #like-icon {
    transform: translateY(-1px) scale(1.08);
    filter: drop-shadow(0 10px 26px rgba(0, 0, 0, 0.9));
}

#like-btn:active #like-icon {
    transform: translateY(1px) scale(0.94);
}

/* "Liked" state + pop animation */
#like-btn.liked #like-icon {
    transform: scale(1.05);
    text-shadow:
        0 0 18px rgba(250, 204, 21, 0.9),
        0 0 30px rgba(251, 191, 36, 0.6);
}

#like-btn.animate #like-icon {
    animation: like-pop 0.35s ease-out;
}

@keyframes like-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.3); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1.05); }
}

/* Floating bouncing logo "ball" */
#brand-logo-bouncer {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 6;
    pointer-events: none;
}

#brand-logo-bouncer img {
    max-width: 100%;
    height: auto;
    border-radius: 999px;
    filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.9));
}

/* ---------- Support / donation modal ---------- */

body.support-modal-open {
    overflow: hidden;
}

.support-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 1.4rem 4.0rem;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.support-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.support-modal {
    background: rgba(15, 23, 42, 0.98);
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.7);
    padding: 0.9rem 1.1rem 1rem;
    width: min(320px, 92vw);
    box-shadow:
        0 22px 45px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    transform: translateY(12px) scale(0.98);
    transform-origin: bottom right;
    transition: transform 0.18s ease;
}

.support-backdrop.open .support-modal {
    transform: translateY(0) scale(1);
}

.support-modal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.support-modal-emoji {
    font-size: 1.4rem;
}

.support-modal-header h2 {
    font-size: 1rem;
}

.support-modal-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    margin-bottom: 0.6rem;
}

.support-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.support-btn {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.7);
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.9);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.support-btn.primary {
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.65);
}

.support-btn:hover {
    transform: translateY(-1px);
}

.support-btn.primary:hover {
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.85);
}

.support-secondary {
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Misc tables (admin) ---------- */

.table-wrapper {
    margin-top: 0.8rem;
    overflow-x: auto;
}

.visits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.visits-table th,
.visits-table td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid rgba(55, 65, 81, 0.8);
}

.visits-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
}

.ua-cell {
    max-width: 340px;
    word-break: break-all;
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
    .admin-card {
        padding: 1.4rem 1.2rem;
    }

    /* Only positions change; button size/style is unified above */
    #fullscreen-btn {
        right: 0.8rem;
        top: 0.8rem;
    }

    #mute-btn {
        right: 4.4rem;
        top: 0.8rem;
    }

    #dim-toggle-btn {
        right: 8.0rem;
        top: 0.8rem;
    }

    #settings-btn {
        right: 11.6rem;
        top: 0.8rem;
    }

    .quick-settings-panel {
        right: 0.6rem;
        width: 94vw;
    }

    #brand-corner-cluster {
        right: 0.9rem;
        bottom: 0.8rem;
    }

    #brand-logo-link img {
        max-width: 30px;
    }

    .support-backdrop {
        padding: 0.8rem 0.8rem 3rem;
        align-items: flex-end;
        justify-content: center;
    }

    .support-modal {
        transform-origin: bottom center;
    }
}
/* Make liked state + counter more obvious */
#like-btn.liked #like-icon {
    transform: scale(1.05);
    color: #facc15; /* warm yellow when liked */
    text-shadow:
        0 0 18px rgba(250, 204, 21, 0.9),
        0 0 30px rgba(251, 191, 36, 0.6);
}

#like-count {
    position: absolute;
    bottom: 0.1rem;
    right: 4.9rem;
    font-size: 0.9rem;
    color: #facc15;
    opacity: 0.9;
    z-index: 12;
}
