/* ============================================
   My Eco House - Styles principaux
   ============================================ */

:root {
    --primary: #8B4513;
    --primary-light: #A0522D;
    --primary-dark: #6B3410;
    --secondary: #D2691E;
    --accent: #F4A460;
    --bg: #FFF8F0;
    --bg-card: #FFFFFF;
    --bg-dark: #2C1810;
    --text: #3C2415;
    --text-light: #8B7355;
    --text-muted: #A89580;
    --border: #E8DDD0;
    --border-light: #F0E8DC;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #E53935;
    --shadow: 0 2px 8px rgba(60, 36, 21, 0.08);
    --shadow-lg: 0 8px 32px rgba(60, 36, 21, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Écran d'accès protégé (page publique) */
.public-login-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-dark) 50%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.public-login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.public-login-logo span {
    font-size: 3rem;
    display: block;
    margin-bottom: 8px;
}

.public-login-logo h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--primary-dark);
}

.public-login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.public-login-message {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    color: var(--text-light);
}

.public-login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-body);
    text-align: center;
    letter-spacing: 2px;
    transition: var(--transition);
}

.public-login-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.public-login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    margin-bottom: 8px;
}

.public-login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    margin-top: 16px;
    transition: var(--transition);
}

.public-login-btn:hover {
    background: var(--primary-dark);
}

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

/* ============================================
   Header
   ============================================ */

.main-header {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 16px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0,0,0,0.15);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    font-size: 2.2rem;
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo .subtitle {
    font-size: 0.8rem;
    opacity: 0.7;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: var(--transition);
}

.search-box input::placeholder {
    color: rgba(255,255,255,0.5);
}

.search-box input:focus {
    outline: none;
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    opacity: 0.5;
}

.btn-admin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.btn-admin:hover {
    background: rgba(255,255,255,0.2);
}

/* ============================================
   Catégories Nav
   ============================================ */

.categories-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: fixed;
    top: var(--header-height, 70px);
    left: 0;
    right: 0;
    z-index: 90;
}

.categories-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

/* Espace pour le contenu sous header + catégories fixés */
main.container {
    padding-top: calc(var(--header-height, 70px) + var(--categories-height, 52px));
}

.cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg);
    color: var(--text-light);
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

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

.cat-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cat-btn .cat-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.cat-btn.active .cat-count {
    background: rgba(255,255,255,0.2);
}

/* ============================================
   Grille de recettes
   ============================================ */

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px 0;
}

.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.recipe-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px;
    position: relative;
}

.recipe-card-header .category-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.recipe-card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
}

.recipe-card-body {
    padding: 16px 20px;
}

.recipe-card-body .description {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-card-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.meta-item .meta-icon {
    font-size: 1rem;
}

/* ============================================
   Détail de recette
   ============================================ */

.recipe-detail {
    padding: 30px 0;
    max-width: 900px;
    margin: 0 auto;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-body);
    cursor: pointer;
    margin-bottom: 24px;
    transition: var(--transition);
}

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

.recipe-header-detail {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 32px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.recipe-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.recipe-header-detail h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 8px;
}

.recipe-description {
    opacity: 0.9;
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 16px;
}

.recipe-infos {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.recipe-infos .info-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ============================================
   Calculateur de quantités
   ============================================ */

.quantity-calculator {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.calc-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

.calc-controls {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.calc-controls label span {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.qty-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-family: var(--font-body);
    color: var(--text);
}

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

.qty-input-group input {
    width: 80px;
    height: 40px;
    text-align: center;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--primary-dark);
}

.qty-input-group input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(139,69,19,0.1);
}

.qty-unit {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-left: 8px;
    font-weight: 500;
}

.multiplier-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.multiplier-info strong {
    color: var(--primary);
}

.quick-multiply {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-multiply span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mult-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg);
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
}

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

.mult-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================
   Multi-produit
   ============================================ */

.products-calc {
    padding: 16px;
}

.products-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
}

.product-input-row.main {
    background: #FFF8F0;
    border-color: var(--accent);
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-weight {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.product-qty-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.product-qty-group .qty-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    padding: 0;
}

.product-qty-input {
    width: 56px;
    height: 32px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--primary);
    background: white;
    -moz-appearance: textfield;
}

.product-qty-input::-webkit-outer-spin-button,
.product-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-qty-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(230, 81, 0, 0.15);
}

.products-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-top: 12px;
    background: linear-gradient(135deg, #FFF8F0, #FFF3E0);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.products-total strong {
    font-size: 1.1rem;
    color: var(--primary);
}

/* ============================================
   Résumé poids
   ============================================ */

.weight-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #FFF8F0, #FFF3E0);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
}

.weight-item {
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.weight-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.weight-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    font-variant-numeric: tabular-nums;
}

.weight-total {
    color: var(--secondary);
    font-size: 1.5rem;
}

.total-row td {
    border-top: 2px solid var(--primary);
    padding-top: 12px;
    font-size: 1.05rem;
}

.total-row .qty-value {
    font-weight: 700;
    color: var(--primary-dark);
}

/* ============================================
   Table des ingrédients
   ============================================ */

.ingredients-section, .instructions-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.ingredients-section h3, .instructions-section h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

.allergen-legend {
    background: #FFF3E0;
    border: 1px solid #FFE0B2;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #E65100;
}

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

.ingredients-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
}

.ingredients-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.95rem;
}

.ingredients-table tr:last-child td {
    border-bottom: none;
}

.ingredients-table tr.allergen-row {
    background: #FFF8E1;
}

.ingredients-table .text-right {
    text-align: right;
}

.ingredients-table .qty-value {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

.ingredient-optional {
    color: var(--text-muted);
    font-style: italic;
}

.allergen-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #FFF3E0;
    color: #E65100;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   Instructions
   ============================================ */

.instructions-content {
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
}

/* ============================================
   Loading / Empty states
   ============================================ */

.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* ============================================
   Footer
   ============================================ */

.main-footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    font-size: 0.85rem;
}

/* ============================================
   Boutons communs
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

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

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

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ============================================
   Responsive - Tablette (mode fullscreen)
   Activé via la classe body.tablet-mode
   (détection auto tactile + interrupteur manuel)
   ============================================ */

/* Toggle tablette dans le header */
.tablet-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: var(--font-body);
}

.tablet-toggle .toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.tablet-toggle:hover {
    background: var(--primary);
    color: white;
}

.tablet-toggle.active {
    background: var(--primary);
    color: white;
}

/* Afficher le toggle sur écrans tactiles ou si forcé via JS */
body.show-tablet-toggle .tablet-toggle {
    display: inline-flex;
}

/* Mode tablette - Vue liste : ajustements spécifiques */

/* Mode fullscreen : la vue détail occupe tout l'écran */
body.tablet-mode.detail-open {
    overflow: hidden;
    height: 100vh;
    height: var(--real-vh, 100vh);
}

body.tablet-mode.detail-open .main-header {
    padding: 6px 0;
}

body.tablet-mode.detail-open .main-header .logo-icon {
    font-size: 1.5rem;
}

body.tablet-mode.detail-open .main-header .logo h1 {
    font-size: 1.1rem;
}

body.tablet-mode.detail-open .main-header .logo .subtitle {
    display: none;
}

body.tablet-mode.detail-open .main-header .search-box {
    display: none;
}

body.tablet-mode.detail-open .categories-nav {
    display: none;
}

body.tablet-mode.detail-open .main-footer {
    display: none;
}

body.tablet-mode.detail-open .container {
    max-width: 100%;
    padding: 0 10px;
}

body.tablet-mode.detail-open .recipe-detail {
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-width: 100%;
    height: calc(var(--real-vh, 100vh) - var(--header-height, 46px));
    margin-top: var(--header-height, 46px);
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}

body.tablet-mode.detail-open .recipe-detail > .btn-back {
    margin: 2px 0;
    padding: 2px 10px;
    font-size: 0.7rem;
    flex-shrink: 0;
}

body.tablet-mode.detail-open .recipe-header-detail {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    flex-shrink: 0;
}

body.tablet-mode.detail-open .recipe-header-detail h2 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

body.tablet-mode.detail-open .recipe-category-badge {
    padding: 2px 8px;
    font-size: 0.7rem;
    margin-bottom: 2px;
}

body.tablet-mode.detail-open .recipe-description {
    display: none;
}

body.tablet-mode.detail-open .recipe-infos {
    display: none;
}

/* Layout côte à côte : calculateur + ingrédients */
body.tablet-mode.detail-open .tablet-columns {
    display: flex;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.tablet-mode.detail-open .quantity-calculator {
    flex: 0 0 280px;
    padding: 8px;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

body.tablet-mode.detail-open .calc-header h3 {
    font-size: 0.9rem;
    margin-bottom: 4px;
}

body.tablet-mode.detail-open .calc-controls {
    gap: 6px;
    margin-bottom: 4px;
}

body.tablet-mode.detail-open .calc-controls label span {
    font-size: 0.75rem;
    margin-bottom: 2px;
}

body.tablet-mode.detail-open .qty-btn {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
}

body.tablet-mode.detail-open .qty-input-group input {
    width: 60px;
    height: 30px;
    font-size: 0.9rem;
}

body.tablet-mode.detail-open .multiplier-info {
    font-size: 0.72rem;
}

body.tablet-mode.detail-open .weight-summary {
    padding: 6px;
    margin: 4px 0;
    gap: 6px;
}

body.tablet-mode.detail-open .weight-item {
    min-width: 70px;
}

body.tablet-mode.detail-open .weight-label {
    font-size: 0.6rem;
}

body.tablet-mode.detail-open .weight-value {
    font-size: 0.85rem;
}

body.tablet-mode.detail-open .weight-total {
    font-size: 0.95rem;
}

body.tablet-mode.detail-open .quick-multiply {
    gap: 3px;
}

body.tablet-mode.detail-open .quick-multiply span {
    font-size: 0.7rem;
    display: none;
}

body.tablet-mode.detail-open .mult-btn {
    padding: 3px 8px;
    font-size: 0.7rem;
}

/* Multi-produit tablette */
body.tablet-mode.detail-open .products-calc {
    padding: 6px 8px;
}

body.tablet-mode.detail-open .products-label {
    font-size: 0.75rem;
    margin-bottom: 6px;
}

body.tablet-mode.detail-open .product-input-row {
    padding: 4px 8px;
    gap: 6px;
}

body.tablet-mode.detail-open .product-name {
    font-size: 0.78rem;
}

body.tablet-mode.detail-open .product-weight {
    font-size: 0.65rem;
}

body.tablet-mode.detail-open .product-qty-group .qty-btn {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
}

body.tablet-mode.detail-open .product-qty-input {
    width: 44px;
    height: 26px;
    font-size: 0.85rem;
}

body.tablet-mode.detail-open .products-total {
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 0.78rem;
}

body.tablet-mode.detail-open .products-total strong {
    font-size: 0.9rem;
}

body.tablet-mode.detail-open .ingredients-section {
    flex: 1;
    padding: 8px;
    margin-bottom: 0;
    border-radius: var(--radius-sm);
    overflow-y: auto;
    min-height: 0;
}

body.tablet-mode.detail-open .ingredients-section h3 {
    font-size: 0.9rem;
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
    padding: 4px 0;
}

body.tablet-mode.detail-open .allergen-legend {
    padding: 4px 8px;
    margin-bottom: 4px;
    font-size: 0.7rem;
}

body.tablet-mode.detail-open .ingredients-table {
    font-size: 0.8rem;
}

body.tablet-mode.detail-open .ingredients-table th {
    padding: 4px 6px;
    font-size: 0.65rem;
    position: sticky;
    top: 28px;
    background: var(--bg-card);
    z-index: 1;
}

body.tablet-mode.detail-open .ingredients-table td {
    padding: 3px 6px;
    font-size: 0.8rem;
}

body.tablet-mode.detail-open .ingredients-table .qty-value {
    font-size: 0.85rem;
}

/* Instructions en mode tablette : collées en bas */
body.tablet-mode.detail-open .instructions-section {
    flex-shrink: 0;
    padding: 6px 12px;
    margin-top: 4px;
    font-size: 0.8rem;
    max-height: 25vh;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}

body.tablet-mode.detail-open .instructions-section h3 {
    font-size: 0.85rem;
    margin-bottom: 2px;
}

body.tablet-mode.detail-open .instructions-content {
    font-size: 0.78rem;
    line-height: 1.35;
}

/* Grille tablette pour la liste */
body.tablet-mode .recipes-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    padding: 16px 0;
}

body.tablet-mode .recipe-card-header {
    padding: 14px;
}

body.tablet-mode .recipe-card-header h3 {
    font-size: 1.1rem;
}

body.tablet-mode .recipe-card-body {
    padding: 10px 14px;
}

/* ============================================
   Responsive - Mobile
   ============================================ */

@media (max-width: 600px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-box {
        width: 100%;
        order: 3;
    }
    
    .recipes-grid {
        grid-template-columns: 1fr;
    }
    
    .recipe-header-detail h2 {
        font-size: 1.5rem;
    }
    
    .calc-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .ingredients-table {
        font-size: 0.85rem;
    }
    
    .ingredients-table td, .ingredients-table th {
        padding: 8px;
    }

    .recipe-infos {
        flex-direction: column;
        gap: 8px;
    }

    .product-input-row {
        flex-wrap: wrap;
    }
    
    .product-info {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.2rem;
    }

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

    .recipe-header-detail {
        padding: 20px;
    }

    .quantity-calculator {
        padding: 16px;
    }
}
