/* ============================================
   Portail d'inscription aux lectures de Messe
   Design System — Tons chauds ecclésiastiques
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;500;600;700&display=swap');

/* ----- CSS Variables ----- */
:root {
    /* Couleurs principales */
    --gold-50: #fefce8;
    --gold-100: #fef9c3;
    --gold-200: #fef08a;
    --gold-300: #fde047;
    --gold-400: #d4a853;
    --gold-500: #b8860b;
    --gold-600: #92690a;
    --gold-700: #6b4f08;

    --cream-50: #fdfcfa;
    --cream-100: #f9f5ed;
    --cream-200: #f0e8d8;
    --cream-300: #e2d5be;

    --brown-50: #fdf8f0;
    --brown-100: #f5e6d0;
    --brown-200: #e8cfa8;
    --brown-300: #d4a97a;
    --brown-400: #b8864e;
    --brown-500: #8b6a3e;
    --brown-600: #6b4f2e;
    --brown-700: #4a3520;
    --brown-800: #2d1f12;
    --brown-900: #1a1008;

    --red-error: #c53030;
    --red-error-bg: #fff5f5;
    --green-success: #2f855a;
    --green-success-bg: #f0fff4;
    --blue-info: #2b6cb0;
    --blue-info-bg: #ebf8ff;

    /* Surfaces */
    --bg-primary: #f8f4ec;
    --bg-secondary: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-hover: rgba(255, 255, 255, 0.88);
    --bg-overlay: rgba(26, 16, 8, 0.5);

    /* Texte */
    --text-primary: #2d1f12;
    --text-secondary: #6b4f2e;
    --text-tertiary: #8b7a65;
    --text-inverse: #fdfcfa;

    /* Bordures & ombres */
    --border-light: rgba(212, 169, 83, 0.2);
    --border-medium: rgba(212, 169, 83, 0.35);
    --shadow-sm: 0 1px 3px rgba(45, 31, 18, 0.06);
    --shadow-md: 0 4px 12px rgba(45, 31, 18, 0.08);
    --shadow-lg: 0 8px 30px rgba(45, 31, 18, 0.12);
    --shadow-xl: 0 20px 60px rgba(45, 31, 18, 0.15);
    --shadow-glow: 0 0 20px rgba(184, 134, 11, 0.15);

    /* Rayons */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition-base: 250ms var(--ease-out);
    --transition-slow: 400ms var(--ease-out);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background pattern subtil */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(184, 134, 11, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 106, 62, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(212, 169, 83, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ----- Typography ----- */
h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

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

/* ----- Header ----- */
.header {
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
    position: relative;
}

.header__icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
    animation: gentleFloat 4s ease-in-out infinite;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.header__title {
    color: var(--brown-700);
    margin-bottom: 0.35rem;
}

.header__subtitle {
    color: var(--text-tertiary);
    font-size: 0.95rem;
    font-weight: 400;
    max-width: 500px;
    margin: 0 auto;
}

.header__admin-link {
    position: absolute;
    top: 1.5rem;
    right: 1.25rem;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.header__admin-link:hover {
    opacity: 1;
}

/* ----- Parish Tabs ----- */
.parish-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.parish-tab {
    padding: 0.65rem 1.5rem;
    border: 1.5px solid var(--border-medium);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.parish-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.parish-tab:hover {
    border-color: var(--gold-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.parish-tab.active {
    border-color: var(--gold-500);
    color: var(--text-inverse);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-1px);
}

.parish-tab.active::before {
    opacity: 1;
}

.parish-tab span {
    position: relative;
    z-index: 1;
}

/* ----- Glass Card ----- */
.card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card__title {
    color: var(--brown-600);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card__title-icon {
    font-size: 1.25rem;
}

/* ----- Form Elements ----- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.form-input:focus {
    border-color: var(--gold-400);
    box-shadow: 0 0 0 3px rgba(212, 169, 83, 0.15);
    background: rgba(255, 255, 255, 0.9);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--red-error);
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* ----- Date Checkboxes ----- */
.dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.date-option {
    position: relative;
}

.date-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.date-option label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.4);
    transition: all var(--transition-fast);
    user-select: none;
}

.date-option label::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-radius: 5px;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-option input:checked + label {
    border-color: var(--gold-500);
    background: rgba(184, 134, 11, 0.08);
    color: var(--text-primary);
    font-weight: 500;
}

.date-option input:checked + label::before {
    background: var(--gold-500);
    border-color: var(--gold-500);
    box-shadow: inset 0 0 0 3px white;
}

.date-option label:hover {
    border-color: var(--gold-400);
    background: rgba(255, 255, 255, 0.7);
}

.date-option .date-label-text {
    display: flex;
    flex-direction: column;
}

.date-option .date-day {
    font-weight: 600;
    font-size: 0.88rem;
}

.date-option .date-detail {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 1;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
    color: white;
    box-shadow: var(--shadow-md), 0 2px 8px rgba(184, 134, 11, 0.3);
}

.btn-primary:hover {
    box-shadow: var(--shadow-lg), 0 4px 15px rgba(184, 134, 11, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-medium);
}

.btn-secondary:hover {
    border-color: var(--gold-400);
    background: var(--bg-glass-hover);
}

.btn-danger {
    background: var(--red-error);
    color: white;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.btn-danger:hover {
    background: #9b2c2c;
}

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ----- Messages ----- */
.message {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    animation: slideIn 0.3s var(--ease-out);
}

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

.message-success {
    background: var(--green-success-bg);
    color: var(--green-success);
    border: 1px solid rgba(47, 133, 90, 0.2);
}

.message-error {
    background: var(--red-error-bg);
    color: var(--red-error);
    border: 1px solid rgba(197, 48, 48, 0.2);
}

.message-info {
    background: var(--blue-info-bg);
    color: var(--blue-info);
    border: 1px solid rgba(43, 108, 176, 0.2);
}

/* ----- Registrations List ----- */
.registrations-list {
    margin-top: 1rem;
}

.registration-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border-light);
    animation: fadeIn 0.3s var(--ease-out);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.registration-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.registration-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.registration-phone {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.registration-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(184, 134, 11, 0.1);
    color: var(--gold-600);
    font-weight: 600;
}

/* ----- Empty State ----- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-tertiary);
}

.empty-state__icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state__text {
    font-size: 0.92rem;
}

/* ----- Date Group (Admin & Public) ----- */
.date-group {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.4);
}

.date-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.date-group__title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--brown-600);
}

.date-group__count {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ----- Admin Login ----- */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
}

.login-card {
    text-align: center;
}

.login-card .header__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ----- Admin Layout ----- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

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

/* Add date form */
.add-date-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.add-date-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

/* Add registration form (admin) */
.add-reg-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
}

.add-reg-form .form-group {
    margin-bottom: 0;
}

.add-reg-form .btn {
    align-self: flex-end;
}

/* ----- Table (Admin) ----- */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.admin-table th {
    text-align: left;
    padding: 0.6rem 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-medium);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.3);
}

/* ----- Footer ----- */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

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

/* ----- Confirmation Modal ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.2s var(--ease-out) forwards;
    padding: 1rem;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    animation: modalIn 0.3s var(--ease-out) forwards;
}

@keyframes modalIn {
    to { transform: scale(1); }
}

.modal__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: var(--brown-700);
}

.modal__text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
    h1 { font-size: 1.55rem; }
    h2 { font-size: 1.25rem; }
    
    .container { padding: 0 1rem; }
    .header { padding: 2rem 0.75rem 1rem; }
    
    .card { padding: 1.25rem; }
    
    .parish-tabs { gap: 0.35rem; }
    .parish-tab { 
        padding: 0.55rem 1rem; 
        font-size: 0.82rem;
    }
    
    .dates-grid {
        grid-template-columns: 1fr;
    }
    
    .add-date-form {
        flex-direction: column;
    }
    
    .admin-table {
        font-size: 0.8rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.45rem 0.5rem;
    }
    
    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }
    
    .modal { padding: 1.5rem; }
}

/* ----- Loading skeleton ----- */
.skeleton {
    background: linear-gradient(90deg, var(--cream-200) 25%, var(--cream-100) 50%, var(--cream-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton--lg { height: 3rem; }
.skeleton--md { height: 2rem; }

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ----- Quota indicator ----- */
.quota-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--blue-info-bg);
    border: 1px solid rgba(43, 108, 176, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--blue-info);
    font-weight: 500;
    margin-bottom: 1rem;
}

.quota-indicator--warning {
    background: #fffbeb;
    border-color: rgba(184, 134, 11, 0.2);
    color: var(--gold-600);
}

.quota-indicator--full {
    background: var(--red-error-bg);
    border-color: rgba(197, 48, 48, 0.15);
    color: var(--red-error);
}

/* ----- Section transition ----- */
.section-enter {
    animation: sectionSlideIn 0.4s var(--ease-out);
}

@keyframes sectionSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----- Badge counter ----- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--gold-500);
    color: white;
}

/* ----- Toggle for admin sections ----- */
.toggle-section {
    cursor: pointer;
    user-select: none;
}

.toggle-section::after {
    content: '▾';
    margin-left: 0.35rem;
    font-size: 0.85em;
    transition: transform var(--transition-fast);
    display: inline-block;
}

.toggle-section.collapsed::after {
    transform: rotate(-90deg);
}

/* ----- Confirmation summary ----- */
.summary-card {
    background: linear-gradient(135deg, rgba(184, 134, 11, 0.06), rgba(139, 106, 62, 0.04));
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9rem;
}

.summary-item__label {
    color: var(--text-tertiary);
}

.summary-item__value {
    font-weight: 600;
    color: var(--text-primary);
}
