* {
    box-sizing: border-box;
}

/* Améliore le tactile sur mobile */
a, button {
    -webkit-tap-highlight-color: rgba(20, 105, 105, 0.15);
}

button {
    touch-action: manipulation;
}

body {
    font-family: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f6f2 0%, #ebe8e0 100%);
}

/* Login page - Bistrot du Palais */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #f5f3ef 0%, #e8e4dc 50%, #ddd9d0 100%);
}

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

.login-card {
    background: #fff;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(20, 105, 105, 0.15), 0 2px 12px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.login-brand {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #85714C;
    margin: 0 0 0.5rem;
}

.login-card h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 600;
    color: #146969;
    margin: 0 0 0.25rem;
}

.login-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.9rem;
    color: #888;
    margin: 0 0 2rem;
}

.login-card .form-group {
    text-align: left;
}

.login-card .btn {
    margin-top: 0.5rem;
}

/* Form container */
.container {
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(20, 105, 105, 0.08);
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.form-header h1 {
    margin: 0;
    color: #146969;
    font-size: 1.5rem;
}

.btn-logout {
    font-size: 0.85rem;
    color: #85714C;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #f5f3ef;
}

.display-hours-info {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: #f8f6f2;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #555;
}

.display-hours-info p {
    margin: 0 0 0.5rem;
}

.display-hours-info ul {
    margin: 0;
    padding-left: 1.25rem;
}

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

label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.form-group small {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #888;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: #146969;
    box-shadow: 0 0 0 3px rgba(20, 105, 105, 0.1);
}

.btn {
    display: block;
    width: 100%;
    padding: 0.9rem 1rem;
    background: #146969;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: #0f5252;
}

.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.error {
    background: #ffebee;
    color: #c62828;
}

.preview {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: 8px;
    background: #faf9f7;
    border: 1px solid #eee;
}

.preview h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: #666;
    font-weight: 600;
}

.preview-links {
    margin-bottom: 1rem;
}

.preview-links a {
    color: #146969;
    text-decoration: none;
    font-size: 0.9rem;
}

.preview-links a:hover {
    text-decoration: underline;
}

.preview-links span {
    color: #ccc;
    margin: 0 0.5rem;
}

/* Liste des menus programmés */
.menus-list {
    margin-bottom: 2rem;
}

.menus-list h2,
.form-section h2 {
    font-size: 1rem;
    color: #666;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.menus-empty {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
}

.menus-dates {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menus-dates li {
    margin-bottom: 0.5rem;
}

.menu-date-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #faf9f7;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    border: 1px solid #eee;
    transition: all 0.2s;
    min-height: 44px;
}

.menu-date-link:hover {
    background: #f5f3ef;
    border-color: #146969;
}

.menu-date-link.active {
    background: rgba(20, 105, 105, 0.08);
    border-color: #146969;
}

.menu-date {
    font-weight: 600;
    color: #146969;
}

.menu-preview {
    font-size: 0.9rem;
    color: #85714C;
}

.form-section {
    margin-bottom: 2rem;
}

/* Date picker rapide */
.date-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.date-btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #146969;
    background: #f5f3ef;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.date-btn:hover {
    background: rgba(20, 105, 105, 0.1);
    border-color: #146969;
}

.date-btn.active {
    background: #146969;
    color: #fff;
    border-color: #146969;
}

.date-hint {
    font-size: 0.85rem;
    color: #888;
    margin: 0 0 0.5rem;
}

.date-input {
    margin-top: 0.25rem;
}

#current-menu p {
    margin: 0.4rem 0;
    color: #333;
}

#current-menu strong {
    color: #146969;
    font-weight: 600;
}

/* ========== Responsive Mobile ========== */
@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }

    .container {
        padding: 1.25rem;
        border-radius: 10px;
    }

    .form-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .form-header h1 {
        font-size: 1.25rem;
        flex: 1;
        min-width: 0;
    }

    .btn-logout {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .display-hours-info {
        padding: 0.875rem 1rem;
        font-size: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .display-hours-info ul {
        padding-left: 1rem;
    }

    .menus-list {
        margin-bottom: 1.5rem;
    }

    .menus-list h2,
    .form-section h2 {
        font-size: 0.95rem;
    }

    .menu-date-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.75rem 1rem;
        min-height: 44px;
    }

    .menu-preview {
        font-size: 0.85rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .date-quick-actions {
        gap: 0.5rem;
    }

    .date-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    input[type="text"],
    input[type="password"],
    input[type="date"] {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Évite le zoom iOS */
        min-height: 44px;
    }

    .btn {
        padding: 1rem;
        font-size: 1rem;
        min-height: 48px;
    }

    .preview {
        padding: 1rem;
        margin-top: 1.25rem;
    }

    .preview h2 {
        font-size: 0.95rem;
    }

    .preview-links a {
        display: inline-block;
        padding: 0.5rem 0;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 1rem;
    }

    .form-header h1 {
        font-size: 1.15rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .login-card h1 {
        font-size: 1.9rem;
    }
}

/* Safe area pour encoches (iPhone X+) */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
}
