:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbe3ee;
    --line-soft: #edf2f7;
    --blue: #0066ff;
    --blue-dark: #004ed1;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 18px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: #ffffff;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: #ffffff !important;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    color: var(--blue-dark);
}

.page-shell {
    width: min(1480px, calc(100% - 64px));
    margin: 0 auto;
    padding: 40px 0 34px;
    background: #ffffff;
}

.site-header,
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding-bottom: 34px;
    border-bottom: 1px solid var(--line);
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 32px;
    min-width: 0;
}

.brand-logo {
    width: 172px;
    height: auto;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand-area h1 {
    margin: 0;
    color: #030712;
    font-size: clamp(1.8rem, 3vw, 2.55rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    text-decoration: none;
}

.clock-panel {
    display: flex;
    align-items: center;
    gap: 28px;
    flex: 0 0 auto;
}

.clock-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 225px;
}

.flag {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.clock-label,
.clock-time,
.clock-date {
    margin: 0;
}

.clock-label {
    color: #111827;
    font-size: 0.95rem;
    font-weight: 800;
}

.clock-time {
    margin-top: 2px;
    color: #020617;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.clock-date {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.95rem;
}

.clock-divider,
.footer-divider {
    width: 1px;
    height: 54px;
    background: var(--line);
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 28px;
    padding: 52px 8px 220px;
    border-bottom: 1px solid var(--line);
}

.favorite-card {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 138px;
    padding: 18px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.favorite-card:hover {
    color: var(--text);
    border-color: #b8cdf2;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.thumb-wrap {
    display: grid;
    width: 96px;
    height: 96px;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.thumb-wrap img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.favorite-copy {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.favorite-copy strong {
    color: #030712;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.1;
}

.favorite-copy span {
    max-width: 210px;
    overflow: hidden;
    color: var(--blue);
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    min-height: 92px;
    color: #475569;
    font-size: 1.05rem;
}

.site-footer .footer-divider {
    height: 30px;
}

.admin-nav {
    display: flex;
    gap: 14px;
}

.admin-nav a,
.text-link {
    color: var(--blue);
    font-weight: 700;
}

.admin-page {
    padding-top: 32px;
}

.admin-card {
    margin-top: 28px;
    padding: 24px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.2rem;
}

.section-title p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.add-form {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1.2fr auto;
    gap: 16px;
    align-items: end;
}

label {
    display: grid;
    gap: 8px;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    outline: none;
}

input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.10);
}

.primary-button,
.danger-button,
.icon-button {
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.primary-button {
    min-height: 44px;
    padding: 0 20px;
    color: #ffffff;
    background: var(--blue);
    box-shadow: 0 8px 18px rgba(0, 102, 255, 0.20);
}

.primary-button:hover {
    background: var(--blue-dark);
}

.danger-button {
    min-height: 38px;
    padding: 0 14px;
    color: var(--danger);
    background: #fff5f5;
    border: 1px solid #fecaca;
}

.icon-button {
    width: 32px;
    height: 32px;
    color: var(--blue);
    background: #ffffff;
    border: 1px solid #bfd4ff;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.admin-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: #ffffff;
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: #475569;
    background: #fbfdff;
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.order-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-tools span {
    width: 24px;
    color: #334155;
    font-weight: 800;
}

.table-thumb {
    width: 42px;
    height: 42px;
    object-fit: contain;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.success-message,
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 700;
}

.success-message {
    margin-top: 22px;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.alert {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.hidden-form {
    display: none;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: #ffffff;
}

.auth-card {
    display: grid;
    gap: 16px;
    width: min(430px, 100%);
    padding: 34px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.auth-logo {
    width: 160px;
}

.auth-card h1,
.auth-card p {
    margin: 0;
}

.auth-card p {
    color: var(--muted);
}

@media (max-width: 1180px) {
    .site-header,
    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .clock-panel {
        width: 100%;
        justify-content: space-between;
    }

    .favorites-grid {
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }

    .add-form {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100% - 28px, 1480px);
        padding-top: 24px;
    }

    .brand-area {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .brand-logo {
        width: 150px;
    }

    .clock-panel {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

    .clock-divider {
        display: none;
    }

    .clock-card {
        min-width: 0;
    }

    .favorites-grid {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 30px 0 120px;
    }

    .favorite-card {
        min-height: 116px;
    }

    .thumb-wrap {
        width: 78px;
        height: 78px;
    }

    .thumb-wrap img {
        width: 56px;
        height: 56px;
    }

    .site-footer {
        flex-wrap: wrap;
        gap: 16px;
        text-align: center;
    }

    .add-form {
        grid-template-columns: 1fr;
    }

    .section-title {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Drag-and-drop link ordering in admin */
.draggable-row {
    cursor: grab;
    transition: background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.draggable-row:hover {
    background: #fbfdff;
}

.draggable-row.is-dragging {
    opacity: 0.55;
    background: #eef6ff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.drag-order {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drag-handle {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: #475569;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    cursor: grab;
}

.drag-handle:hover {
    color: var(--blue);
    border-color: #bfd4ff;
    background: #f8fbff;
}

.drag-handle:active {
    cursor: grabbing;
}

.order-number {
    min-width: 24px;
    color: #334155;
    font-weight: 800;
}
