/* ===========================================
   🎨 MyWay UI - FRAMEWORK STYLES
   =========================================== */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    /* FONDO GLOBAL: Imagen fija + Capa Crema Translúcida (92% opacidad) */
    background-image:linear-gradient(rgba(253, 251, 247, 0.392), rgba(253, 251, 247, 0.392)), url('../img/background.jpeg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Efecto parallax */
    
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--brand-primary-dark); }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ===========================================
   🧱 LAYOUT Y UTILIDADES
   =========================================== */
.container, .navbar-container, .footer-container, .dashboard-container, .profile-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}
/* Modificado: padding 0 arriba para que el heropegue al navbar */
.main-content { min-height: 60vh; padding: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); font-size: var(--text-sm); margin-top: var(--space-1); display: block; }
.text-muted { color: var(--text-muted); }

/* ===========================================
   🔘 BOTONES
   =========================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm); font-weight: 600;
    border: 1px solid transparent; border-radius: var(--radius-md);
    transition: all var(--transition-base);
    text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }
.btn-modern { padding: var(--space-4) var(--space-6); font-size: var(--text-base); box-shadow: var(--shadow-md); }

.btn-primary { background: var(--brand-gradient); color: white; box-shadow: 0 4px 15px rgba(var(--brand-primary-rgb), 0.3); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(var(--brand-primary-rgb), 0.4); color: white; }

.btn-outline { background: transparent; border-color: var(--gray-300); color: var(--text-secondary); }
.btn-outline:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--text-primary); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); color: white; }

.btn-success { background: var(--success); color: white; }
.btn-icon { padding: var(--space-2); width: 36px; height: 36px; }

/* ===========================================
   🧭 NAVBAR (Con modo transparente)
   =========================================== */
.navbar-modern {
    background: rgba(133, 133, 133, 0.238);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 1000;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
}

.navbar-modern.navbar-transparent .navbar-link:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}
.navbar-modern.navbar-transparent .btn-outline {
    border-color: rgba(255,255,255,0.7);
    color: white;
}
.navbar-modern.navbar-transparent .btn-outline:hover {
    background: rgba(255,255,255,0.1);
}
.navbar-modern.navbar-transparent .search-input {
    background: rgba(255,255,255,0.2);
    color: rgb(104, 104, 104);
    border-color: rgba(255,255,255,0.3);
}
.navbar-modern.navbar-transparent .search-input::placeholder { color: rgba(72, 71, 71, 0.8); }
.navbar-modern.navbar-transparent .search-btn { color: rgba(255,255,255,0.8); }

.navbar-container { height: var(--navbar-height); display: flex; align-items: center; gap: var(--space-6); }
.navbar-brand { display: flex; align-items: center; gap: var(--space-2); margin-right: auto; color: var(--text-primary); font-weight: 700; font-size: var(--text-xl); transition: color 0.3s ease; }
.brand-logo { background: var(--brand-gradient); color: white; padding: var(--space-2); border-radius: var(--radius-md); font-size: var(--text-sm); box-shadow: var(--shadow-glow); }
.navbar-menu { display: flex; align-items: center; gap: var(--space-4); }
.navbar-link { color: var(--text-secondary); font-weight: 500; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); transition: all var(--transition-fast); }
.navbar-link:hover { background: var(--gray-100); color: var(--text-primary); }
.navbar-link.active { color: var(--brand-primary); background: var(--brand-gradient-soft); }
.navbar-user { color: var(--text-secondary); font-weight: 600; transition: color 0.3s ease; }

/* Search */
.navbar-search { flex: 1; max-width: 400px; position: relative; }
.search-input { width: 100%; padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10); background: var(--gray-100); border: 1px solid var(--border-color); border-radius: var(--radius-full); transition: all var(--transition-fast); }
.search-input:focus { outline: none; background: white; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.1); }
.search-btn { position: absolute; left: var(--space-4); top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; }
.search-toggle-mobile { display: none; background: none; border: none; font-size: var(--text-xl); color: var(--text-secondary); }
.search-form-mobile { display: none; padding: var(--space-4); border-top: 1px solid var(--border-color); background: white; }
.search-form-mobile.active { display: flex; gap: var(--space-2); }
.search-form-mobile .search-input { padding-left: var(--space-4); }

/* ===========================================
   🏠 HOME & HERO CARRUSEL (Centrado y Elegante)
   =========================================== */
.hero-carousel {
    width: 70%;              /* Ancho solicitado */
    height: 60vh;            /* Altura solicitada */
    min-height: 250px;       /* Para que no se aplaste mucho en pantallas pequeñas */
    margin: auto; /* Centrado horizontal y debajo del navbar */
    margin-top: 2%;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius-xl); /* Bordes redondeados */
    box-shadow: var(--shadow-lg);    /* Sombra para que flote */
}
.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.8s ease-in-out;
}
.carousel-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-end; /* Texto abajo */
}
.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0; left: 0; z-index: 0;
    filter: brightness(0.6);
}
.carousel-caption {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 30px auto; /* Reducido el margen inferior porque el carrusel es más bajito */
    padding: 0 var(--space-6);
    color: white;
    text-align: center; /* Texto centrado para mejor estética */
}
/* Ajustes de tamaño de fuente para que encajen en 30vh */
.carousel-caption h1 {
    font-size: 1.8rem; /* Reducido de 3.5rem */
    font-weight: 800;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.carousel-caption p {
    font-size: 1rem;
    margin-bottom: 10px;
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: white;
    border: none;
    padding: 8px 12px; /* Botones más pequeños */
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    z-index: 10;
    transition: background 0.3s;
}
.carousel-btn:hover { background: rgba(0,0,0,0.8); }
.carousel-prev { left: 15px; }
.carousel-next { right: 15px; }

/* Responsive para el carrusel pequeño */
@media (max-width: 768px) {
    .hero-carousel {
        width: 90%;          /* En móvil ocupa casi todo el ancho */
        height: 35vh;        /* Un poco más alto para que quepa el texto */
    }
    .carousel-caption h1 { font-size: 1.4rem; }
    .carousel-caption p { font-size: 0.9rem; }
}

/* ===========================================
   🃏 COMPONENTES (Cards, Grids, Tables)
   =========================================== */
.cards-container, .grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-6); }
.list-container { display: flex; flex-direction: column; gap: var(--space-1); }

.card, .grid-item, .list-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}
.card:hover, .grid-item:hover, .list-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }

.card-image { height: 200px; background: var(--gray-100); overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.card:hover .card-image img { transform: scale(1.05); }

.card-body, .grid-item-info, .list-item-content { padding: var(--space-5); }
.card-title, .grid-item-title { font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-2); }
.card-field { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-1); }
.card-price { font-size: var(--text-xl); font-weight: 800; color: var(--brand-primary); margin-top: var(--space-3); }
.card-actions, .list-item-actions { padding: 0 var(--space-5) var(--space-5); display: flex; gap: var(--space-2); }

.list-item { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); }
.list-item-image { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--gray-100); flex-shrink: 0; }
.list-item-content { flex: 1; }
.list-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-2); }
.list-item-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-2); }

.badge { padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; }
.badge-success { background: var(--success-light); color: var(--success-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger-dark); }
.badge-secondary { background: var(--gray-200); color: var(--gray-700); }
.card-status-badge { position: absolute; top: var(--space-3); right: var(--space-3); }

/* Tables */
.table-container { background: var(--bg-surface); border-radius: var(--radius-lg); border: 1px solid var(--border-color); overflow: hidden; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table thead { background: var(--gray-50); }
.table th { padding: var(--space-4); text-align: left; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
.table td { padding: var(--space-4); border-bottom: 1px solid var(--border-color); }
.table tbody tr:hover { background: var(--gray-50); }
.table-thumbnail { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-md); }

/* ===========================================
   📊 DASHBOARD & PROFILE
   =========================================== */
.dashboard-header, .profile-header { background: var(--bg-surface); border-bottom: 1px solid var(--border-color); padding: var(--space-8) 0; text-align: center; }
.dashboard-title, .profile-title { font-size: var(--text-3xl); font-weight: 800; letter-spacing: -0.02em; }
.dashboard-subtitle, .profile-subtitle { color: var(--text-secondary); font-size: var(--text-lg); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-6); max-width: var(--container-width); margin: var(--space-8) auto; padding: 0 var(--space-6); }
.stat-card { background: var(--bg-surface); padding: var(--space-6); border-radius: var(--radius-xl); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: var(--text-2xl); margin-bottom: var(--space-4); }
.stat-icon.primary { background: var(--brand-gradient-soft); color: var(--brand-primary); }
.stat-icon.success { background: var(--success-light); color: var(--success-dark); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning-dark); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger-dark); }
.stat-value { font-size: var(--text-3xl); font-weight: 800; color: var(--text-primary); }
.stat-label { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); }

.info-card, .profile-card { background: var(--bg-surface); padding: var(--space-8); border-radius: var(--radius-xl); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); margin-bottom: var(--space-6); }
.info-card h2, .profile-card h2 { font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--space-6); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border-color); }
.info-row { display: flex; padding: var(--space-3) 0; gap: var(--space-4); }
.info-row strong { width: 150px; color: var(--text-muted); font-weight: 500; }
.info-actions, .form-actions { margin-top: var(--space-6); display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ===========================================
   📊 DASHBOARD CHEFMATE (Layout 3 Columnas)
   =========================================== */
.dash-3col {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    gap: 24px;
    padding: 30px 0;
    max-width: var(--container-width);
    margin: 0 auto;
}

/* Grid de Estadísticas Izquierda */
.dash-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.dash-stat-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}
.dash-stat-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dash-stat-box.span-2 { grid-column: 1 / -1; } /* Ocupa todo el ancho abajo */
.dash-stat-val { font-size: 1.6rem; font-weight: 800; color: var(--brand-primary); margin-bottom: 2px; line-height: 1; }
.dash-stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Lista Centro */
.dash-recipe-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: 0.2s;
}
.dash-recipe-row:hover { box-shadow: var(--shadow-md); border-color: transparent; }
.dash-recipe-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.dash-recipe-info { flex: 1; }
.dash-recipe-title { font-weight: 600; color: var(--text-primary); font-size: 0.95rem; margin-bottom: 2px; }
.dash-recipe-date { font-size: 0.75rem; color: var(--text-muted); }

/* Notificaciones Derecha */
.dash-notif {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid var(--brand-primary);
}
.dash-notif.success { border-left-color: var(--success); }
.dash-notif.warning { border-left-color: var(--warning); }

/* Responsive */
@media (max-width: 1100px) {
    .dash-3col { grid-template-columns: 1fr; }
}
/* ===========================================
   🔄 TOGGLE SWITCH (Visibilidad Receta)
   =========================================== */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: .3s;
  border-radius: 24px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Color principal de ChefMate al estar activo */
input:checked + .slider-toggle {
  background-color: var(--brand-primary);
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
}

.switch-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  cursor: pointer;
}
/* ===========================================
   📝 AUTH & FORMS
   =========================================== */
.auth-wrapper { min-height: calc(100vh - var(--navbar-height)); display: flex; align-items: center; justify-content: center; background: var(--bg-body); padding: var(--space-8) var(--space-4); }
.auth-card { background: var(--bg-surface); padding: var(--space-10); border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl); max-width: 440px; width: 100%; border: 1px solid var(--border-color); }
.auth-header { text-align: center; margin-bottom: var(--space-8); }
.auth-logo { background: var(--brand-gradient); color: white; width: 56px; height: 56px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: var(--text-xl); font-weight: 800; margin: 0 auto var(--space-4); box-shadow: var(--shadow-glow); }
.auth-title { font-size: var(--text-2xl); font-weight: 800; }
.auth-subtitle { color: var(--text-muted); }
.auth-divider { margin: var(--space-6) 0; border-top: 1px solid var(--border-color); }
.auth-footer { text-align: center; color: var(--text-secondary); margin-top: var(--space-6); font-size: var(--text-sm); }

.input-group { position: relative; margin-bottom: var(--space-5); }
.form-control {
    width: 100%; padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
    background: var(--gray-50); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    font-size: var(--text-sm); color: var(--text-primary); transition: all var(--transition-fast);
}
.form-control:focus { outline: none; background: white; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.1); }
.input-group-icon { position: absolute; left: var(--space-4); top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-group-label { position: absolute; left: 40px; top: 50%; transform: translateY(-50%); color: var(--text-muted); transition: all var(--transition-fast); pointer-events: none; background: transparent; padding: 0 var(--space-1); }
.form-control:focus + .input-group-icon + .input-group-label, .form-control:not(:placeholder-shown) + .input-group-icon + .input-group-label { top: 0; font-size: var(--text-xs); color: var(--brand-primary); background: white; }

/* ===========================================
   ⚠️ ALERTAS & ERRORES
   =========================================== */
.alert { padding: var(--space-4); border-radius: var(--radius-md); margin-bottom: var(--space-4); display: flex; justify-content: space-between; align-items: center; font-size: var(--text-sm); border-left: 4px solid; }
.alert-success { background: var(--success-light); color: var(--success-dark); border-color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger-dark); border-color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning-dark); border-color: var(--warning); }
.alert-info { background: var(--info-light); color: var(--info-dark); border-color: var(--info); }
.btn-close { background: none; border: none; font-size: var(--text-xl); line-height: 1; color: inherit; opacity: 0.5; }
.btn-close:hover { opacity: 1; }

.error-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--space-4); color: white; }
.error-404 { background: var(--brand-gradient); }
.error-500 { background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%); }
.error-code { font-size: 8rem; font-weight: 900; line-height: 1; margin-bottom: var(--space-4); text-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.error-title { font-size: var(--text-3xl); font-weight: 800; margin-bottom: var(--space-4); }
.error-message { font-size: var(--text-lg); opacity: 0.9; margin-bottom: var(--space-8); }
.btn-error-primary { background: white; color: var(--brand-primary); }
.btn-error-outline { border: 2px solid white; color: white; background: transparent; }

/* ===========================================
   🔍 SEARCH & FILTERS
   =========================================== */
.search-page { display: grid; grid-template-columns: 280px 1fr; gap: var(--space-8); max-width: var(--container-width); margin: var(--space-8) auto; padding: 0 var(--space-6); }
.search-sidebar { background: var(--bg-surface); padding: var(--space-6); border-radius: var(--radius-lg); border: 1px solid var(--border-color); height: fit-content; position: sticky; top: calc(var(--navbar-height) + var(--space-4)); }
.search-sidebar h3 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: var(--space-4); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-color); }
.filter-group { margin-bottom: var(--space-5); }
.filter-label { display: block; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-2); }
.filter-input, .filter-select { width: 100%; padding: var(--space-3); border: 1px solid var(--border-color); border-radius: var(--radius-md); font-size: var(--text-sm); background: var(--gray-50); }
.filter-input:focus { outline: none; border-color: var(--brand-primary); background: white; box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.1); }

/* ===========================================
   🦶 FOOTER
   =========================================== */
.footer-modern { background: var(--bg-surface); border-top: 1px solid var(--border-color); padding: var(--space-8) 0; margin-top: auto; }
.footer-container { text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

/* ===========================================
   📱 RESPONSIVE
   =========================================== */
@media (max-width: 992px) {
    .navbar-search { display: none; }
    .search-toggle-mobile { display: block; }
    .search-page { grid-template-columns: 1fr; }
    .search-sidebar { position: static; }
}

@media (max-width: 768px) {
    .navbar-container { flex-wrap: wrap; height: auto; padding: var(--space-3) 0; }
    .navbar-menu { width: 100%; justify-content: center; margin-top: var(--space-3); }
    
    .hero-title { font-size: var(--text-4xl); }
    .stats-grid { grid-template-columns: 1fr; }
    
    .list-item { flex-direction: column; align-items: flex-start; }
    .list-item-actions { width: 100%; }
    
    .info-row { flex-direction: column; gap: var(--space-1); }
    .info-row strong { width: auto; }
    
    .auth-card { padding: var(--space-6); }
    
    .carousel-caption { margin-bottom: 120px; }
    .carousel-caption h1 { font-size: 2rem !important; }
    .carousel-btn { padding: 10px 15px; font-size: 1.2rem; }
}