* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #1a365d;
    --color-primary-light: #2c5282;
    --color-secondary: #c9a961;
    --color-bg: #faf9f7;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #4a5568;
    --color-border: #e8e4df;
    --color-hover: #f5f0e8;

    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Enhanced shadows for premium feel */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 8px 32px rgba(26, 54, 93, 0.15);
    --shadow-gold: 0 4px 16px rgba(201, 169, 97, 0.25);

    /* Refined transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Enhanced border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    --breakpoint-mobile: 480px;
    --breakpoint-tablet: 768px;
    --breakpoint-desktop: 1024px;
    --breakpoint-wide: 1200px;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth page transitions */
#main-content {
    transition: opacity 0.3s ease;
}

/* Global focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection styling */
::selection {
    background: rgba(201, 169, 97, 0.3);
    color: var(--color-text);
}

.back-button-container {
    position: fixed;
    top: 20px;
    left: 5%;
    z-index: 1001;
}

body[data-page="admin"] .back-button-container {
    display: none;
}

.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: white;
    border: 3px solid #c9a961;
    cursor: pointer;
    color: #1a365d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    padding: 0;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
    background: #f5f0e8;
}

.back-button svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 768px) {
    .back-button-container {
        display: none;
    }

    .profile-menu {
        top: 16px;
        right: 3%;
    }

    .header-actions {
        top: 16px;
        right: 3%;
    }

    .donate-button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .back-button-container {
        display: none;
    }

    .profile-menu {
        top: 12px;
        right: 2%;
    }

    .header-actions {
        top: 12px;
        right: 2%;
    }

    .donate-button {
        display: none;
    }
}

/* Bouton retour dans le header de la page watch */
body[data-page="watch"]:fullscreen .back-button-container,
body[data-page="watch"] .back-button-container.fullscreen-hidden {
    display: none;
}

body[data-page="watch"] video::-webkit-media-controls-panel .back-button-container {
    display: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-light);
}

button {
    font-family: var(--font-body);
}

 .page-content {
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
    }
    to {
        transform: translateY(0);
    }
}

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

.page-exit {
    animation: fadeOut 0.3s ease forwards;
}

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

.page-enter {
    animation: slideIn 0.4s ease forwards;
}

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

/* ===== GLOBAL MICRO-ANIMATIONS ===== */

/* Subtle scale animation for interactive elements */
@keyframes pulse-soft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Shimmer effect for loading states */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.loading-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Fade scale for modals and dialogs */
@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide up fade for list items */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== GLOBAL HOVER EFFECTS ===== */

/* Interactive lift effect */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Subtle glow on focus */
.hover-glow:focus,
.hover-glow:hover {
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.2);
}

/* Interactive scale */
.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-scale:active {
    transform: scale(0.98);
}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ===== MODAL BASE STYLES ===== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 54, 93, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

@media (max-width: 768px) {
    .modal {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0.5rem;
    }
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 20px;
    border: 1px solid rgba(201, 169, 97, 0.15);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.5),
        0 8px 32px rgba(26, 54, 93, 0.12),
        0 32px 80px rgba(26, 54, 93, 0.18);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

@media (max-height: 600px) {
    .modal-content {
        max-height: 95vh;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1a365d 0%, #c9a961 50%, #1a365d 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show .modal-content::before {
    opacity: 1;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem 1.25rem;
    border-bottom: 1px solid rgba(201, 169, 97, 0.15);
    flex-shrink: 0;
}

.modal-header h2 {
    color: #1a365d;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(201, 169, 97, 0.2);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    cursor: pointer;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.modal-close:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
    transform: rotate(90deg) scale(1.05);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-field {
    margin-bottom: 1.5rem;
}

.modal-field:last-of-type {
    margin-bottom: 0;
}

.modal-field label {
    display: block;
    color: #1a365d;
    font-weight: 600;
    margin-bottom: 0.625rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px solid rgba(201, 169, 97, 0.25);
    border-radius: 10px;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
    outline: none;
    border-color: #c9a961;
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.1);
}

.modal-actions {
    display: flex;
    gap: 0.875rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(201, 169, 97, 0.2);
    flex-shrink: 0;
}

/* ===== CONTACT MODAL ===== */

.contact-modal .modal-content {
    max-width: 500px;
}

.contact-modal .modal-field textarea {
    resize: vertical;
    min-height: 120px;
    font-family: var(--font-body);
}

.contact-modal .modal-field small {
    display: block;
    margin-top: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-align: right;
}

.contact-modal .modal-actions .btn svg {
    flex-shrink: 0;
}

/* ===== BUTTON STYLES FOR MODAL ===== */

.modal .btn {
    padding: 0.625rem 1.125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.modal .btn-primary {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.25);
}

.modal .btn-primary:hover {
    background: linear-gradient(135deg, #2c5282 0%, #2b6cb0 100%);
    box-shadow: 0 4px 16px rgba(26, 54, 93, 0.35);
    transform: translateY(-1px);
}

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

.modal .btn-secondary {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    color: #1a365d;
    border: 1.5px solid rgba(201, 169, 97, 0.25);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.modal .btn-secondary:hover {
    background: linear-gradient(135deg, #fafbfc 0%, #f5f0e8 100%);
    border-color: #c9a961;
}
