/* ═══════════════════════════════════════════════════════════════
   Тайный Санта — Modern Christmas Theme
   Palette: deep green, cream, gold, soft snow
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-deep: #0d1f17;
    --bg-card: #14261e;
    --bg-card-hover: #1a3026;
    --bg-elevated: #1e3a2f;
    --cream: #f5f0e6;
    --cream-soft: #e8e0d0;
    --gold: #d4a84b;
    --gold-light: #e8c56a;
    --gold-dark: #b8923a;
    --green: #2d6a4f;
    --green-bright: #40916c;
    --green-soft: #52b788;
    --red: #c1121f;
    --red-soft: #e63946;
    --text: #f5f0e6;
    --text-muted: #a8b5a0;
    --border: rgba(212, 168, 75, 0.25);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Source Sans 3', system-ui, sans-serif;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(45, 106, 79, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 168, 75, 0.12) 0%, transparent 40%);
}

/* ─── Snowflakes ─── */
.snowflakes {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: rgba(245, 240, 230, 0.35);
    font-size: 1rem;
    animation: fall linear infinite;
    opacity: 0.6;
}

.snowflake:nth-child(1) { left: 5%;  animation-duration: 12s; animation-delay: 0s;   font-size: 0.9rem; }
.snowflake:nth-child(2) { left: 15%; animation-duration: 15s; animation-delay: 2s;   font-size: 1.2rem; }
.snowflake:nth-child(3) { left: 25%; animation-duration: 10s; animation-delay: 4s;   font-size: 0.8rem; }
.snowflake:nth-child(4) { left: 40%; animation-duration: 18s; animation-delay: 1s;   font-size: 1.1rem; }
.snowflake:nth-child(5) { left: 55%; animation-duration: 13s; animation-delay: 3s;   font-size: 0.95rem; }
.snowflake:nth-child(6) { left: 65%; animation-duration: 16s; animation-delay: 5s;   font-size: 1.3rem; }
.snowflake:nth-child(7) { left: 75%; animation-duration: 11s; animation-delay: 0.5s; font-size: 0.85rem; }
.snowflake:nth-child(8) { left: 85%; animation-duration: 14s; animation-delay: 2.5s; font-size: 1rem; }
.snowflake:nth-child(9) { left: 92%; animation-duration: 17s; animation-delay: 1.5s; font-size: 1.15rem; }
.snowflake:nth-child(10){ left: 48%; animation-duration: 12s; animation-delay: 3.5s; font-size: 0.9rem; }

@keyframes fall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.5; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* ─── Layout ─── */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
    position: relative;
    z-index: 1;
}

.header {
    background: rgba(13, 31, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--cream);
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.35rem;
    transition: color var(--transition);
}

.logo:hover { color: var(--gold-light); }
.logo-icon { font-size: 1.5rem; }

.nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.nav-link {
    color: var(--cream-soft);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--gold);
    background: rgba(212, 168, 75, 0.1);
}

.nav-link-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.main {
    flex: 1;
    padding: 2rem 0 3rem;
}

.footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ─── Typography ─── */
h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: 700;
    line-height: 1.25;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.85rem;
    color: var(--cream);
}

.section-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gold-light);
}

.text-muted { color: var(--text-muted); }
.text-success { color: var(--green-soft); }
.text-warning { color: var(--gold); }
.text-center { text-align: center; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1a1205;
    box-shadow: 0 4px 14px rgba(212, 168, 75, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 168, 75, 0.4);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--cream);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--gold);
}

.btn-danger {
    background: rgba(193, 18, 31, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(193, 18, 31, 0.4);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(193, 18, 31, 0.35);
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
}

.btn-block {
    width: 100%;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-highlight {
    border-color: rgba(212, 168, 75, 0.45);
    background: linear-gradient(145deg, var(--bg-card) 0%, #1a2e24 100%);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--gold-light);
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--cream-soft);
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-control-lg {
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    text-align: center;
    font-weight: 600;
}

.code-input {
    text-transform: uppercase;
}

.form-error {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: var(--red-soft);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1.75rem;
}

.form-check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--gold);
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 160px;
}

.form-actions {
    margin-top: 1.25rem;
}

.inline-form {
    display: inline;
}

/* ─── Auth card ─── */
.auth-card {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--gold);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ─── Hero ─── */
.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
    padding: 2.5rem 0 3rem;
}

.hero-title {
    font-size: 2.5rem;
    color: var(--gold-light);
    margin-bottom: 0.75rem;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--cream-soft);
    margin-bottom: 1.5rem;
    max-width: 540px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 1.75rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.meta-icon { font-size: 1.15rem; }

.hero-decoration .ornament {
    font-size: 6rem;
    opacity: 0.85;
    filter: drop-shadow(0 0 20px rgba(212, 168, 75, 0.3));
}

/* ─── Steps ─── */
.how-it-works {
    padding: 1rem 0 2rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    transition: transform var(--transition), border-color var(--transition);
}

.step-card:hover {
    transform: translateY(-3px);
    border-color: var(--gold);
}

.step-num {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1a1205;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
    color: var(--cream);
}

.step-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ─── Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-family: var(--font-serif);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--gold-light);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ─── Admin nav ─── */
.admin-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--cream);
    font-weight: 600;
    transition: all var(--transition);
}

.admin-nav-card:hover {
    border-color: var(--gold);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.nav-icon { font-size: 1.75rem; }

/* ─── Tables ─── */
.table-wrap {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 0.75rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--gold);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table tr:hover td {
    background: rgba(212, 168, 75, 0.05);
}

.row-inactive {
    opacity: 0.55;
}

.actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.code-badge {
    background: var(--bg-deep);
    border: 1px solid var(--border);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    color: var(--gold-light);
    letter-spacing: 0.05em;
}

/* ─── Badges ─── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(82, 183, 136, 0.2);
    color: var(--green-soft);
}

.badge-danger {
    background: rgba(193, 18, 31, 0.2);
    color: #ff6b6b;
}

.badge-muted {
    background: rgba(168, 181, 160, 0.15);
    color: var(--text-muted);
}

/* ─── Flash messages ─── */
.flash-messages {
    margin-bottom: 1.25rem;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
    background: rgba(45, 106, 79, 0.4);
    border: 1px solid var(--green-bright);
    color: var(--green-soft);
}

.flash-danger {
    background: rgba(193, 18, 31, 0.25);
    border: 1px solid var(--red);
    color: #ff8a8a;
}

.flash-warning {
    background: rgba(212, 168, 75, 0.2);
    border: 1px solid var(--gold);
    color: var(--gold-light);
}

.flash-info {
    background: rgba(100, 140, 180, 0.25);
    border: 1px solid #5a8ab0;
    color: #a0c4e0;
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 0.25rem;
    line-height: 1;
}

.flash-close:hover { opacity: 1; }

/* ─── Cabinet ─── */
.cabinet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.receiver-name {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    color: var(--gold-light);
    margin-bottom: 1rem;
}

.wishlist-block {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    background: var(--bg-deep);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--green-bright);
}

.wishlist-block.anti {
    border-left-color: var(--red-soft);
}

.wishlist-block h3 {
    font-size: 0.85rem;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.wishlist-text {
    white-space: pre-wrap;
    font-size: 0.95rem;
    line-height: 1.55;
}

.waiting-state {
    text-align: center;
    padding: 1.5rem 0;
}

.waiting-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.meta-card .meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* ─── Draw ─── */
.draw-status {
    margin-bottom: 1.25rem;
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.status-success {
    background: rgba(82, 183, 136, 0.2);
    color: var(--green-soft);
}

.status-pending {
    background: rgba(212, 168, 75, 0.2);
    color: var(--gold-light);
}

.draw-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

/* ─── Alerts & empty ─── */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-danger {
    background: rgba(193, 18, 31, 0.2);
    border: 1px solid var(--red);
    color: #ff8a8a;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* ─── Errors ─── */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-code {
    font-family: var(--font-serif);
    font-size: 5rem;
    font-weight: 700;
    color: var(--gold);
    opacity: 0.7;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-page h1 {
    margin-bottom: 0.5rem;
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-title { font-size: 1.85rem; }
    .hero-desc { margin-left: auto; margin-right: auto; }
    .hero-meta { justify-content: center; }
    .hero-decoration { display: none; }

    .cabinet-grid {
        grid-template-columns: 1fr;
    }

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

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-inner {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav {
        width: 100%;
        justify-content: flex-end;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-group {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-nav {
        grid-template-columns: 1fr;
    }
}