/* ============================================================
   MyEvent — Feuille de style unique
   ============================================================ */

/* Variables */
:root {
    --primary:       #6366F1;
    --primary-dark:  #4F46E5;
    --primary-light: #EEF2FF;
    --success:       #10B981;
    --success-light: #D1FAE5;
    --error:         #EF4444;
    --error-light:   #FEE2E2;
    --warning:       #F59E0B;
    --bg:            #F8FAFC;
    --surface:       #FFFFFF;
    --text:          #0F172A;
    --text-muted:    #64748B;
    --border:        #E2E8F0;
    --radius:        12px;
    --radius-lg:     16px;
    --shadow:        0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md:     0 8px 24px rgba(0, 0, 0, 0.08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* Conteneur principal */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    text-align: center;
    padding: 32px 0 24px;
}

.logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

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

/* ============================================================
   FORMULAIRES
   ============================================================ */
.event-form,
.booking-form {
    background: var(--surface);
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.email-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px !important; /* évite le zoom iOS */
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.email-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder {
    color: #CBD5E1;
}

/* ============================================================
   BOUTONS
   ============================================================ */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s;
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: var(--error-light);
    color: var(--error);
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-danger:hover {
    background: #fecaca;
}

/* ============================================================
   RÉSULTAT — ÉVÉNEMENT CRÉÉ
   ============================================================ */
.event-created {
    background: var(--surface);
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    text-align: center;
}

.success-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.event-created h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.event-details {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.event-details h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.event-details p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 4px 0;
}

/* Share link */
.share-link {
    margin: 20px 0;
    text-align: left;
}

.share-link label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-field {
    display: flex;
    gap: 8px;
}

.copy-field input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    font-size: 0.85rem !important;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.copy-field button {
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

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

/* Prix */
.price-section {
    margin: 20px 0;
    text-align: left;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
}

.price-section > label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.price-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.price-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-input-group input {
    width: 90px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem !important;
    font-weight: 600;
}

.price-input-group input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.price-input-group span {
    font-weight: 700;
    color: var(--text-muted);
}

/* Boutons d'action */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.action-buttons a,
.action-buttons button {
    width: 100%;
}

/* Email form */
.email-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.email-form input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
}

/* ============================================================
   PAGE ÉVÉNEMENT PUBLIQUE
   ============================================================ */
.event-public {
    background: var(--surface);
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.event-public h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.2;
}

.event-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.event-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
}

.event-info-item .icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.event-info-item strong {
    font-weight: 700;
    color: var(--text);
}

.event-info-item .label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.price-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
}

.price-badge.free {
    background: var(--success-light);
    color: var(--success);
}

.capacity-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.capacity-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.capacity-bar-fill.almost-full {
    background: linear-gradient(90deg, var(--warning), #D97706);
}

.capacity-bar-fill.full {
    background: linear-gradient(90deg, var(--error), #DC2626);
}

.full-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--error-light);
    color: var(--error);
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Messages */
.message {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin: 16px 0;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message.success {
    background: var(--success-light);
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.message.error {
    background: var(--error-light);
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.message.info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #A5B4FC;
}

/* ============================================================
   PAGE DE GESTION (MANAGE)
   ============================================================ */
.manage-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.manage-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.manage-header p {
    opacity: 0.85;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

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

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.manage-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.manage-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
}

.manage-section-header {
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.attendee-list {
    list-style: none;
}

.attendee-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.attendee-item:last-child {
    border-bottom: none;
}

.attendee-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

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

.attendee-info strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendee-info span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendee-status {
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}

.attendee-status.checked {
    background: var(--success-light);
    color: #065F46;
}

.attendee-status.pending {
    background: var(--border);
    color: var(--text-muted);
}

/* ============================================================
   PAGE SCANNER
   ============================================================ */
.scanner-wrapper {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
}

.scanner-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

#reader {
    width: 100% !important;
}

#reader video {
    width: 100% !important;
    border-radius: 0 !important;
}

#reader__dashboard_section_csr {
    display: none !important;
}

.scan-result {
    text-align: center;
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    margin: 16px 0;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scan-result.success {
    background: var(--success-light);
    border: 2px solid #6EE7B7;
}

.scan-result.error {
    background: var(--error-light);
    border: 2px solid #FCA5A5;
}

.scan-result.already {
    background: #FEF3C7;
    border: 2px solid #FCD34D;
}

.scan-result .result-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    line-height: 1;
}

.scan-result .result-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.scan-result .result-msg {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.scan-counter {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 20px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.scan-counter .counter-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.scan-counter .counter-value {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--primary);
}

.manual-check {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.manual-check h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.manual-input-group {
    display: flex;
    gap: 8px;
}

.manual-input-group input {
    flex: 1;
    padding: 13px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px !important;
    font-family: monospace;
}

.manual-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    text-align: center;
    padding: 24px 0 16px;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer .footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.footer-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

/* ============================================================
   UTILITAIRES
   ============================================================ */
.hidden {
    display: none !important;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* Spinner de chargement */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Lien de retour */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    margin-bottom: 16px;
}

.back-link:hover {
    text-decoration: underline;
}

/* Progress bar */
.progress-container {
    margin-top: 8px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-fill.warn {
    background: linear-gradient(90deg, var(--warning), #D97706);
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--error), #DC2626);
}

/* Tag de nombre de places */
.spots-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.spots-tag.available {
    background: var(--success-light);
    color: #065F46;
}

.spots-tag.limited {
    background: #FEF3C7;
    color: #92400E;
}

.spots-tag.sold-out {
    background: var(--error-light);
    color: #991B1B;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 400px) {
    .container {
        padding: 12px 12px;
    }

    .event-form,
    .booking-form,
    .event-created,
    .event-public {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card .stat-number {
        font-size: 1.6rem;
    }
}

@media (min-width: 600px) {
    .container {
        padding: 32px 20px;
    }

    .header {
        padding: 40px 0 32px;
    }
}
