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

body {
    background-color: #0d1b2e;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 8px 20px;
    color: #111;
    overflow-x: hidden;
}

body:not(.accueil)::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url('../img/station-nuit.png') center/cover no-repeat;
    opacity: 0.07;
    filter: blur(3px);
    pointer-events: none;
}

body:not(.accueil)::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at center top, rgba(139, 0, 0, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, rgba(13, 27, 46, 0.4) 0%, rgba(13, 27, 46, 0.9) 100%);
    pointer-events: none;
}

/* ============================================
   TOOLBAR (mode edition)
   ============================================ */
.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #111;
    color: #ccc;
    padding: 10px 24px;
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    border-bottom: 2px solid #c0392b;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.toolbar.rendered { display: flex; }

.toolbar-title {
    font-weight: 700;
    color: #e74c3c;
    margin-right: auto;
    font-size: 15px;
}

.toolbar button {
    background: #333;
    color: #ddd;
    border: 1px solid #555;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: all 0.2s;
}

.toolbar button:hover {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}

.toolbar button.active {
    background: #c0392b;
    color: #fff;
    border-color: #e74c3c;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #444;
}

/* ============================================
   PANNEAU PRINCIPAL
   ============================================ */
.menu-board {
    width: 700px;
    max-width: 100%;
    margin-top: 4px;
    position: relative;
    background: linear-gradient(160deg, #6b5a45 0%, #7a6b55 20%, #6b5c47 50%, #5e5040 80%, #4d4234 100%);
    border-radius: 6px;
    padding: 10px;
    box-shadow:
        0 0 0 3px #3d3428,
        0 0 0 5px #2a2219,
        0 8px 32px rgba(0,0,0,0.7),
        0 0 80px rgba(0, 0, 0, 0.25);
    animation: boardFadeIn 0.6s ease-out;
}

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

.inner-board {
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, #f5f0e6 0%, #f0e9d8 100%);
    border-radius: 3px;
    padding: 8px 14px 6px;
    border: 1px solid rgba(0,0,0,0.3);
}

/* ============================================
   EN-TETE
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 2px;
}

.logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1px;
}

.logo-img {
    width: 44px;
    height: auto;
    flex-shrink: 0;
    border-radius: 4px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.station-title {
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 24px;
    color: #0d2347;
    letter-spacing: 2px;
    text-transform: uppercase;
    line-height: 1;
}

.station-stars {
    color: #c0392b;
    font-size: 12px;
    letter-spacing: 5px;
    line-height: 1;
}

.station-subtitle {
    font-family: 'Segoe UI', sans-serif;
    font-size: 11px;
    font-style: italic;
    color: #555;
}

.main-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 6px 16px;
    background: linear-gradient(135deg, #8b0000 0%, #a01010 50%, #8b0000 100%);
    border-radius: 3px;
}

.main-title-logo {
    width: 48px;
    height: auto;
    flex-shrink: 0;
    border-radius: 4px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.main-title h2 {
    font-family: 'Segoe UI', sans-serif;
    font-size: 15px;
    color: #fff;
    letter-spacing: 3px;
    font-weight: 800;
    text-transform: uppercase;
}

/* ============================================
   LIGNES PRODUITS (partage produits + entreprises)
   ============================================ */
.product-list {
    list-style: none;
}

.product-row {
    display: flex;
    align-items: baseline;
    padding: 1px 6px;
    font-size: 15px;
    line-height: 1.3;
    position: relative;
}

.product-row:nth-child(even) { background: rgba(13, 35, 71, 0.035); }
.product-row:hover { background: rgba(13, 35, 71, 0.06); }

.product-name {
    flex: 0 1 auto;
    min-width: 0;
    color: #111;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dot-leader {
    flex: 1;
    border-bottom: 1px dotted rgba(0, 0, 0, 0.25);
    min-width: 10px;
    margin: 0 4px;
    position: relative;
    bottom: 3px;
}

.product-price {
    flex: 0 0 auto;
    color: #8b0000;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    font-weight: 800;
    font-size: 15px;
    text-align: right;
    white-space: nowrap;
    min-width: 60px;
}

/* ============================================
   MODE EDITION - COMMUN
   ============================================ */
.edit-mode .product-row {
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
}

.edit-mode .product-row:nth-child(even) { background: transparent; }

.edit-mode .product-row:hover {
    background: rgba(192, 57, 43, 0.08);
    outline: 1px dashed rgba(192, 57, 43, 0.3);
}

.edit-input {
    background: #fff;
    border: 1px solid #c0392b;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    outline: none;
}

.edit-input:focus {
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.25);
}

.edit-input-name { flex: 1; min-width: 60px; }
.edit-input-price { width: 80px; text-align: right; font-weight: 700; }

.edit-input-cat {
    background: rgba(255,255,255,0.95);
    border: 1px solid #fff;
    border-radius: 3px;
    padding: 2px 8px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #0d2347;
    text-align: center;
    letter-spacing: 3px;
    text-transform: uppercase;
    outline: none;
}

.row-actions {
    display: none;
    flex-shrink: 0;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
}

.edit-mode .product-row:hover .row-actions { display: flex; }

.row-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    line-height: 22px;
    text-align: center;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    flex-shrink: 0;
    transition: background 0.1s;
}

.row-action-btn.delete { background: #c0392b; color: #fff; }
.row-action-btn.delete:hover { background: #e74c3c; }

.add-btn {
    display: none;
    width: 100%;
    padding: 4px 0;
    margin-top: 2px;
    background: transparent;
    border: 1px dashed rgba(192, 57, 43, 0.3);
    border-radius: 3px;
    color: #c0392b;
    font-family: 'Segoe UI', sans-serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.add-btn:hover {
    background: rgba(192, 57, 43, 0.08);
    border-color: #c0392b;
}

.edit-mode .add-btn { display: block; }

.add-btn.large { margin-top: 6px; padding: 8px 0; }

.delete-btn {
    display: none;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 3px;
    background: #c0392b;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    line-height: 20px;
    text-align: center;
    padding: 0;
    flex-shrink: 0;
}

.delete-btn:hover { background: #e74c3c; }

/* ============================================
   PIED DE PAGE
   ============================================ */
.footer-section {
    margin-top: 4px;
    padding-top: 3px;
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg, transparent, #8b0000, transparent) 1;
    text-align: center;
}

.footer-brand {
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 15px;
    color: #0d2347;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.footer-slogan {
    font-family: 'Segoe UI', sans-serif;
    font-size: 10px;
    font-style: italic;
    color: #666;
    margin-top: 1px;
}

/* ============================================
   NAVIGATION INTER-PAGES
   ============================================ */
.page-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.page-nav a {
    display: inline-block;
    padding: 3px 12px;
    background: #0d2347;
    color: #f5f0e6;
    text-decoration: none;
    border-radius: 4px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.25s ease;
}

.page-nav a:hover {
    background: #1a3a6e;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 35, 71, 0.3);
}

.page-nav a.current {
    background: #8b0000;
    cursor: default;
    transform: none;
    box-shadow: none;
}

body.clean-mode .page-nav { display: none; }
body.clean-mode .menu-board { margin-top: 0; }

/* ============================================
   MODAL EXPORT/IMPORT
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #1e1e1e;
    color: #ddd;
    border-radius: 8px;
    padding: 24px;
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Arial, sans-serif;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    border: 1px solid #444;
}

.modal h3 { margin-bottom: 12px; color: #e74c3c; font-size: 16px; }

.modal textarea {
    flex: 1;
    min-height: 300px;
    background: #111;
    color: #0f0;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 8px 20px;
    border-radius: 4px;
    border: 1px solid #555;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Segoe UI', sans-serif;
}

.modal-actions .btn-primary { background: #c0392b; color: #fff; border-color: #c0392b; }
.modal-actions .btn-secondary { background: #333; color: #ddd; }
.modal-actions button:hover { opacity: 0.85; }

/* ============================================
   IMPRESSION / CAPTURE
   ============================================ */
@media print {
    @page { margin: 10mm; }
    body {
        background: #fff !important;
        padding: 0;
    }
    body::before, body::after { display: none !important; }
    .toolbar, .page-nav { display: none !important; }
    .menu-board {
        margin-top: 0;
        box-shadow: none;
        animation: none;
        width: 100%;
        max-width: 100%;
    }
    .inner-board {
        background: #f5f0e6 !important;
    }
    .add-btn, .row-actions, .delete-btn { display: none !important; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 740px) {
    body { padding: 16px 12px; }
    .menu-board { width: 100%; padding: 8px; margin-top: 8px; }
    .inner-board { padding: 10px 12px 8px; }
    .main-title { gap: 8px; padding: 5px 10px; }
    .main-title-logo { width: 38px; }
    .main-title h2 { font-size: 12px; letter-spacing: 2px; }
    .product-row { font-size: 14px; padding: 1px 6px; }
    .product-price { min-width: 52px; font-size: 14px; }
    .dot-leader { margin: 0 4px; bottom: 3px; }
    .footer-brand { font-size: 14px; }
    .footer-slogan { font-size: 10px; }
    .toolbar { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
    .toolbar-title { font-size: 13px; width: 100%; margin-right: 0; margin-bottom: 4px; }
}

@media (max-width: 480px) {
    body { padding: 10px 8px; }
    .toolbar { padding: 6px 8px; }
    .toolbar button { padding: 5px 10px; font-size: 12px; }
    .menu-board { padding: 6px; margin-top: 6px; }
    .inner-board { padding: 8px 8px 6px; }
    .main-title { gap: 6px; padding: 4px 8px; }
    .main-title-logo { width: 32px; }
    .main-title h2 { font-size: 10px; letter-spacing: 1px; }
    .product-row { font-size: 13px; }
    .product-price { min-width: 46px; font-size: 13px; }
    .edit-input-price { width: 60px; }
    .footer-section { margin-top: 5px; padding-top: 4px; }
    .footer-brand { font-size: 13px; letter-spacing: 2px; }
    .footer-slogan { font-size: 10px; }
}
