/* Import Bootstrap CSS */
@import url('https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css');

/* ── CSS Variables for theming ── */
:root {
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --text-body: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --card-transition: 0.25s ease-in-out;
    --primary-color: #198754;
    --primary-hover: #157347;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ── Dark mode (auto OR manual via data-theme="dark") ── */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-body: #1a1a2e;
        --bg-card: #16213e;
        --text-body: #e4e6eb;
        --text-muted: #b0b3b8;
        --border-color: #3a3b3c;
        --shadow-color: rgba(0, 0, 0, 0.4);
        --success-bg: #064e3b;
        --success-text: #a7f3d0;
    }
}

[data-theme="dark"] {
    --bg-body: #1a1a2e;
    --bg-card: #16213e;
    --text-body: #e4e6eb;
    --text-muted: #b0b3b8;
    --border-color: #3a3b3c;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --success-bg: #064e3b;
    --success-text: #a7f3d0;
}

/* Shared dark mode rules */
[data-theme="dark"] body { background-color: var(--bg-body); color: var(--text-body); }

[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .page-link,
[data-theme="dark"] .breadcrumb-item.active,
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-card) !important;
    color: var(--text-body) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select { background-color: #0f1a2e !important; }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus { background-color: #1a2a40 !important; }
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .bg-light { background-color: #0f1a2e !important; }
[data-theme="dark"] .badge.bg-light { background-color: #2a3a50 !important; color: #e4e6eb !important; }
[data-theme="dark"] .alert-info { background-color: #1a3a4e; color: #a8d8ea; border-color: #2a5a7e; }
[data-theme="dark"] .card-footer { background-color: #0f1a2e !important; border-top-color: var(--border-color); }
[data-theme="dark"] img { opacity: 0.9; transition: opacity 0.2s; }
[data-theme="dark"] img:hover { opacity: 1; }

/* Dark mode — badges that use bg-white / text-dark (filter chips, category badges) */
[data-theme="dark"] .badge.bg-white,
[data-theme="dark"] a.badge.bg-white {
    background-color: #2a3a50 !important;
    color: #e4e6eb !important;
    border-color: #3a4a60 !important;
}
[data-theme="dark"] .text-dark { color: var(--text-body) !important; }
[data-theme="dark"] .ingredient-row:hover { background-color: #1e2d42 !important; }
[data-theme="dark"] .skeleton,
[data-theme="dark"] img[loading="lazy"]:not([src]) {
    background: linear-gradient(90deg, #1e2d42 25%, #16213e 50%, #1e2d42 75%) !important;
    background-size: 200% 100% !important;
}
[data-theme="dark"] .placeholder-img {
    background: linear-gradient(135deg, #1e2d42 0%, #16213e 100%) !important;
}
[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #0d2a1a 0%, #0f3a24 40%, #124a2e 100%) !important;
}

/* Also apply via media query for auto mode (when data-theme is not set) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
    }
    :root:not([data-theme="light"]) body { background-color: var(--bg-body); }

    :root:not([data-theme="light"]) .card,
    :root:not([data-theme="light"]) .modal-content,
    :root:not([data-theme="light"]) .list-group-item,
    :root:not([data-theme="light"]) .form-control,
    :root:not([data-theme="light"]) .form-select,
    :root:not([data-theme="light"]) .page-link,
    :root:not([data-theme="light"]) .breadcrumb-item.active,
    :root:not([data-theme="light"]) .dropdown-menu {
        background-color: var(--bg-card) !important;
        color: var(--text-body) !important;
        border-color: var(--border-color) !important;
    }

    :root:not([data-theme="light"]) .form-control,
    :root:not([data-theme="light"]) .form-select {
        background-color: #0f1a2e !important;
    }

    :root:not([data-theme="light"]) .form-control:focus,
    :root:not([data-theme="light"]) .form-select:focus {
        background-color: #1a2a40 !important;
    }

    :root:not([data-theme="light"]) .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
    :root:not([data-theme="light"]) .text-muted { color: var(--text-muted) !important; }

    :root:not([data-theme="light"]) .bg-light { background-color: #0f1a2e !important; }

    :root:not([data-theme="light"]) .badge.bg-light {
        background-color: #2a3a50 !important;
        color: #e4e6eb !important;
    }

    :root:not([data-theme="light"]) .alert-info {
        background-color: #1a3a4e;
        color: #a8d8ea;
        border-color: #2a5a7e;
    }

    :root:not([data-theme="light"]) .card-footer {
        background-color: #0f1a2e !important;
        border-top-color: var(--border-color);
    }

    :root:not([data-theme="light"]) img {
        opacity: 0.9;
        transition: opacity 0.2s;
    }

    :root:not([data-theme="light"]) img:hover { opacity: 1; }

    :root:not([data-theme="light"]) .badge.bg-white,
    :root:not([data-theme="light"]) a.badge.bg-white {
        background-color: #2a3a50 !important;
        color: #e4e6eb !important;
        border-color: #3a4a60 !important;
    }
    :root:not([data-theme="light"]) .text-dark { color: var(--text-body) !important; }
    :root:not([data-theme="light"]) .ingredient-row:hover { background-color: #1e2d42 !important; }
    :root:not([data-theme="light"]) .skeleton {
        background: linear-gradient(90deg, #1e2d42 25%, #16213e 50%, #1e2d42 75%) !important;
        background-size: 200% 100% !important;
    }
    :root:not([data-theme="light"]) .hero-section {
        background: linear-gradient(135deg, #0d2a1a 0%, #0f3a24 40%, #124a2e 100%) !important;
    }
}

/* ── General Styles ── */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Arial', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-body);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

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

@media (min-width: 768px) {
    .container { padding: 20px; }
}

/* ── Navbar ── */
.navbar-brand { letter-spacing: 0.5px; }
.navbar .nav-link { 
    border-radius: var(--radius-sm);
    transition: background-color 0.15s;
    margin: 0 2px;
}
.navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.navbar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
}

/* ── Card Styles ── */
.card {
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    transition: transform var(--card-transition), box-shadow var(--card-transition);
    background-color: var(--bg-card);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px var(--shadow-color);
}

.card-img-wrapper {
    position: relative;
    overflow: hidden;
    background: #e9ecef;
}

.card-img-wrapper img {
    transition: transform 0.3s ease;
}

.card-img-wrapper:hover img {
    transform: scale(1.05);
}

.card-body { padding: 20px; }

.card-title {
    font-size: 1.15rem;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

.card-title a {
    color: var(--text-body);
}

.card-title a:hover {
    color: var(--primary-color);
}

.card-text { color: var(--text-muted); }

.card-header {
    font-weight: 600;
    background-color: rgba(0,0,0,0.02);
    border-bottom: 1px solid var(--border-color);
}

.card-footer {
    background-color: rgba(0,0,0,0.02);
    border-top: 1px solid var(--border-color);
}

/* ── Form Styles ── */
.form-group { margin-bottom: 15px; }

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: border-color 0.15s, box-shadow 0.15s;
    background-color: var(--bg-card);
    color: var(--text-body);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}

.btn {
    border-radius: 8px;
    transition: all 0.15s ease;
    font-weight: 500;
}

.btn-lg { border-radius: 10px; }

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

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

/* ── Ingredient Manager Styles ── */
#ingredient-list {
    min-height: 60px;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out;
}

#ingredient-list:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.15);
}

.ingredient-row {
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.ingredient-row:hover { background-color: #f8f9fa; }

.ingredient-row.optional { opacity: 0.65; }

.ingredient-row .drag-handle {
    cursor: grab;
    font-size: 1.1rem;
    user-select: none;
}

.ingredient-row .drag-handle:active { cursor: grabbing; }

.ingredient-row .ingredient-name {
    font-weight: 500;
    min-width: 120px;
}

.ingredient-row .quantity-input { width: 80px; }
.ingredient-row .unit-select { width: 90px; }
.ingredient-row .prep-note { width: 130px; }

/* Suggestions dropdown */
#ingredient-suggestions.dropdown-menu {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#ingredient-suggestions.dropdown-menu .dropdown-item {
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    font-size: 0.95rem;
}

#ingredient-suggestions.dropdown-menu .dropdown-item:hover,
#ingredient-suggestions.dropdown-menu .dropdown-item.active {
    background-color: #19875422;
    color: #155724;
}

/* ── Nutrition Panel ── */
.nutrition-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.nutrition-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Cooking Timer ── */
#cooking-timer-display {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 3px;
    min-width: 120px;
}

/* ── Serving Scaler ── */
#serving-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

#serving-input::-webkit-inner-spin-button,
#serving-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Recipe Detail Page ── */
.recipe-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #146c43 100%);
    color: white;
    padding: 2rem 0;
    margin-top: -16px;
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.recipe-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

/* ── Footer ── */
footer {
    margin-top: auto;
}

footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.15s, opacity 0.15s;
}

footer a:hover {
    color: white;
    opacity: 1 !important;
    text-decoration: none;
}

footer .opacity-75 { opacity: 0.75; }
footer .opacity-75:hover { opacity: 1 !important; }

/* ── Print Styles ── */
@media print {
    .navbar,
    .btn,
    #cooking-timer-minutes,
    #cooking-timer-start,
    #cooking-timer-reset,
    #unit-converter,
    #print-recipe,
    .breadcrumb {
        display: none !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
        break-inside: avoid;
    }
    body { background: white; }
    .container { max-width: 100%; padding: 0; }
}

/* ── Dietary & Badge Enhancements ── */
.badge-difficulty {
    font-size: 0.85rem;
    padding: 0.35em 0.65em;
}

.badge-dietary { font-size: 0.8rem; }

/* ── Ingredient list in view mode ── */
#ingredient-list-display .list-group-item {
    border-left: none;
    border-right: none;
    padding: 0.6rem 0;
}

#ingredient-list-display .list-group-item:first-child { border-top: none; }
#ingredient-list-display .ingredient-name { font-weight: 400; }

/* ── Estilos para placeholder de imágenes ── */
.placeholder-img {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-radius: 0;
}

/* ── Animaciones ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ── Responsive Styles ── */
@media (max-width: 575.98px) {
    .container { padding: 12px; }
    
    .card-title { font-size: 1rem; }
    
    .recipe-header { padding: 1.5rem 0; }
    
    .recipe-meta { gap: 0.5rem; }
    .recipe-meta-item { 
        padding: 0.4rem 0.8rem; 
        font-size: 0.85rem;
    }
}

@media (max-width: 767.98px) {
    .card img { height: auto; }
    .ingredient-row { flex-wrap: wrap; }
    .ingredient-row .ingredient-name {
        min-width: 100%;
        margin-bottom: 0.3rem;
    }
    
    .pagination .page-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .row-cols-md-2 .card-img-wrapper { height: 180px; }
}

/* ── Accessibility ── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Focus visible para teclado */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .card:hover { transform: none; }
    .card-img-wrapper:hover img { transform: none; }
}

/* ── Footer hover links ── */
footer a.text-light,
footer a.text-muted {
    transition: opacity 0.15s, color 0.15s;
}
footer a.text-light:hover {
    opacity: 1 !important;
    color: #a7f3d0 !important;
}
footer a.text-muted:hover {
    color: #d1fae5 !important;
}

/* ── Stats bar en hero ── */
.hero-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ── Compartir dropdown ── */
.share-badge {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Mejor look para badges en hero ── */
.hero-section .badge {
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.hero-section .badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* ── Filtros avanzados chips hover ── */
.border-bottom.bg-light a.badge:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
    transition: all 0.15s;
}

/* ── Recipe card title truncado a 2 líneas ── */
.recipe-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    min-height: 2.7em;
}

/* ── Nutrición tarjetas ── */
.nutrition-card {
    transition: transform 0.15s;
}
.nutrition-card:hover {
    transform: translateY(-2px);
}

/* ── Back-to-top button ── */
#backToTop {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    transition: opacity 0.3s, transform 0.3s;
    font-size: 1.2rem;
}
#backToTop.visible {
    display: flex;
}
#backToTop:hover {
    transform: translateY(-2px);
}

/* ── Skeleton loading para cards ── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Mobile improvements ── */
@media (max-width: 575.98px) {
    /* Filtros horizontalmente scrollables */
    .border-bottom.bg-light .d-flex {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }
    .border-bottom.bg-light .d-flex::-webkit-scrollbar { display: none; }

    /* Recipe detail: imagen arriba a full width */
    .col-lg-5 img.img-fluid {
        max-height: 220px;
    }

    /* Botones de acción más grandes en touch */
    .btn { min-height: 44px; }

    /* Recetas populares: 1 columna en móvil muy pequeño */
    #popularGrid .col-lg-3 { flex: 0 0 100%; max-width: 100%; }

    /* Print icon oculto en mobile */
    button[onclick="window.print()"] { display: none !important; }
}

/* ── Toast notifications ── */
.toast-container-bottom {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 1100;
}

/* ═══════════════════════════════════════════════════
   MEJORAS v12 — Design System actualizado
   ═══════════════════════════════════════════════════ */

/* ── Image lazy-load shimmer ── */
img[loading="lazy"] {
    transition: opacity 0.3s ease;
}
img[loading="lazy"]:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
}

/* ── Cards más refinadas ── */
.recipe-card {
    border: none !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05) !important;
}
.recipe-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0,0,0,.13) !important;
}
.recipe-card .card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
}

/* ── Rating stars ── */
.star-rating {
    color: #f59e0b;
    font-size: .85rem;
    letter-spacing: -.5px;
}
.star-rating .text-muted {
    font-size: .78rem;
    letter-spacing: 0;
}

/* ── Navbar search bar ── */
.navbar-search-form .form-control {
    border-radius: 20px;
    padding-left: 1rem;
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.25);
    color: #fff;
    transition: background .2s, width .3s;
}
.navbar-search-form .form-control::placeholder { color: rgba(255,255,255,.7); }
.navbar-search-form .form-control:focus {
    background: rgba(255,255,255,.25);
    border-color: rgba(255,255,255,.5);
    box-shadow: 0 0 0 .2rem rgba(255,255,255,.15);
}

/* ── Hero gradient refinado ── */
.hero-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 40%, #bbf7d0 100%) !important;
    border-bottom: 1px solid rgba(25,135,84,.1);
}
@media (prefers-color-scheme: dark) {
    .hero-section {
        background: linear-gradient(135deg, #0d2a1a 0%, #0f3a24 40%, #124a2e 100%) !important;
    }
}

/* ── Featured recipe card ── */
.featured-recipe-card {
    border: 2px solid rgba(25,135,84,.15) !important;
    background: var(--bg-card);
}
.featured-recipe-card:hover {
    box-shadow: 0 20px 40px -10px rgba(25,135,84,.18) !important;
    border-color: rgba(25,135,84,.35) !important;
}

/* ── Category chips ── */
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all .15s;
    text-decoration: none;
    border: 1.5px solid transparent;
}
.category-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,.1);
}
.category-chip.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

/* ── Pagination mejorada ── */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    font-weight: 500;
    transition: all .15s;
}
.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ── Profile page ── */
.profile-avatar-initials {
    font-size: 2.5rem;
    font-weight: 700;
    width: 100px;
    height: 100px;
}
.profile-tab-content {
    min-height: 300px;
}

/* ── Dropdown mejorado ── */
.dropdown-menu {
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    border: 1px solid var(--border-color);
    padding: 8px;
}
.dropdown-item {
    border-radius: 6px;
    transition: background .1s;
}
.dropdown-item.text-danger:hover {
    background: #fef2f2;
}

/* ── Report modal ── */
#reportModal .modal-content {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: 0 24px 48px rgba(0,0,0,.2);
}

/* ── 404 page ── */
.error-404-emoji {
    font-size: 6rem;
    animation: bounce 1.5s infinite alternate ease-in-out;
}
@keyframes bounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-16px); }
}

/* ── Scroll-reveal animation ── */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .5s ease, transform .5s ease;
}
.reveal.revealed {
    opacity: 1;
    transform: none;
}

/* ── Breadcrumb refinado ── */
.breadcrumb {
    background: transparent;
    padding: .5rem 0;
    font-size: .88rem;
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1rem;
}

/* ── Table nutrición ── */
.nutrition-table td {
    padding: .4rem .75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: .9rem;
}
.nutrition-table td:first-child { color: var(--text-muted); }
.nutrition-table td:last-child { font-weight: 600; }

/* ── Sticky action bar en receta (mobile) ── */
@media (max-width: 767.98px) {
    .recipe-sticky-bar {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        padding: .75rem 1rem;
        z-index: 50;
    }
}

/* ── Mejoras extra footer ── */
footer .btn-outline-secondary {
    border-color: rgba(255,255,255,.25);
    color: rgba(255,255,255,.7);
}
footer .btn-outline-secondary:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-color: rgba(255,255,255,.5);
}

/* ═══════════════ CSS v13 — Interactive Recipe Elements ═══════════════ */

/* Toast notification */
.toast-notification {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #198754;
  color: #fff;
  padding: .6rem 1.4rem;
  border-radius: 2rem;
  font-size: .9rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast-notification.show { opacity: 1; }

/* No index.php in URL — handled via .htaccess redirect */

/* Recipe card image overlay */
.recipe-card .position-relative::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.12) 0%, transparent 60%);
  pointer-events: none;
}

/* Better login/register form */
.auth-card {
  max-width: 440px;
  margin: 3rem auto;
  border: none;
  border-radius: 1.25rem;
  box-shadow: 0 8px 32px -8px rgba(0,0,0,.15);
}

/* Ingredient panel compact on mobile */
@media (max-width: 767px) {
  #ingredients-list .list-group-item { padding: .4rem .75rem; }
  .step-num { min-width: 1.75rem; height: 1.75rem; font-size: .8rem; }
}

/* "Ir a la preparación" button animation */
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(25,135,84,.4); }
  50% { box-shadow: 0 0 0 6px rgba(25,135,84,0); }
}
.btn-outline-success.rounded-pill:hover {
  animation: pulse-border 1s ease-in-out;
}

/* ═══════════════════════════════════════════════════
   MEJORAS v14 — UX & Visual polish
   ═══════════════════════════════════════════════════ */

/* Category bar active state — más prominente */
#categoryBar .btn-success {
  box-shadow: 0 2px 8px rgba(25,135,84,.35);
  font-weight: 700;
}
#categoryBar .btn-outline-secondary:hover {
  border-color: #19875455;
  color: #198754;
}

/* Footer category directory links */
footer .row-cols-2 a:hover {
  opacity: 1 !important;
  color: #a7f3d0 !important;
  text-decoration: none;
}

/* Footer quick badges */
footer .badge.bg-secondary {
  opacity: .75;
  transition: opacity .15s, transform .15s;
}
footer .badge.bg-secondary:hover {
  opacity: 1;
  transform: translateY(-1px);
}

/* Quick time filter buttons in hero */
.hero-section .btn-outline-warning:hover,
.hero-section .btn-outline-info:hover,
.hero-section .btn-outline-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* Recipe card "Ver receta" CTA on hover */
.recipe-card::after {
  content: 'Ver receta →';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(to top, rgba(25,135,84,.9) 0%, transparent 100%);
  color: white;
  font-size: .82rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity .2s ease;
  border-radius: 0 0 1rem 1rem;
  pointer-events: none;
  text-align: center;
}
.recipe-card:hover::after { opacity: 1; }
.recipe-card { position: relative; }

/* Category filter active badge in results bar */
.results-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(25,135,84,.1);
  border: 1px solid rgba(25,135,84,.2);
  border-radius: 20px;
  font-size: .8rem;
  color: #198754;
  font-weight: 600;
}

/* Featured card — mejora del badge */
.featured-recipe-card .badge.bg-warning {
  box-shadow: 0 2px 8px rgba(255,193,7,.4);
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Category filter bar hide scrollbar */
#categoryBar::-webkit-scrollbar { display: none; }

/* ═══════════════════════════════════════════════════
   MEJORAS v16 — Navbar search, steps, sort UX
   ═══════════════════════════════════════════════════ */

/* ── Navbar search bar refinada ── */
.navbar-search-form .form-control {
  border-radius: 20px 0 0 20px !important;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.3);
  color: #fff;
  font-size: .85rem;
}
.navbar-search-form .form-control::placeholder { color: rgba(255,255,255,.65); }
.navbar-search-form .form-control:focus {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.6);
  box-shadow: none;
  color: #fff;
}
.navbar-search-form .btn-outline-light {
  border-radius: 0 20px 20px 0 !important;
  border-color: rgba(255,255,255,.3);
}
.navbar-search-form .btn-outline-light:hover {
  background: rgba(255,255,255,.15);
}
@media (max-width: 991.98px) {
  .navbar-search-form { min-width: unset !important; max-width: 100% !important; width: 100%; margin: .5rem 0 0 !important; }
}

/* ── Sort buttons — estado activo más visible ── */
.sort-btn-group a.btn-success {
  box-shadow: 0 2px 8px rgba(25,135,84,.4);
  font-weight: 700;
}

/* ── Recipe steps — step numbers refinados ── */
.step-num {
  min-width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(25,135,84,.3);
}

/* ── Ingredient done state ── */
.ingredient-done .ingredient-name {
  text-decoration: line-through;
  opacity: .5;
}
.ingredient-done .check-icon {
  color: #198754 !important;
}
.ingredient-done .check-icon::before {
  content: "\f26b" !important; /* bi-check-circle-fill */
}

/* ── Breadcrumb category link ── */
.breadcrumb-item a {
  color: var(--primary-color);
  text-decoration: none;
}
.breadcrumb-item a:hover {
  text-decoration: underline;
}

/* ── Print: ocultar navbar search en impresión ── */
@media print {
  .navbar-search-form { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   v17 — Badge Nueva, views count, footer quick searches,
          mobile card improvements, hero popular searches
   ══════════════════════════════════════════════════════════════ */

/* Badge "Nueva" pulsante */
.badge.bg-primary {
  animation: pulse-new 2s ease-in-out infinite;
}
@keyframes pulse-new {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* Contador de visitas en cards — discreta */
.recipe-card .card-footer small .bi-eye {
  font-size: .75rem;
}

/* Footer búsquedas rápidas — hover effect */
footer .badge:hover {
  opacity: .85;
  transform: translateY(-1px);
  transition: all .15s ease;
}

/* Hero popular searches chips — glow on active */
.badge.bg-success.text-white {
  box-shadow: 0 0 0 2px rgba(25,135,84,.3);
}

/* Category bar smooth scroll indicator en mobile */
#categoryBar {
  -webkit-overflow-scrolling: touch;
}
#categoryBar::-webkit-scrollbar { display: none; }

/* Recipe card — título truncado a 2 líneas siempre */
.recipe-card-title {
  min-height: 2.6em;
}

/* ── v18: Colecciones temáticas ─────────────────────────────── */
.collection-card {
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: pointer;
}
.collection-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px -6px rgba(0,0,0,.18) !important;
}

/* ── v18: Costo estimado ─────────────────────────────────────── */
.cost-card-inner {
  transition: transform .15s ease;
}
.cost-card-inner:hover {
  transform: scale(1.04);
}
