/* ==========================================================================
   1. VARIABLES & CONFIGURATION GENERALE
   ========================================================================== */
   :root {
    --background: #f6f7f9;
    --surface: #ffffff;
    --surface-soft: #fafafa;
    --border: #e7e9ed;
    
    --text: #17191c;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --primary: #17191c;
    --primary-hover: #30343a;

    --success: #16803c;
    --success-bg: #ecfdf3;
    --accent: #e53e3e;

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

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
}

/* ==========================================================================
   2. INTERFACE D'AUTHENTIFICATION (LOGIN / REGISTER)
   ========================================================================== */
.auth-body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #ffffff 0, #f6f7f9 45%, #eef0f3 100%);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-brand > div:last-child {
    text-align: left;
}

.auth-brand strong, .auth-brand span {
    display: block;
}

.auth-brand strong {
    font-size: 16px;
}

.auth-brand span {
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 34px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-header h1 {
    margin: 0;
    font-size: 27px;
    letter-spacing: -0.03em;
}

.auth-header p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-submit {
    width: 100%;
    height: 45px;
    margin-top: 3px;
}

.auth-footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-legal {
    text-align: center;
    margin: 20px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.logout-form {
    margin: 0;
}

.logout-form button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

/* ==========================================================================
   3. STRUCTURE DU PANEL D'ADMINISTRATION
   ========================================================================== */
.admin-layout {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 30px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { color: var(--text-secondary); font-size: 13px; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item span {
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background: #f2f3f5;
    color: var(--text);
}

.nav-item.active {
    background: #f0f1f3;
    color: var(--text);
    font-weight: 600;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.topbar {
    height: 68px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-restaurant {
    margin-right: auto;
    font-size: 14px;
    font-weight: 600;
}

.mobile-brand {
    display: none;
}

/* ==========================================================================
   4. STRUCTURE DES PAGES & COMPOSANTS D'ADMINISTRATION
   ========================================================================== */
.page-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 42px 40px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.03em;
}

.page-description {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 15px;
}

/* --- BOUTONS --- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 15px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border 0.15s ease, transform 0.1s ease;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    background: var(--primary);
    color: white;
}

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

.button-secondary {
    background: white;
    border-color: var(--border);
    color: var(--text);
}

.button-secondary:hover {
    background: #f8f8f8;
}

.button-danger {
    background: var(--accent);
    color: white;
}

.button-danger:hover {
    background: #c53030;
}

.button-small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

/* --- GRILLES DE STATISTIQUES & ALERTES --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.stat-value {
    display: block;
    font-size: 30px;
    letter-spacing: -0.03em;
}

.stat-description {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.stat-status {
    display: block;
    color: var(--success);
    font-size: 20px;
    margin-bottom: 7px;
}

.stat-card-highlight a {
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
}

.alert {
    padding: 11px 13px;
    border-radius: 9px;
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid #b7ebc6;
    color: var(--success);
}

.alert-danger, .alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* --- CARDS & GRILLE DE PHOTOS D'ADMINISTRATION --- */
.content-card, .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header, .section-header {
    padding: 22px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    margin: 0;
    font-size: 17px;
}

.card-header p, .card-header .muted {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.card-header a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
}

.section-header {
    border-bottom: none;
    padding-bottom: 0;
}

.photo-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.photo-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
}

.photo-placeholder {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #f0f1f3, #e5e7eb);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 13px;
}

.photo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card-body, .photo-card-content {
    padding: 13px 14px;
}

.photo-card-body h3, .photo-card-content strong {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
}

.photo-card-body p, .photo-card-content span {
    font-size: 12px;
    color: var(--text-secondary);
}

.photo-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.status-published { 
    background: var(--success-bg); 
    color: var(--success); 
}

.status-hidden { 
    background: #fee2e2; 
    color: var(--accent); 
}

.empty-state {
    padding: 70px 30px;
    text-align: center;
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 14px;
}

.empty-state h3 {
    margin: 0 0 7px;
    font-size: 17px;
}

.empty-state p {
    margin: 0 auto 22px;
    max-width: 420px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- FORMULAIRES DE CONFIGURATION & TABLE DE LA CARTE --- */
.form-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;gap: 7px;
}

.form-group-full {
    grid-column: span 2;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #dfe2e7;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input::placeholder {
    color: #b0b4bb;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

.restaurant-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.logo-upload-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    grid-column: 1 / -1;
}

.logo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.logo-placeholder-icon {
    font-size: 1.8rem; 
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th, .admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.95rem;
}

.admin-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 700;
}

.price-tag {
    font-weight: bold;
    color: #2f855a;
}

.allergen-info {
    font-size: 0.85rem;
    background: #edf2f7;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #4a5568;
}

/* ==========================================================================5. ETATS, TRANSITIONS HTMX & CHARGEMENTS========================================================================== */
.photo-card.htmx-swapping {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
    background: #fff5f5;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); background: #f0fff4; }
    to { opacity: 1; transform: translateY(0) scale(1); background: white; }
}

.new-photo-animation {
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes highlightNewRow {
    from { background: #f0fff4; transform: translateX(-10px); opacity: 0; }
    to { background: transparent; transform: translateX(0); opacity: 1; }
}

.new-dish-animation {
    animation: highlightNewRow 0.5s ease-out forwards;
}

.container-loader {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.loader-spinner {
    font-size: 0.9rem;
    color: #3182ce;
    font-weight: 500;
}

.htmx-indicator { 
    display: none; 
}

.htmx-request.htmx-indicator { 
    display: inline-block; 
}

.htmx-request[type="submit"] { 
    opacity: 0.6; pointer-events: none; 
}

/* ==========================================================================6. DESIGNS EXCLUSIFS DU RENDU PUBLIC (RESPONSIVE LIVE FEED)========================================================================== */
.feed-container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.feed-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.restaurant-logo {
    width: 90px;
    height: 90px;border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    border: 3px solid #fff;
}

.restaurant-logo img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.feed-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 0.5rem;
}

.restaurant-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

.feed-grid {
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.feed-card {
    background: var(--surface);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    border: 1px solid #edf2f7;
    transition: transform 0.3s ease;
}

.feed-card:hover { 
    transform: translateY(-5px); 
}

.image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 11;
    background: #edf2f7;overflow: hidden;
}

.image-wrapper img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.card-details { 
    padding: 1.75rem; 
}

.freshness-badge {
    display: inline-flex;
    align-items: center;
    background: #fff5f5;
    color: var(--accent);
    font-size: 1rem;
    font-weight: 700;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    margin-bottom: 1rem;
    border: 1px solid #fed7d7;
}

.freshness-badge span { 
    margin-right: 0.5rem; 
}

.card-details h2 { 
    font-size: 1.75rem; 
    font-weight: 800; 
    color: var(--primary); 
    margin: 0 0 0.75rem; 
}

.dish-desc { 
    font-size: 1.15rem; 
    color: var(--text-secondary); 
    margin: 0; 
    line-height: 1.6; 
}

.empty-feed { 
    text-align: center; 
    padding: 6rem 2rem; 
    color: #a0aec0; 
}

.empty-feed span { 
    font-size: 4rem; 
    display: block; 
    margin-bottom: 1rem; 
}

.feed-footer { 
    text-align: center; 
    padding: 3rem 1rem; 
    color: #a0aec0; 
    font-size: 0.85rem; 
    letter-spacing: 1px; 
    margin-top: auto; 
}

/* ==========================================================================7. MEDIA QUERIES & RESPONSIVITE COMPLETE========================================================================== */
@media (max-width: 800px) {
    .sidebar { display: none; }
    .admin-main { margin-left: 0; width: 100%; }
    .topbar { height: 60px; padding: 0 18px; }
    .mobile-brand { display: block; font-weight: 700; margin-right: auto; }
    .topbar-restaurant { display: none; }
    .page-content { padding: 28px 18px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    h1 { font-size: 27px; }
    .stats-grid, .photo-grid { grid-template-columns: 1fr; }
    .photo-grid { padding: 16px; }
    .card-header { padding: 18px; }
}

@media (max-width: 480px) {
    .auth-page { padding: 20px 16px; }
    .auth-card { padding: 27px 21px; border-radius: 16px; }
}

@media (min-width: 650px) {
    .feed-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 950px) {
    .feed-grid { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; padding: 3rem 2rem; }
    .feed-header h1 { font-size: 2.2rem; }
}

@media (min-width: 1024px) {
    .restaurant-grid-layout { grid-template-columns: 1fr 1.2fr; }
}

.back-link {
    display: inline-block;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.back-link:hover {
    text-decoration: underline;
}

.restaurant-context {
    color: #888;
    font-size: 1.1rem;
    margin-top: 4px;
}

.like-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.like-btn:hover {
    background: #e5e7eb;
}

.like-btn.liked {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.login-prompt {
    font-size: 0.8rem;
    color: #dc2626;
    font-weight: bold;
    animation: fadeIn 0.3s;
}

.dish-gallery-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease;
}

.dish-gallery-link:hover {
    color: #ff4757; /* Ou la couleur principale de votre charte Freshness Feed */
}

.gallery-arrow {
    font-size: 0.85em;
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.2s ease;
}

.dish-gallery-link:hover .gallery-arrow {
    opacity: 1;
    transform: translateX(0);
}

.reaction-block {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px;
    border-radius: 30px;
    gap: 8px;
}

.vote-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover de base */
.vote-btn.like:hover { background: #e6f4ea; transform: scale(1.1); }
.vote-btn.dislike:hover { background: #fce8e6; transform: scale(1.1); }

/* États actifs colorés */
.vote-btn.like.active-like {
    background: #34a853; /* Vert Émeraude */
    box-shadow: 0 2px 6px rgba(52, 168, 83, 0.4);
    filter: brightness(1);
}
.vote-btn.dislike.active-dislike {
    background: #ea4335; /* Rouge Corail */
    box-shadow: 0 2px 6px rgba(234, 67, 53, 0.4);
    filter: brightness(1);
}

/* Compteur de score dynamique */
.score-counter {
    font-weight: 700;
    font-size: 0.95rem;
    color: #64748b;
    min-width: 20px;
    text-align: center;
}
.score-counter.positive { color: #1e7e34; }
.score-counter.negative { color: #bd2130; }

.login-prompt {
    font-size: 0.75rem;
    color: #ea4335;
    font-weight: bold;
    padding: 4px 8px;
}

.menu-banner-section {
    padding: 20px;
    background: #ffffff;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.menu-banner-section h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #1e293b;
}
.menu-scroll-wrapper {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
}
.menu-dish-card {
    flex: 0 0 280px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}
.dish-main-info h3 {
    font-size: 1.05rem;
    margin: 0 0 4px 0;
}
.dish-main-info h3 a {
    color: #0f172a;
    text-decoration: none;
}
.dish-main-info h3 a:hover {
    color: #34a853;
}
.dish-price {
    font-weight: 700;
    color: #64748b;
    font-size: 0.9rem;
}
.menu-vote-wrapper {
    align-self: flex-start;
}
