/* ─── Variables ─────────────────────────────────────────────── */
:root {
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-light: #ede9fe;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --bg: #f5f3ff;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,.07), 0 10px 30px rgba(0,0,0,.12);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ────────────────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn:not(:disabled):active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); color: var(--secondary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-copy { background: var(--primary-light); color: var(--primary); padding: 8px 14px; }
.btn-copy:hover:not(:disabled) { background: #ddd6fe; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-group input {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 160px; }
.flex-2 { flex: 2; min-width: 200px; }

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.card h2 { font-size: 1.15rem; font-weight: 700; }
.card p { color: var(--text-muted); font-size: 0.92rem; }

/* ─── Home page ─────────────────────────────────────────────── */
.home-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px;
}
.hero {
    text-align: center;
    margin-bottom: 40px;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; line-height: 1.2; }
.hero p { color: var(--text-muted); max-width: 520px; margin: 0 auto; font-size: 1rem; }

.cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) {
    .cards-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.5rem; }
}

/* Links result section */
.create-result { display: flex; flex-direction: column; gap: 14px; }
.link-group { display: flex; flex-direction: column; gap: 6px; }
.link-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.link-row { display: flex; gap: 8px; }
.link-row input {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    background: #f8fafc;
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
}
.success-banner {
    background: var(--success-bg);
    color: var(--success);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
}

/* ─── Registry page ─────────────────────────────────────────── */
main { max-width: 900px; margin: 0 auto; padding: 32px 24px; display: flex; flex-direction: column; gap: 24px; }

.registry-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.registry-header h1 { font-size: 1.6rem; font-weight: 800; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; max-width: 500px; }

.gifts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.gifts-header h2 { font-size: 1.1rem; font-weight: 700; }
.gifts-stats { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

/* ─── Gift cards ────────────────────────────────────────────── */
.gift-list { display: flex; flex-direction: column; gap: 12px; }

.gift-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: box-shadow 0.15s, opacity 0.2s;
}
.gift-card:hover { box-shadow: var(--shadow-lg); }
.gift-card--claimed {
    border-left-color: #cbd5e1;
    opacity: 0.8;
}

.gift-card-body {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.gift-info { flex: 1; min-width: 0; }
.gift-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.gift-name { font-weight: 700; font-size: 1rem; }
.gift-description { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 4px; }
.gift-link { font-size: 0.85rem; color: var(--primary); font-weight: 500; }
.gift-link:hover { text-decoration: underline; }

.gift-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.claimed-msg { font-size: 0.85rem; color: var(--text-muted); }

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-available { background: #ecfdf5; color: #065f46; }
.badge-claimed { background: #f1f5f9; color: #475569; }
.badge-mine { background: var(--primary-light); color: var(--primary); }

/* ─── Empty / loading / error states ───────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.empty-state p + p { margin-top: 6px; font-size: 0.9rem; }
.loading-state { text-align: center; padding: 80px 24px; color: var(--text-muted); }
.error-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--error-text);
    background: var(--error-bg);
    border-radius: var(--radius);
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(2px);
}
.modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 36px 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal h2 { font-size: 1.3rem; font-weight: 800; }
.modal p { color: var(--text-muted); font-size: 0.93rem; }

/* ─── Toast notifications ───────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}
.toast {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    max-width: 320px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { background: var(--success-bg); color: var(--success); }
.toast-info { background: var(--info-bg); color: var(--info-text); }
.toast-error { background: var(--error-bg); color: var(--error-text); }

/* ─── Guest name badge ──────────────────────────────────────── */
.guest-name-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 6px 14px;
    border-radius: 99px;
    cursor: pointer;
    user-select: none;
}
.guest-name-badge:hover { background: #ddd6fe; }

/* ─── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }
