/* ------------------------
   DESIGN SYSTEM & VARIABLES
   ------------------------ */
:root {
    --bg: #FFFFFF;
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --cta: #FF2D55;
    --cta-hover: #E11D48;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --section-bg: #F1F5F9;
    --border: #E2E8F0;
    --success-bg: #ECFDF5;
    --success-text: #059669;
    --error-bg: #FEF2F2;
    --error-text: #DC2626;

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;

    --shadow-soft: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
    --shadow-hover: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

a { text-decoration: none; color: inherit; }

h1 { font-size: 1.5rem; font-weight: 800; line-height: 1.1; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.25rem; }
p  { color: var(--text-secondary); }

.section-title {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

/* ------------------------
   BUTTONS
   ------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.btn-cta  { background: var(--cta);     color: white; box-shadow: 0 4px 14px rgba(255,45,85,0.35); }
.btn-cta:hover  { background: var(--cta-hover);  transform: translateY(-2px); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--section-bg); color: var(--text-primary); }

.btn-small  { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
.btn-large  { padding: 0.75rem 1.5rem; font-size: 1rem; width: 100%; }
.btn-full   { width: 100%; padding: 0.9rem; margin-top: 0.75rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Badge */
.badge {
    background: var(--cta); color: white;
    padding: 0.2rem 0.5rem; border-radius: 99px;
    font-size: 0.65rem; font-weight: 800;
    text-transform: uppercase; display: inline-block;
    margin-bottom: 0.25rem;
}

/* Messages */
.msg {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.msg-ok  { background: var(--success-bg); color: var(--success-text); }
.msg-err { background: var(--error-bg);   color: var(--error-text); }

/* ------------------------
   NAVBAR
   ------------------------ */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--section-bg);
}
.logo { font-weight: 800; font-size: 1rem; color: var(--primary); }
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-username { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.nav-links { display: none; gap: 0.25rem; }
.nav-links a {
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary); padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm); transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active { background: var(--section-bg); color: var(--primary); }

/* ------------------------
   HERO
   ------------------------ */
.hero {
    padding: 1rem 0;
    background: linear-gradient(180deg, var(--section-bg) 0%, var(--bg) 100%);
}
.hero-container { display: flex; flex-direction: column; gap: 1rem; }
.hero-content { text-align: center; }
.hero-content p { font-size: 0.875rem; margin-bottom: 1rem; }

.hero-card {
    background: var(--bg); border-radius: var(--radius-md);
    padding: 1rem; box-shadow: var(--shadow-hover);
    border: 1px solid rgba(0,0,0,0.05); text-align: center;
}
.card-header { margin-bottom: 0.5rem; }

.countdown {
    display: flex; justify-content: center;
    gap: 0.5rem; margin: 0.75rem 0;
}
.time-block {
    background: var(--section-bg); padding: 0.5rem;
    border-radius: var(--radius-sm); min-width: 45px;
}
.time-block span { display: block; font-size: 1.25rem; font-weight: 800; color: var(--primary); }
.time-block small { color: var(--text-secondary); font-size: 0.65rem; font-weight: 600; }
.stats { font-weight: 600; color: var(--text-primary); font-size: 0.75rem; }

/* ------------------------
   HOW IT WORKS
   ------------------------ */
.how-it-works { padding: 0.5rem 0 1rem; }
.steps-grid { display: flex; gap: 0.5rem; }
.step-card {
    background: var(--section-bg); padding: 0.75rem 0.5rem;
    border-radius: var(--radius-sm); text-align: center;
    box-shadow: var(--shadow-soft); flex: 1;
}
.step-icon { font-size: 1.25rem; margin-bottom: 0.25rem; }
.step-card h3 { font-size: 0.65rem; line-height: 1.2; margin: 0; }
.step-card p { display: none; }

/* ------------------------
   GALLERY
   ------------------------ */
.gallery { padding: 1rem 0 2rem; }
.gallery-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 1rem;
}
.gallery-header .section-title { margin-bottom: 0; }
.filter-badge {
    background: var(--section-bg); padding: 0.25rem 0.75rem;
    border-radius: 99px; font-weight: 600; font-size: 0.875rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.gallery-state {
    grid-column: 1/-1; text-align: center;
    padding: 3rem 1rem; color: var(--text-secondary); font-size: 0.9rem;
}
.gallery-state p:first-child { font-size: 1.5rem; margin-bottom: 0.5rem; }

.photo-card {
    position: relative; border-radius: var(--radius-md);
    overflow: hidden; aspect-ratio: 1/1; cursor: pointer;
    box-shadow: var(--shadow-soft); background: var(--section-bg);
}
.photo-card img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.4s ease;
}
.photo-card:hover img { transform: scale(1.03); }
.photo-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
}

.photo-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(15,23,42,0.85), transparent);
    display: flex; justify-content: space-between; align-items: flex-end;
}
.photo-info .username { color: white; font-weight: 600; font-size: 0.875rem; }
.photo-info .card-badge {
    background: var(--cta); color: white; font-size: 0.65rem;
    padding: 0.2rem 0.5rem; border-radius: 4px; font-weight: 800;
    margin-bottom: 0.25rem; display: inline-block;
}

.like-btn {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    color: white; padding: 0.5rem 0.75rem;
    border-radius: 99px; font-weight: 600; font-size: 0.875rem;
    display: flex; align-items: center; gap: 0.3rem;
    cursor: pointer; transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.like-btn:hover:not(:disabled) { background: var(--cta); border-color: var(--cta); transform: scale(1.05); }
.like-btn.liked { background: var(--cta); border-color: var(--cta); }
.like-btn:disabled { cursor: default; opacity: 0.8; }

/* ------------------------
   LEADERBOARD (dans index)
   ------------------------ */
.leaderboard-section { padding: 2rem 0 3rem; background: var(--section-bg); }
.leaderboard-card {
    background: var(--bg); border-radius: var(--radius-lg);
    padding: 1rem; box-shadow: var(--shadow-soft);
}
.leaderboard-list { list-style: none; }
.leaderboard-item {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--section-bg);
    gap: 0.75rem;
}
.leaderboard-item:last-child { border-bottom: none; }

.lb-thumb {
    width: 40px; height: 40px; border-radius: 10px;
    object-fit: cover; flex-shrink: 0;
    border: 2px solid var(--border);
}
.lb-thumb-ph {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--section-bg); display: flex;
    align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}

.rank { font-weight: 800; font-size: 1.1rem; color: var(--text-secondary); min-width: 25px; }
.leaderboard-item.rank-1 .rank { color: #F59E0B; }
.leaderboard-item.rank-2 .rank { color: #94A3B8; }
.leaderboard-item.rank-3 .rank { color: #B45309; }

.user-details { flex-grow: 1; }
.user-details strong { display: block; font-size: 0.875rem; color: var(--text-primary); }
.user-details span { font-size: 0.75rem; color: var(--text-secondary); }
.score {
    font-weight: 800; color: var(--primary);
    background: rgba(37,99,235,0.1);
    padding: 0.25rem 0.6rem; border-radius: 99px; font-size: 0.75rem;
    white-space: nowrap;
}

.lb-empty { padding: 1.5rem; text-align: center; color: var(--text-secondary); font-size: 0.875rem; }

/* ------------------------
   PAGE CLASSEMENT COMPLÈTE
   ------------------------ */
.classement-hero {
    background: linear-gradient(180deg, var(--section-bg) 0%, var(--bg) 100%);
    padding: 2rem 0 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.classement-hero h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
.classement-meta {
    display: flex; justify-content: center;
    gap: 1.5rem; flex-wrap: wrap;
    margin-top: 1rem;
}
.classement-meta-item { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.classement-meta-item strong { color: var(--primary); }

.classement-grid-section { padding: 2rem 0 4rem; }

/* Grille photos classement (masonry-like) */
.classement-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.classement-card {
    background: var(--bg); border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: var(--transition);
}
.classement-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.classement-card.first { border-color: #F59E0B; }

.classement-card-img {
    width: 100%; aspect-ratio: 4/3;
    object-fit: cover; display: block; cursor: zoom-in;
}
.classement-card-img-ph {
    width: 100%; aspect-ratio: 4/3;
    background: var(--section-bg);
    display: flex; align-items: center; justify-content: center; font-size: 3rem;
}

.classement-card-body { padding: 0.9rem 1rem; }
.classement-card-top {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 0.5rem;
}
.classement-rank-badge {
    font-size: 1.1rem; font-weight: 800;
}
.classement-username { font-weight: 700; font-size: 0.9rem; }
.classement-card-bottom {
    display: flex; justify-content: space-between; align-items: center;
}
.classement-votes { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; }
.classement-votes strong { color: var(--primary); }

.vote-btn-full {
    background: var(--section-bg); border: 1.5px solid var(--border);
    color: var(--text-primary); padding: 0.4rem 1rem;
    border-radius: 99px; font-weight: 700; font-size: 0.8rem;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; gap: 0.3rem;
    font-family: 'Inter', sans-serif;
}
.vote-btn-full:hover:not(:disabled) { background: var(--cta); border-color: var(--cta); color: white; }
.vote-btn-full.voted { background: var(--cta); border-color: var(--cta); color: white; }
.vote-btn-full:disabled { opacity: 0.6; cursor: default; }

/* ------------------------
   MODAL UPLOAD
   ------------------------ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(15,23,42,0.7); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal {
    background: var(--bg); border-radius: var(--radius-lg);
    padding: 1.5rem; width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto; position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: var(--section-bg); border: none; border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.2rem; }
.modal-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.25rem; }
.modal-subtitle strong { color: var(--primary); }

/* Zone upload */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius-md);
    margin-bottom: 1rem; overflow: hidden; transition: border-color 0.2s;
}
.upload-zone.drag-over { border-color: var(--primary); background: rgba(37,99,235,0.03); }
.upload-trigger {
    padding: 2rem 1rem; text-align: center; cursor: pointer;
}
.upload-trigger:hover { background: var(--section-bg); }
.upload-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.upload-text { font-size: 0.875rem; color: var(--text-primary); margin-bottom: 0.2rem; }
.upload-hint { font-size: 0.75rem; color: var(--text-secondary); }

.preview-wrap { position: relative; }
.preview-wrap img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.remove-photo {
    position: absolute; top: 0.5rem; right: 0.5rem;
    background: rgba(15,23,42,0.75); color: white; border: none;
    border-radius: var(--radius-sm); padding: 0.3rem 0.7rem;
    font-size: 0.72rem; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 600;
}

/* Progress */
.progress-wrap { margin-bottom: 1rem; }
.progress-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.progress-bar-bg { height: 6px; background: var(--section-bg); border-radius: 999px; overflow: hidden; }
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--cta));
    border-radius: 999px; transition: width 0.3s ease;
}

/* Lightbox */
.lightbox-inner {
    max-width: 90vw; position: relative;
    display: flex; flex-direction: column; align-items: center;
}
.lightbox-inner .modal-close { position: absolute; top: -2.5rem; right: 0; }
.lightbox-inner img { max-width: 85vw; max-height: 80vh; object-fit: contain; border-radius: var(--radius-md); display: block; }
.lightbox-meta {
    width: 100%; padding: 0.6rem 0 0;
    display: flex; justify-content: space-between;
    color: white; font-size: 0.82rem; font-weight: 600;
}

/* ------------------------
   AUTH PAGE
   ------------------------ */
.auth-page {
    min-height: calc(100vh - 56px);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, var(--section-bg) 0%, var(--bg) 100%);
}
.auth-card {
    background: var(--bg); border-radius: var(--radius-lg);
    padding: 1.5rem; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-hover); border: 1px solid rgba(0,0,0,0.05);
}
.auth-tabs { display: flex; border-bottom: 2px solid var(--section-bg); margin-bottom: 1.5rem; }
.auth-tab {
    flex: 1; background: none; border: none; padding: 0.75rem;
    font-family: 'Inter', sans-serif; font-size: 0.875rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: var(--transition);
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.25rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.35rem; }
.field input {
    width: 100%; padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif; font-size: 0.875rem;
    color: var(--text-primary); background: var(--bg);
    transition: border-color 0.2s; outline: none;
}
.field input:focus { border-color: var(--primary); }
.field input::placeholder { color: #CBD5E1; }
.field-hint { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.3rem; }
.field-link { display: block; font-size: 0.72rem; color: var(--primary); text-align: right; margin-top: 0.3rem; cursor: pointer; }
.field-link:hover { text-decoration: underline; }

.pwd-strength { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.pwd-bar { height: 4px; border-radius: 999px; transition: all 0.3s; flex-shrink: 0; }
.pwd-strength span { font-size: 0.68rem; font-weight: 600; }

.auth-switch { text-align: center; margin-top: 1rem; font-size: 0.8rem; color: var(--text-secondary); }
.auth-switch a { color: var(--primary); font-weight: 600; cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }

/* ------------------------
   FOOTER
   ------------------------ */
footer { text-align: center; padding: 2rem; color: var(--text-secondary); font-size: 0.75rem; }

/* ------------------------
   RESPONSIVE
   ------------------------ */
@media (min-width: 768px) {
    .navbar { padding: 1rem 1.5rem; }
    .logo { font-size: 1.25rem; }
    .btn-small { padding: 0.5rem 1rem; font-size: 0.875rem; }
    .nav-links { display: flex; }

    h1 { font-size: 3.5rem; margin-bottom: 1rem; }
    .hero { padding: 3rem 0; }
    .hero-container { flex-direction: row; align-items: center; gap: 2rem; }
    .hero-content { flex: 1; text-align: left; }
    .hero-content p { font-size: 1.125rem; margin-bottom: 2rem; }
    .hero-content .btn-large { width: auto; padding: 1rem 2rem; font-size: 1.125rem; }
    .hero-card { flex: 1; max-width: 400px; padding: 1.5rem; }
    .countdown { gap: 1rem; margin: 1.5rem 0; }
    .time-block { padding: 0.75rem; min-width: 60px; }
    .time-block span { font-size: 1.5rem; }

    .how-it-works { padding: 4rem 0; }
    .section-title { font-size: 1.75rem; margin-bottom: 2rem; }
    .steps-grid { gap: 1.5rem; }
    .step-card { padding: 2rem; }
    .step-icon { font-size: 2.5rem; margin-bottom: 1rem; }
    .step-card h3 { font-size: 1.17em; margin-bottom: 0.5rem; }
    .step-card p { display: block; font-size: 0.875rem; }

    .gallery { padding: 4rem 0 3rem; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }

    .leaderboard-section { padding: 4rem 0; }
    .leaderboard-card { padding: 1.5rem; max-width: 600px; margin: 0 auto; }
    .leaderboard-item { padding: 1rem 0; }

    .classement-hero { padding: 3rem 0 2rem; }
    .classement-hero h1 { font-size: 2.5rem; }
    .classement-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}

@media (min-width: 1024px) {
    .photo-grid { grid-template-columns: repeat(3, 1fr); }
    .classement-grid { grid-template-columns: repeat(3, 1fr); }
}
