/* ============================================
   Timexora — Reusable Components
   Buttons, form fields, cards, badges, alerts. Shared across every page.
   ============================================ */

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: 13px 22px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
    text-align: center;
    text-decoration: none;
}

.btn:hover { background: var(--color-primary-hover); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-auto { width: auto; }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-ink);
}

.btn-secondary:hover { background: var(--color-surface-alt); }

.btn-danger {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

.btn-danger:hover { background: var(--color-danger-light); }

/* ---------- Form fields ---------- */

.field {
    margin-bottom: var(--space-5);
}

.field-row {
    display: flex;
    gap: var(--space-4);
}

.field-row .field { flex: 1; }

.field-section-title {
    margin: var(--space-7) 0 var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-ink-faint);
}

/* Collapsible "Advanced options" — keeps the form's first impression short;
   everything inside still submits normally whether open or collapsed. */
.advanced-options {
    margin-top: var(--space-6);
    margin-bottom: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.advanced-options summary {
    cursor: pointer;
    padding-bottom: var(--space-1);
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-ink);
    list-style: none;
}

.advanced-options summary::-webkit-details-marker { display: none; }

.advanced-options summary span {
    font-weight: 400;
    color: var(--color-ink-faint);
    font-size: 0.8rem;
}

.advanced-options summary::before {
    content: "▸";
    display: inline-block;
    margin-right: var(--space-2);
    color: var(--color-primary);
    transition: transform 0.15s ease;
}

.advanced-options[open] summary::before {
    transform: rotate(90deg);
}

.advanced-options .field:first-of-type { margin-top: var(--space-5); }

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--color-ink);
}

.hint {
    font-size: 0.8rem;
    color: var(--color-ink-faint);
    margin-top: var(--space-1);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    padding-right: 40px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

label .field-icon {
    margin-right: var(--space-1);
}

/* Card-style radio group, e.g. theme picker */
.choice-group {
    display: flex;
    gap: var(--space-2);
}

.choice-option { flex: 1; cursor: pointer; }
.choice-option input { position: absolute; opacity: 0; pointer-events: none; }

.choice-card {
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-2);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-ink-muted);
    transition: all 0.15s ease;
}

.choice-option input:checked + .choice-card {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.choice-option input:focus-visible + .choice-card {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Scroll-reveal utility — pairs with assets/js/reveal.js. Elements start
   faded/offset and settle into place the first time they enter the
   viewport. Falls back to fully visible if JS or motion is unavailable. */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Long-form content (privacy, terms, guide) ---------- */

.prose { padding: var(--space-7) 0 var(--space-8); }

.prose .updated-note {
    color: var(--color-ink-faint);
    font-size: 0.85rem;
    margin-bottom: var(--space-6);
}

.prose h2 {
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.prose h2:first-of-type { margin-top: var(--space-5); padding-top: 0; border-top: none; }

.prose h3 { margin-top: var(--space-5); }

.prose ul, .prose ol {
    margin: 0 0 var(--space-4);
    padding-left: 1.25rem;
    color: var(--color-ink-muted);
}

.prose li { margin-bottom: var(--space-2); }

.prose strong { color: var(--color-ink); }

.guide-step {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.guide-step .step-num {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 800;
    font-size: 0.9rem;
}

.my-countdowns-list {
    margin-top: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.my-countdowns-empty {
    color: var(--color-ink-faint);
}

.my-countdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
}

.my-countdown-title {
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.my-countdown-title:hover { text-decoration: underline; }

.my-countdown-meta {
    font-size: 0.8rem;
    color: var(--color-ink-faint);
    margin-top: 2px;
}

.my-countdown-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.my-countdown-actions a,
.my-countdown-actions button {
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-main);
    text-decoration: none;
    opacity: 0.75;
}

.my-countdown-actions a:hover,
.my-countdown-actions button:hover { opacity: 1; }

.choice-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
    cursor: pointer;
}

.choice-inline input { width: auto; margin: 0; }

/* Toggle-switch styled checkbox — used for "Count up", "List publicly",
   "Remove password", anywhere a plain checkbox felt too utilitarian. */
.choice-inline input[type="checkbox"] {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-border);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.15s ease;
}

.choice-inline input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.choice-inline input[type="checkbox"]:checked {
    background: var(--color-primary);
}

.choice-inline input[type="checkbox"]:checked::before {
    transform: translateX(18px);
}

.choice-inline input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Small color swatch inside the theme-picker cards */
.theme-swatch {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto var(--space-2);
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-swatch-classic { background: linear-gradient(135deg, #1a1f3d, #818cf8); }
.theme-swatch-minimal { background: #fafafa; border-color: #d4d4d8; }
.theme-swatch-bold { background: linear-gradient(135deg, #ff6a3d, #9333ea); }
.theme-swatch-elegant { background: linear-gradient(135deg, #fdf6f0, #e7ab6b); border-color: #e7d5c4; }
.theme-swatch-neon { background: radial-gradient(circle, #05050a 40%, #22d3ee 200%); box-shadow: inset 0 0 0 1px rgba(34,211,238,0.5); }
.theme-swatch-custom { background: conic-gradient(from 180deg, #f87171, #fbbf24, #34d399, #60a5fa, #c084fc, #f87171); }

/* ---------- Custom theme panel ---------- */

.custom-theme-panel {
    margin-top: calc(-1 * var(--space-2));
    padding: var(--space-4);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

input[type="color"] {
    width: 100%;
    height: 46px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
}

.current-bg-preview {
    margin-top: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.current-bg-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

/* Honeypot — invisible to real visitors, bots tend to fill it in anyway */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
}

/* ---------- Cards ---------- */

.card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-7) var(--space-6);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* A thin brand-gradient accent along the top edge — a small detail that
   keeps every card (form, edit, contact, danger zone...) feeling designed
   rather than a bare white box. */
.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #a855f7);
}

@media (max-width: 560px) {
    .card { padding: var(--space-6) var(--space-4); }
}

.card-danger {
    border-color: var(--color-danger);
}

.card-danger::before {
    background: var(--color-danger);
}

/* ---------- Alerts ---------- */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: var(--space-5);
}

.alert-error {
    background: var(--color-danger-light);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: var(--color-danger);
}

.alert-success {
    background: var(--color-success-light);
    border: 1px solid rgba(22, 163, 74, 0.25);
    color: var(--color-success);
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid rgba(217, 119, 6, 0.3);
    color: #b45309;
    text-align: left;
}

/* ---------- State icon (404, deleted, password gate, success screens) ---------- */

.state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    border-radius: 50%;
    background: var(--color-primary-light);
    font-size: 1.8rem;
}

.state-icon-danger { background: var(--color-danger-light); }
.state-icon-success { background: var(--color-success-light); }

/* ---------- Badge / tag ---------- */

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* ---------- Site header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    padding: var(--space-3) var(--space-5);
}

/* Wordmark — the site name IS the logo, styled instead of paired with a
   separate icon glyph. */
.brand {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #4f46e5, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-header .brand {
    text-decoration: none;
    flex-shrink: 0;
}

.site-nav {
    display: flex;
    gap: var(--space-5);
    flex: 1;
    justify-content: center;
}

.site-nav a {
    color: var(--color-ink-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.site-nav a:hover { color: var(--color-ink); }

/* The mobile CTA is a real .btn inside the nav — keep its own button
   colors instead of inheriting the plain nav-link text color above. */
.site-nav a.nav-cta-mobile,
.site-nav a.nav-cta-mobile:hover { color: #fff; }

.btn-header-cta {
    flex-shrink: 0;
    padding: 10px 18px;
    font-size: 0.9rem;
}

.nav-cta-mobile { display: none; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-ink);
    border-radius: 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
    .btn-header-cta { display: none; }
    .nav-toggle { display: flex; }

    .site-nav {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: var(--space-4) var(--space-5) var(--space-5);
        box-shadow: var(--shadow-md);
    }

    .site-nav.is-open { display: flex; }

    .nav-cta-mobile { display: inline-flex; width: auto; margin-top: var(--space-1); }
}

/* ---------- Site footer ---------- */

.site-footer {
    background: var(--color-ink);
    color: #cbd5e1;
    padding-top: var(--space-8);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: var(--space-6);
    padding-bottom: var(--space-7);
}

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

.footer-brand .brand {
    text-decoration: none;
    font-size: 1.3rem;
}

.footer-brand p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-top: var(--space-3);
    max-width: 320px;
}

.footer-col h4 {
    color: #fff;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-3);
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.footer-col a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-col a:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-4) 0;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
}

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