/* ========================================================================
   Les 80 ans de Daniel — Stylesheet
   ======================================================================== */

:root {
    --color-bg:           #F0F4F8;
    --color-surface:      #FFFFFF;
    --color-primary:      #1B3A6B;
    --color-primary-hover:#142D54;
    --color-secondary:    #C9A84C;
    --color-text:         #1A1A2E;
    --color-text-muted:   #5A6478;
    --color-border:       #D1D9E6;
    --color-success:      #27AE60;
    --color-error:        #C0392B;
    --color-warning:      #E67E22;

    --font-body:   Georgia, 'Times New Roman', serif;
    --radius:      8px;
    --shadow:      0 2px 12px rgba(27, 58, 107, 0.08);
    --max-width:   900px;
}

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

body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* ---- Flash messages ---- */
.flash-container {
    max-width: var(--max-width);
    margin: 1rem auto 0;
    padding: 0 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.flash-success { background: #E8F8F0; color: #1E7E4A; border: 1px solid #A3D9B8; }
.flash-error   { background: #FDEDEC; color: #922B21; border: 1px solid #F5B7B1; }
.flash-warning { background: #FEF5E7; color: #935116; border: 1px solid #F8C471; }

/* ---- Hero section ---- */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero h1 {
    font-size: 2.4rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero h1 sup {
    font-size: 0.5em;
    color: var(--color-secondary);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* ---- Hero carousel (crossfade) ---- */
.hero-carousel-wrapper {
    max-width: 300px;
    margin: 1.5rem auto 0;
}

.hero-carousel-caption {
    text-align: center;
    margin-bottom: 0.6rem;
    transition: opacity 0.4s ease;
}

.caption-age {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-primary);
}

.caption-year {
    font-size: 1.1rem;
    color: var(--color-secondary);
    margin-left: 0.4rem;
}

.hero-carousel {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(27, 58, 107, 0.15);
    overflow: hidden;
}

.hero-carousel-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.hero-carousel-img.active {
    opacity: 1;
}

/* ---- Login section ---- */
.login-section {
    text-align: center;
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 480px;
    margin: 2rem auto;
}

.login-section h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

.login-section p {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.login-form .input-group {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.login-form input[type="password"] {
    flex: 1;
    max-width: 250px;
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
}

.page-header h1 {
    font-size: 1.6rem;
    color: var(--color-primary);
}

.header-nav {
    display: flex;
    gap: 0.5rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

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

.btn-outline {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1.05rem;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-secondary);
    font-weight: bold;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ---- Message cards ---- */
.message-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.message-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.message-header h3 {
    font-size: 1.15rem;
    color: var(--color-primary);
}

.message-header time {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.message-text {
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

.message-photos {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.message-photos img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-photos img:hover {
    transform: scale(1.05);
}

.message-photos-only {
    font-style: italic;
    color: var(--color-text-muted);
}

.message-private {
    font-style: italic;
    color: var(--color-secondary);
}

/* ---- Checkbox ---- */
.form-group-checkbox {
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.admin-private-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--color-secondary);
    color: #fff;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 3rem 0;
    font-style: italic;
}

/* ---- Photo grid (gallery tab) ---- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.photo-grid-item {
    position: relative;
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.photo-grid-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.photo-grid-item:hover img {
    transform: scale(1.05);
}

.photo-author {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(27, 58, 107, 0.7);
    color: #fff;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    text-align: center;
}

/* ---- Lightbox ---- */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
}

/* ---- Form ---- */
.message-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    font-weight: bold;
    color: var(--color-text);
}

.required {
    color: var(--color-error);
}

.field-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
    font-style: italic;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

textarea {
    resize: vertical;
    min-height: 150px;
}

/* File upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-upload:hover {
    border-color: var(--color-secondary);
    background: rgba(201, 168, 76, 0.05);
}

.file-upload input[type="file"] {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    display: block;
    font-size: 2rem;
    color: var(--color-secondary);
    margin-bottom: 0.5rem;
}

.file-upload-text {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.photo-previews {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.photo-previews .preview {
    position: relative;
    width: 100px;
    height: 100px;
}

.photo-previews .preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.photo-previews .preview .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-error);
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Admin panel ---- */
.admin-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--color-secondary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: bold;
}

.admin-summary {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.btn-danger {
    background: var(--color-error);
    color: #fff;
}

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

.btn-small {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

.inline-form {
    display: inline;
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.admin-email {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    display: block;
}

.admin-photos {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.admin-photo-item {
    position: relative;
    display: inline-block;
}

.admin-photo-item img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

.btn-delete-photo {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-error);
    color: #fff;
    border: 2px solid #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-photo:hover {
    background: #A93226;
}

.admin-meta {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    body { font-size: 16px; }

    .hero h1 { font-size: 1.8rem; }

    .hero-carousel-wrapper {
        max-width: 240px;
    }

    .hero-carousel {
        width: 240px;
        height: 240px;
    }

    .caption-age { font-size: 1.1rem; }
    .caption-year { font-size: 0.95rem; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-form .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .login-form input[type="password"] {
        max-width: 100%;
    }

    .message-header {
        flex-direction: column;
        gap: 0.25rem;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .message-photos img {
        width: 90px;
        height: 68px;
    }

    .admin-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
