/* ============================================
   RECETAS DEL MUNDO — Design System
   Fuente: Google Fonts (Noto Kufi Arabic + Outfit)
   Paleta: Coral + Dorado + Oscuro Profundo
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* === VARIABLES === */
:root {
    --primary:       #e8622a;
    --primary-light: #f58b5e;
    --primary-dark:  #c24a18;
    --secondary:     #f5a623;
    --accent:        #2ec4b6;
    --dark:          #1a1a2e;
    --dark-card:     #16213e;
    --surface:       #0f3460;
    --text-primary:  #1a1a2e;
    --text-secondary:#5a6275;
    --text-light:    #94a3b8;
    --bg:            #f7f8fc;
    --white:         #ffffff;
    --card-shadow:   0 8px 32px rgba(26,26,46,0.10);
    --card-shadow-h: 0 20px 48px rgba(26,26,46,0.18);
    --radius-sm:     8px;
    --radius-md:     14px;
    --radius-lg:     22px;
    --radius-xl:     32px;
    --transition:    0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --header-h:      72px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Kufi Arabic', 'Outfit', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 99px; }

/* ===========================
   HEADER / NAVBAR
   =========================== */
header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-card) 60%, var(--surface) 100%);
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 4px 24px rgba(26,26,46,0.22);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* Logo */
.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo img {
    height: 44px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(232,98,42,0.4));
}

/* Nav */
nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

nav ul li a,
nav ul li .admin-badge {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: var(--radius-xl);
    transition: all var(--transition);
    white-space: nowrap;
}

nav ul li a:hover {
    background: rgba(255,255,255,0.13);
    color: white;
    transform: translateY(-1px);
}

nav ul li a.active,
nav ul li a[href*="inicio"]:focus {
    background: rgba(232,98,42,0.25);
    color: var(--secondary);
}

.admin-badge {
    color: var(--secondary) !important;
    font-weight: 600;
    font-size: 14px !important;
    padding: 6px 12px !important;
    background: rgba(245,166,35,0.15);
    border-radius: var(--radius-xl);
}

.btn-logout {
    background: rgba(231,76,60,0.2) !important;
    color: #ff8a80 !important;
    border: 1px solid rgba(231,76,60,0.35);
    padding: 7px 16px !important;
    border-radius: var(--radius-xl) !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(231,76,60,0.4) !important;
    color: white !important;
    transform: translateY(-1px) !important;
}

/* Hamburger (mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition);
}

/* ===========================
   MAIN CONTAINER
   =========================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 36px 28px 60px;
}

/* ===========================
   PAGE TITLE
   =========================== */
.page-title {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 40px;
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.5px;
    position: relative;
    display: inline-block;
    width: 100%;
}

.page-title .emoji {
    font-size: 1.1em;
    margin-left: 8px;
}

.page-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
    margin: 12px auto 0;
}

/* ===========================
   COUNTRY SECTION (inicio)
   =========================== */
.pais-section {
    margin-bottom: 56px;
}

.pais-titulo {
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e8eaf0;
    position: relative;
}

.pais-titulo::before {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 64px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

/* ===========================
   RECIPE GRID & CARDS
   =========================== */
.recetas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
    margin-top: 8px;
}

.receta-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.04);
}

.receta-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-h);
}

.receta-imagen {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.receta-card:hover .receta-imagen {
    transform: scale(1.04);
}

.receta-imagen-placeholder {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, var(--dark) 0%, var(--surface) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
}

.receta-contenido {
    padding: 22px 22px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.receta-contenido h3 {
    color: var(--dark);
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.receta-contenido .descripcion {
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 16px;
    font-size: 14.5px;
    flex: 1;
}

/* Badges */
.pais-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f0f4ff;
    color: var(--surface);
    padding: 5px 12px;
    border-radius: var(--radius-xl);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}

.tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #bf360c;
    padding: 4px 11px;
    border-radius: var(--radius-xl);
    font-size: 12px;
    font-weight: 600;
    margin-left: 5px;
    margin-bottom: 8px;
}

/* Detail expand */
.receta-detalles {
    margin-top: 14px;
    border-top: 1px solid #f0f0f4;
    padding-top: 14px;
}

.receta-detalles summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    padding: 5px 0;
    user-select: none;
    transition: color var(--transition);
}

.receta-detalles summary:hover { color: var(--primary-dark); }

.receta-detalles .detalles-contenido {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-md);
}

.receta-detalles h4 {
    color: var(--text-primary);
    margin: 12px 0 6px;
    font-size: 14px;
    font-weight: 700;
}

.receta-detalles h4:first-child { margin-top: 0; }

.receta-detalles p {
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: 14px;
    white-space: pre-line;
}

/* ===========================
   ACTION BUTTONS ON CARDS
   =========================== */
.acciones-receta {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn-editar {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 9px 14px;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}

.btn-editar:hover {
    background: linear-gradient(135deg, #e67e22, #c0392b);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(243,156,18,0.35);
}

.btn-borrar {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 9px 14px;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    width: 100%;
}

.btn-borrar:hover {
    background: linear-gradient(135deg, #c0392b, #96281b);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(231,76,60,0.35);
}

/* ===========================
   PRIMARY BUTTON
   =========================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14.5px;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(232,98,42,0.38);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

/* ===========================
   FORM CONTAINER
   =========================== */
.form-container {
    max-width: 720px;
    margin: 0 auto;
    background: var(--white);
    padding: 48px 44px;
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.05);
}

.form-container h2 {
    text-align: center;
    color: var(--dark);
    margin-bottom: 36px;
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 800;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14.5px;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e8eaf0;
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--bg);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(232,98,42,0.10);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-group input[type="file"] {
    padding: 12px;
    border: 2px dashed #d0d4de;
    background: #fafbff;
    cursor: pointer;
}

.form-group .help-text {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 13px;
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.3px;
    font-family: inherit;
}

.btn-submit:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(232,98,42,0.35);
}

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 22px;
    font-weight: 500;
    font-size: 14.5px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-right: 4px solid #10b981;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-right: 4px solid #ef4444;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-right: 4px solid #3b82f6;
}

/* ===========================
   EMPTY STATE
   =========================== */
.empty-message {
    text-align: center;
    padding: 80px 24px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow);
}

.empty-message p {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ===========================
   FILTER BAR (recetas)
   =========================== */
.filtros-container {
    background: var(--white);
    padding: 22px 26px;
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.04);
}

.filtros-container label strong {
    font-size: 15px;
    color: var(--dark);
}

.filtros-container input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ===========================
   DETAIL PAGE
   =========================== */
.detalle-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--card-shadow-h);
    overflow: hidden;
    margin-top: 16px;
    border: 1px solid rgba(0,0,0,0.05);
}

.detalle-header {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .detalle-header { flex-direction: row; }
}

.detalle-imagen {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

@media (min-width: 768px) {
    .detalle-imagen {
        width: 48%;
        height: 440px;
    }
}

.detalle-info {
    padding: 36px;
    flex: 1;
}

.detalle-titulo {
    font-size: clamp(22px, 4vw, 34px);
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--dark);
    line-height: 1.2;
}

.detalle-descripcion {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 22px;
}

.detalle-cuerpo {
    padding: 36px;
    background: var(--bg);
    border-top: 1px solid #edf0f7;
}

.detalle-seccion {
    margin-bottom: 36px;
}

.detalle-seccion:last-child { margin-bottom: 0; }

.detalle-seccion h3 {
    color: var(--dark);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #edf0f7;
    position: relative;
}

.detalle-seccion h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 44px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

.detalle-texto {
    font-size: 15.5px;
    line-height: 1.85;
    color: var(--text-secondary);
    white-space: pre-line;
}

.btn-volver {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 20px;
    transition: color var(--transition);
}

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

/* ===========================
   LOGIN PAGE
   =========================== */
.login-wrap {
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--surface) 100%);
    padding: 40px 20px;
}

/* ===========================
   RESPONSIVE
   =========================== */

/* Tablet */
@media (max-width: 1024px) {
    .recetas-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root { --header-h: 64px; }

    .header-container { padding: 0 18px; }

    /* Hamburger */
    .nav-toggle { display: flex; }

    nav {
        position: absolute;
        top: var(--header-h);
        right: 0;
        left: 0;
        background: var(--dark-card);
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1);
        border-top: 1px solid rgba(255,255,255,0.07);
    }

    nav.open { max-height: 400px; }

    nav ul {
        flex-direction: column;
        gap: 2px;
        padding: 14px 18px 20px;
    }

    nav ul li { width: 100%; }

    nav ul li a {
        display: block;
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-md);
        font-size: 16px;
    }

    .container { padding: 24px 16px 50px; }

    .recetas-grid { grid-template-columns: 1fr; gap: 18px; }

    .form-container {
        padding: 28px 20px;
        border-radius: var(--radius-lg);
    }

    .filtros-container { padding: 16px; }

    .page-title { font-size: 24px; }

    .detalle-info { padding: 22px; }
    .detalle-cuerpo { padding: 22px; }
    .detalle-titulo { font-size: 22px; }

    .acciones-receta { flex-direction: column; }
}

/* Small mobile */
@media (max-width: 400px) {
    .receta-contenido { padding: 16px; }
    .form-container { padding: 20px 14px; }
}