/**
 * Note Ton Court - Modern CSS
 * Festival du Court Metrage de Clermont-Ferrand
 * Palette: Rose, Violet, Orange-rouge
 */

/* ========================================
   CSS Custom Properties (Variables)
   ======================================== */
:root {
    /* Couleurs dominantes du festival */
    --couleur-1: #eba4b4;  /* Rose clair - accents légers */
    --couleur-2: #65589e;  /* Violet - secondaire */
    --couleur-3: #e44e29;  /* Orange-rouge - primaire */

    /* Variations des couleurs */
    --color-primary: #e44e29;
    --color-primary-dark: #c43d1f;
    --color-primary-light: #f06a4a;
    --color-secondary: #65589e;
    --color-secondary-dark: #4a4178;
    --color-secondary-light: #8578b8;
    --color-accent: #eba4b4;
    --color-accent-light: #f5c9d3;
    --color-accent-dark: #d78a9a;

    /* Background Colors - basés sur le violet */
    --color-bg-dark: #1e1a2e;
    --color-bg-medium: #2d2844;
    --color-bg-light: #3d365a;
    --color-bg-card: #f5f0f2;

    /* Text Colors */
    --color-text-light: #f0eef5;
    --color-text-white: #fff;
    --color-text-muted: #a09bb3;
    --color-text-dark: #1e1a2e;
    --color-text-subtle: #c5c0d3;
    --color-text-border: #5a5280;

    /* Typography */
    --font-primary: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Oswald', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;

    /* Shadows - avec teinte violette */
    --shadow-sm: 0 1px 2px rgba(101, 88, 158, 0.15);
    --shadow-md: 0 4px 6px rgba(101, 88, 158, 0.2);
    --shadow-lg: 0 10px 15px rgba(101, 88, 158, 0.25);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal: 400;
    --z-tooltip: 500;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    letter-spacing: -0.02em;
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 300;
    line-height: 1.2;
    color: var(--color-text-light);
}

h1 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-white);
}

h3 {
    position: relative;
    font-size: 1.3rem;
    line-height: 2.5rem;
    padding-left: var(--spacing-md);
}

h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-accent) 100%);
    border-radius: 3px;
}

h4 {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    padding-top: var(--spacing-md);
    color: var(--color-accent);
}

h4 span {
    font-weight: normal;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

p {
    margin-bottom: var(--spacing-md);
}

/* ========================================
   Links
   ======================================== */
a {
    color: var(--color-text-white);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover,
a:focus {
    color: var(--color-accent);
}

/* ========================================
   Layout
   ======================================== */
.container {
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.page {
    min-height: 100vh;
    padding-top: 60px; /* Header height */
    animation: fadeIn var(--transition-normal) ease-out;
}

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

.content {
    padding: var(--spacing-lg) var(--spacing-md);
}

/* ========================================
   Header
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(135deg, var(--color-secondary-dark) 0%, var(--color-bg-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    z-index: var(--z-fixed);
    border-bottom: 2px solid var(--color-primary);
    box-shadow: var(--shadow-md);
}

.header h1 {
    flex: 1;
    text-align: center;
    margin: 0 var(--spacing-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border-radius: var(--radius-sm);
}

.btn-back:hover {
    background-color: var(--color-secondary);
}

.btn-back svg {
    width: 24px;
    height: 24px;
    fill: var(--color-text-white);
}

/* ========================================
   Lists
   ======================================== */
.list {
    list-style: none;
    margin: var(--spacing-md) calc(var(--spacing-md) * -1);
}

.list-item {
    position: relative;
}

.list-item a {
    display: block;
    padding: var(--spacing-lg) var(--spacing-md);
    background-color: var(--color-bg-medium);
    color: var(--color-text-white);
    font-weight: 600;
    transition: transform var(--transition-fast), background-color var(--transition-fast), border-left var(--transition-fast);
    border-left: 4px solid transparent;
}

.list-item a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: var(--spacing-md);
    right: 0;
    height: 1px;
    background-color: var(--color-bg-dark);
}

.list-item a:hover {
    transform: translateX(4px);
    background-color: var(--color-bg-light);
    border-left-color: var(--color-primary);
}

.list-item .arrow {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: 0.4;
    fill: var(--color-accent);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.list-item a:hover .arrow {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--color-text-white);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--color-text-white);
}

.btn:active {
    transform: translateY(0);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--color-secondary-light) 0%, var(--color-secondary) 100%);
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.875rem;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-light);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-primary);
    font-size: 1rem;
    background-color: var(--color-bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--color-text-dark);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    background-color: var(--color-text-white);
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(101, 88, 158, 0.25);
}

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

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

/* ========================================
   Rating Stars
   ======================================== */
.rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: var(--spacing-xs);
}

.rating input {
    display: none;
}

.rating label {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--color-bg-light);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.rating label:hover,
.rating label:hover ~ label,
.rating input:checked ~ label {
    color: var(--color-accent);
}

.rating label:hover {
    transform: scale(1.2);
}

/* Alternative: Star Icons */
.star-rating {
    display: inline-flex;
    gap: 2px;
}

.star-rating .star {
    width: 28px;
    height: 28px;
    cursor: pointer;
    fill: var(--color-bg-light);
    transition: fill var(--transition-fast), transform var(--transition-fast);
}

.star-rating .star:hover,
.star-rating .star.active {
    fill: var(--color-accent);
}

.star-rating .star.highlighted {
    fill: var(--color-accent-light);
}

.star-rating .star:hover {
    transform: scale(1.15);
}

/* ========================================
   Cards
   ======================================== */
.card {
    background-color: var(--color-bg-medium);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    border-left: 3px solid var(--color-secondary);
    animation: fadeInUp var(--transition-normal) ease-out;
    animation-fill-mode: both;
}

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

/* Staggered animation for multiple cards */
.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 50ms; }
.card:nth-child(3) { animation-delay: 100ms; }
.card:nth-child(4) { animation-delay: 150ms; }
.card:nth-child(5) { animation-delay: 200ms; }

/* ========================================
   Comments Section
   ======================================== */
.comments-section {
    margin: var(--spacing-xl) 0;
}

.comment {
    padding: var(--spacing-md) 0;
    border-bottom: 1px dashed var(--color-text-border);
}

.comment:last-child {
    border-bottom: none;
}

.comment-author {
    color: var(--color-accent);
    font-weight: 600;
}

.comment-author a {
    color: var(--color-text-white);
    transition: color var(--transition-fast);
}

.comment-author a:hover {
    color: var(--color-accent);
}

.comment-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: var(--spacing-sm);
}

.comment-text {
    font-style: italic;
    margin-top: var(--spacing-xs);
    color: var(--color-text-light);
}

/* ========================================
   Film Scores
   ======================================== */
.film-scores {
    margin: var(--spacing-lg) 0;
}

.film-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px dashed var(--color-text-border);
    line-height: 2rem;
}

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

.film-title {
    flex: 1;
}

.film-rating {
    color: var(--color-accent);
    font-weight: 600;
    white-space: nowrap;
}

.average-score {
    font-size: 1.2rem;
    font-weight: 600;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-md);
}

.average-score span {
    color: var(--color-accent-light);
}

/* ========================================
   Homepage Specific
   ======================================== */
.hero-image {
    margin: calc(var(--spacing-md) * -1);
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.hero-image::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, var(--color-bg-dark), transparent);
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.welcome-text {
    font-weight: 600;
    text-align: justify;
    margin-bottom: var(--spacing-lg);
}

.latest-comments {
    margin: var(--spacing-xl) 0;
}

.latest-comment {
    font-size: 0.9em;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-bg-medium);
}

.latest-comment:last-child {
    border-bottom: none;
}

/* ========================================
   Palmares (Rankings)
   ======================================== */
.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    background-color: var(--color-bg-medium);
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast);
}

.ranking-item:hover {
    transform: translateX(4px);
}

.ranking-position {
    width: 30px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary);
}

.ranking-score {
    width: 60px;
    font-weight: 600;
    color: var(--color-accent);
}

.ranking-title {
    flex: 1;
}

/* Top 3 styling */
.ranking-item:nth-child(1) {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
    border-left: 4px solid var(--color-primary);
}

.ranking-item:nth-child(2) {
    border-left: 4px solid var(--color-accent);
}

.ranking-item:nth-child(3) {
    border-left: 4px solid var(--color-secondary-light);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    text-align: center;
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    margin: var(--spacing-xl) calc(var(--spacing-md) * -1) 0;
    font-size: 0.875rem;
    line-height: 1.3;
}

.footer a {
    color: var(--color-text-white);
    text-decoration: underline;
    text-decoration-color: var(--color-accent-light);
}

.footer a:hover {
    color: var(--color-accent-light);
}

.footer-logo {
    display: block;
    max-width: 250px;
    height: auto;
    margin: var(--spacing-md) auto 0;
    padding-bottom: var(--spacing-md);
}

/* ========================================
   Utilities
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Gradient text utility */
.text-gradient {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Loading States
   ======================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-secondary-light);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Decorative Elements
   ======================================== */
.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--color-secondary) 50%, transparent 100%);
    margin: var(--spacing-xl) 0;
}

.accent-bar {
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 50%, var(--color-secondary) 100%);
    border-radius: 2px;
}

/* ========================================
   Responsive
   ======================================== */
@media (min-width: 768px) {
    .container {
        padding: 0 var(--spacing-lg);
    }

    h3 {
        font-size: 1.5rem;
    }

    .list-item a {
        padding: var(--spacing-lg) var(--spacing-xl);
    }
}

/* ========================================
   Dark Mode Support (optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* Already dark by default */
}

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

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .header,
    .footer,
    .btn {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .page {
        padding-top: 0;
    }
}

/* ========================================
   Film Rating Cards
   ======================================== */
.film-rating-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid var(--color-secondary);
}

.film-rating-title {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
    font-size: 1rem;
    line-height: 1.4;
}

.stars-container {
    display: flex;
    gap: 8px;
}

.star-btn {
    font-size: 36px;
    color: var(--color-surface-light);
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.star-btn:hover {
    transform: scale(1.15);
}

.star-btn.hover {
    color: var(--color-accent);
}

.star-btn.active {
    color: var(--color-primary);
}
