/* ═══════════════════════════════════════════════
   La French Touch — Design System
   Warm, editorial, professional
   ═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Tokens ─── */
:root {
    /* Surface */
    --surface-primary: #F5F3EE;
    --surface-secondary: #ECEAE4;
    --surface-card: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --surface-overlay: rgba(26,25,24,0.4);

    /* Text */
    --text-primary: #1A1918;
    --text-secondary: #5C5A56;
    --text-muted: #9C9A95;
    --text-on-accent: #FFFFFF;

    /* Accent — Terre cuite */
    --accent: #C4603A;
    --accent-hover: #B15332;
    --accent-subtle: rgba(196,96,58,0.08);
    --accent-border: rgba(196,96,58,0.2);

    /* Functional */
    --success: #3D7A4A;
    --success-bg: rgba(61,122,74,0.06);
    --success-border: rgba(61,122,74,0.18);
    --danger: #C13B3B;
    --danger-bg: rgba(193,59,59,0.06);
    --danger-border: rgba(193,59,59,0.18);
    --warning: #A97B1F;
    --warning-bg: rgba(169,123,31,0.06);
    --warning-border: rgba(169,123,31,0.18);
    --info: #3B6FC1;
    --info-bg: rgba(59,111,193,0.06);

    /* Border */
    --border: rgba(26,25,24,0.08);
    --border-strong: rgba(26,25,24,0.14);
    --border-focus: var(--accent);

    /* Radius — consistent 8px */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(26,25,24,0.04);
    --shadow: 0 2px 8px rgba(26,25,24,0.06), 0 1px 2px rgba(26,25,24,0.04);
    --shadow-lg: 0 8px 24px rgba(26,25,24,0.08), 0 2px 8px rgba(26,25,24,0.04);

    /* Transition */
    --transition: 150ms ease-out;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--surface-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
}

/* ─── Typography ─── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.025em; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.015em; }

/* ─── Layout ─── */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

.container-wide {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ─── Utilities ─── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ─── Header ─── */
.header {
    background: var(--surface-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 480px;
    margin: 0 auto;
}

/* ─── Logo ─── */
.logo {
    font-size: 0.9375rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ─── Cards ─── */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    text-decoration: none;
    line-height: 1.25;
    letter-spacing: -0.01em;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
    background: var(--surface-secondary);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8125rem;
    min-height: 32px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 0.9375rem;
    min-height: 48px;
    border-radius: var(--radius);
}

.btn-block { width: 100%; }

/* ─── Forms ─── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: 'Inter', sans-serif;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    min-height: 44px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.form-input::placeholder { color: var(--text-muted); }

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

/* ─── Search Bar ─── */
.search-bar { position: relative; }

.search-bar .form-input {
    padding-left: 40px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--surface-card);
    border: 1px solid var(--border-strong);
}

.search-bar svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-accent { background: var(--accent-subtle); color: var(--accent); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-secondary); color: var(--text-muted); }

/* ─── Guest List Items ─── */
.guest-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    transition: background var(--transition);
    gap: 12px;
}

.guest-item:active {
    background: var(--surface-secondary);
}

.guest-item.checked-in {
    border-color: var(--success-border);
    background: var(--success-bg);
}

.guest-item.pending {
    border-color: var(--warning-border);
    background: var(--warning-bg);
}

.guest-item.removing {
    opacity: 0;
    transform: translateX(80px);
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    overflow: hidden;
    transition: all 0.3s ease;
}

.guest-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.guest-info {
    flex: 1;
    min-width: 0;
}

.guest-name {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.guest-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.guest-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── Check-in Button ─── */
.btn-checkin {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--accent);
    border: none;
    color: var(--text-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}

.btn-checkin:hover { background: var(--accent-hover); }
.btn-checkin:active { transform: scale(0.95); }

.btn-checkin.done {
    background: var(--success);
}

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
    background: var(--surface-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--surface-overlay);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 16px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 0 auto 14px;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
    z-index: 10;
    min-width: 32px;
}

.modal-close:hover {
    background: var(--border-strong);
    color: var(--text-primary);
}

/* ─── QR Code Container ─── */
.qr-container {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin: 16px auto;
    max-width: 260px;
    border: 1px solid var(--border);
}

/* ─── Toggle Switch ─── */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--surface-secondary);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* ─── FAB ─── */
.fab {
    position: fixed;
    bottom: 24px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(196,96,58,0.2);
    transition: background var(--transition), transform var(--transition);
    z-index: 90;
}

.fab:hover { background: var(--accent-hover); }
.fab:active { transform: scale(0.93); }

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--surface-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 500;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-color: var(--success-border); }
.toast.error { border-color: var(--danger-border); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ─── Safe Area ─── */
body {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ─── Animations ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.2s ease-out; }

/* ─── Focus Visible ─── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ─── Responsive ─── */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
