/* --- STYLES GÉNÉRAUX --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.content {
    padding: 2rem 0;
}

/* --- HEADER & NAVIGATION --- */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav h1 a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: #34495e;
}

/* --- BOUTONS & BADGES --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.btn-edit { background-color: #f39c12; }
.btn-edit:hover { background-color: #e67e22; }

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

.btn-success { background-color: #27ae60; }
.btn-success:hover { background-color: #229954; }

.btn-secondary { background-color: #95a5a6; }
.btn-secondary:hover { background-color: #7f8c8d; }

.badge {
    background-color: #3498db;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: inline-block;
}

/* --- FORMULAIRES --- */
.form-container, .ingredient-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.help-text {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}


/* --- TABLES --- */
.table-container, .categories-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background-color: #f5f5f5;
}


/* --- MESSAGES & NOTIFICATIONS --- */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.welcome-message {
    background-color: #e8f4f8;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #3498db;
}

/* --- CARTES & GRILLES (Dashboard, Recettes, Fournisseurs) --- */
.stats-grid, .recipes-grid, .suppliers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.stat-card, .recipe-card, .supplier-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover, .recipe-card:hover, .supplier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-card {
    text-align: center;
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

/* --- FILTRES --- */
.filters {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* --- AMÉLIORATIONS POUR RECETTE_DETAIL --- */

.detail-grid-container {
    display: grid;
    grid-template-columns: 1fr 380px; /* Colonne principale et colonne latérale de 380px */
    gap: 2rem;
    align-items: flex-start;
}

.recipe-main-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recipe-sidebar {
    position: relative;
    align-self: start;
}

.recipe-sidebar .sidebar-sticky-stack {
    position: sticky;
    top: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-sidebar .summary-card {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
}

.recipe-sidebar .sticky-economic-card {
    position: relative;
    top: auto;
    z-index: auto;
    background-color: #f8f9fa;
}

.summary-card h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.summary-card .cost-grid {
    display: grid;
    grid-template-columns: 1fr; /* Une seule colonne pour la lisibilité */
    gap: 1rem;
}

.summary-card .cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}
.summary-card .cost-item:last-child {
    border-bottom: none;
}


.summary-card .cost-label {
    font-size: 0.9rem;
    color: #555;
}

.summary-card .cost-value {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}
.summary-card .cost-value.price {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Amélioration de la table des ingrédients */
.ingredients-table tbody tr:nth-child(odd) {
    background-color: #f8f9fa;
}

.ingredients-table td, .ingredients-table th {
    padding: 12px;
}

/* =========================================================
   MODE PC LARGE - surcharge d'affichage
   Application utilisée uniquement sur poste desktop
   ========================================================= */
body {
    min-width: 1360px;
    font-size: 15.5px;
}

.container {
    width: min(96vw, 1920px);
    max-width: 1920px;
    padding: 0 24px;
}

.content {
    padding: 2.25rem 0 2.75rem;
}

.header {
    padding: 0.9rem 0;
}

.nav {
    flex-wrap: nowrap;
    gap: 1rem;
}

.nav h1 {
    flex: 0 0 auto;
}

.nav-links {
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: thin;
}

.nav-links a {
    white-space: nowrap;
    padding: 9px 14px;
    font-size: 0.95rem;
}

.form-container,
.ingredient-form,
.table-container,
.categories-table,
.stat-card,
.recipe-card,
.supplier-card {
    border-radius: 12px;
}

.form-grid {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 1.1rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
}

.stats-grid,
.recipes-grid,
.suppliers-grid {
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.25rem;
}

.filters {
    flex-wrap: nowrap;
    justify-content: space-between;
}

.filters form {
    width: 100%;
}

.detail-grid-container {
    grid-template-columns: minmax(0, 1fr) 460px;
    gap: 2.25rem;
}

.recipe-main-content {
    padding: 2.25rem;
}

.recipe-sidebar .sidebar-sticky-stack {
    top: 24px;
}

table {
    font-size: 0.96rem;
}

th,
td {
    padding: 13px 16px;
}

.btn {
    padding: 10px 18px;
}

@media (min-width: 1600px) {
    .container {
        width: min(97vw, 2080px);
        max-width: 2080px;
    }

    .detail-grid-container {
        grid-template-columns: minmax(0, 1fr) 500px;
    }

    .stats-grid,
    .recipes-grid,
    .suppliers-grid {
        grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
    }
}
