/* /app/estilos.css - Vinetur Apps (v3.0 - Final Stable) */

:root {
  --brand: #81ad32; --brand-dark: #6a8f29; --brand-light: #eff7e0;
  --bg-body: #f9f9f9; --bg-sidebar: #ffffff; --bg-card: #ffffff; /*old bg-body: #f3f6f1;*/
  --text-main: #1e293b; --text-muted: #64748b; --border: #e2e8f0; 
  --focus-ring: rgba(129, 173, 50, 0.25);
  --radius: 24px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.01);
  --font: 'Plus Jakarta Sans', sans-serif;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
}

* { box-sizing: border-box; }

/* DEFAULT (DESKTOP): Sin scroll en body para efecto App */
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background-color: var(--bg-body); color: var(--text-main); font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; transition: all 0.2s; }
a:hover { color: var(--brand-dark); }

/* --- LAYOUT --- */
.app-shell { display: flex; height: 100vh; width: 100vw; }

/* --- SIDEBAR --- */
.app-sidebar {
    width: var(--sidebar-width); background: var(--bg-sidebar);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    padding: 16px; flex-shrink: 0; z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
    white-space: nowrap; overflow: hidden;
}

.sidebar-header { display: flex; align-items: center; justify-content: space-between; height: 40px; margin-bottom: 20px; padding: 0 8px; }
.sidebar-title { font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 800; letter-spacing: 0.08em; transition: opacity 0.2s; }

.sidebar-toggle {
    background: transparent; border: none; color: #64748b; cursor: pointer;
    width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; padding: 0;
}
.sidebar-toggle:hover { background: #e2e8f0; color: #1e293b; }
.sidebar-toggle svg { width: 22px; height: 22px; stroke-width: 2px; }

.nav-menu { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
    display: flex; align-items: center; padding: 12px 16px; border-radius: 12px;
    color: var(--text-main); font-weight: 500; font-size: 15px; text-decoration: none;
    transition: all 0.2s; overflow: hidden;
}
.nav-item:hover { background-color: #f1f5f9; }
.nav-item.active { background-color: var(--brand-light); color: #365314; font-weight: 700; }
.nav-icon { display: flex; align-items: center; justify-content: center; font-size: 20px; min-width: 24px; margin-right: 14px; }
.nav-text { opacity: 1; transition: opacity 0.2s; }

.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); overflow: hidden; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.footer-info { font-size: 11px; line-height: 1.3; color: var(--text-muted); transition: opacity 0.2s; }
.app-version { font-size: 10px; opacity: 0.5; margin-top: 8px; display: block; padding-left: 2px;}

/* Sidebar Collapsed */
.app-sidebar.collapsed { width: var(--sidebar-collapsed-width); padding: 16px 8px; }
.app-sidebar.collapsed .sidebar-title, .app-sidebar.collapsed .nav-text, 
.app-sidebar.collapsed .footer-info, .app-sidebar.collapsed .app-version { display: none; opacity: 0; }
.app-sidebar.collapsed .sidebar-header, .app-sidebar.collapsed .nav-item, .app-sidebar.collapsed .footer-brand { justify-content: center; padding-left: 0; }
.app-sidebar.collapsed .nav-icon { margin: 0; }

/* --- MAIN --- */
.app-main {
    flex: 1; display: flex; flex-direction: column; position: relative;
    background: var(--bg-body); 
}

.app-header {
    height: 64px; display: flex; align-items: center; padding: 0 30px; flex-shrink: 0; gap: 16px; 
}

.mobile-menu-btn {
    display: none; background: transparent; border: none; cursor: pointer;
    padding: 8px; margin-left: -8px; border-radius: 50%; color: #1e293b;
}
.mobile-menu-btn svg { width: 24px; height: 24px; display: block; }

.header-logo { display: flex; align-items: center; gap: 5px; }
.header-logo img { height: 32px; width: auto; }
.header-logo span { font-weight: 700; font-size: 18px; color: #1e293b; letter-spacing: -0.03em; }

.content-scroll { flex: 1; overflow-y: auto; padding: 0 30px 60px; }
.content-wrap { max-width: 900px; margin: 0 auto; }

.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* --- COMPONENTES --- */
.app-hero { text-align: center; padding: 30px 0 40px; }
.app-hero h1 { font-size: 32px; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.03em; background: linear-gradient(135deg, #111 0%, #555 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; color: #1a1a1a; }
.app-hero .sub { color: var(--text-muted); font-size: 18px; font-weight: 500; }

.card { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.6); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 40px; margin-bottom: 30px; }
.field { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px;}
label { font-size: 13px; font-weight: 700; color: #475569; padding-left: 4px; text-transform: uppercase; }
textarea, input[type="text"], select { width: 100%; background: #f8fafc; color: var(--text-main); border: 1px solid var(--border); border-radius: 16px; padding: 16px 20px; font-family: var(--font); font-size: 15px; outline: none; transition: border-color 0.2s; }
textarea:focus, input:focus, select:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus-ring); }
textarea { min-height: 350px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 20px center; background-size: 18px; }
.flag-select, .flag-select option { font-family: 'Noto Color Emoji', sans-serif; }

.actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 30px; width: 100%; }
.btn { display: inline-flex; justify-content: center; align-items: center; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff !important; padding: 16px 40px; border: none; border-radius: 100px; font-family: var(--font); font-size: 17px; font-weight: 700; box-shadow: 0 4px 12px rgba(129, 173, 50, 0.3); transition: transform 0.2s; cursor: pointer; width: 100%; max-width: 350px; }
.btn:hover { transform: translateY(-2px); } .btn:active { transform: translateY(0); } .btn[disabled] { background: #cbd5e1; cursor: not-allowed; transform: none; }
.btn-secondary { background: #fff; color: #475569 !important; border: 1px solid #cbd5e1; box-shadow: 0 1px 2px rgba(0,0,0,0.05); font-size: 14px; padding: 10px 20px; min-width: auto; width: auto; border-radius: 50px; }
.btn-secondary:hover { border-color: #94a3b8; background: #f8fafc; }

.status { font-size: 14px; color: var(--brand); font-weight: 600; height: 20px; } .sep { border: none; border-top: 1px solid var(--border); margin: 40px 0 30px; } .ex-title { font-size: 18px; font-weight: 700; text-align: center; color: var(--text-main); margin-bottom: 24px; } .msg-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 12px; border-radius: 12px; font-size: 14px; margin-top:8px;} .hidden { display: none !important; }

/* Examples */
.examples-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 10px; }
.ex-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); cursor: pointer; transition: all 0.2s ease; height: 100%; }
.ex-card:hover { border-color: var(--brand); transform: translateY(-3px); }
.ex-card#exNota::before { content: '\1F4F0'; font-size: 32px; margin-bottom: 12px; } .ex-card#exBlog::before { content: '\270D'; font-size: 32px; margin-bottom: 12px; } .ex-card#exMejora::before { content: '\2728'; font-size: 32px; margin-bottom: 12px; }
.ex-card strong { display: block; font-size: 15px; margin-bottom: 6px; color: var(--text-main); } .ex-card span { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

/* Result blocks */
.kpis { display: flex; justify-content: flex-end; margin-bottom: 10px; } .pill { display: inline-flex; border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); background: #f8fafc; }
.titlebox { margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 20px; } .titlebox .h1 { font-size: 32px; font-weight: 800; line-height: 1.2; color: #111; margin: 0 0 8px; } .titlebox .h2 { font-size: 20px; font-weight: 500; color: var(--text-muted); margin: 0; } .titlebox .editable:empty::before { content: attr(data-placeholder); color: #cbd5e1; }
#salida { background: #fff; min-height: 400px; outline: none; font-size: 18px; line-height: 1.8; color: #2c2c2c; }

.rec-intro { background: var(--brand-light); color: #365314; border-radius: 16px; padding: 20px; margin-bottom: 20px; border: 1px solid #d9f99d; font-size: 15px; line-height: 1.6; }
.rec-card { background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--brand); border-radius: 16px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.rec-card h3 { margin: 0 0 10px 0; font-size: 18px; font-weight: 800; display: flex; align-items: center; }
.rec-card h3::before { content: '▪️'; margin-right: 10px; font-size: 24px; } .rec-card ul { margin: 0; padding-left: 20px; color: #475569; } .rec-card li { margin-bottom: 6px; line-height: 1.6; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 20px; border-top: 1px solid var(--border); justify-content: center; }

/* Loading Overlay Mejorado */
.loading { position: fixed; inset: 0; background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 9999; }
.loading.show { display: flex; animation: fadeIn 0.3s; }
.loading .box { background: #fff; border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 30px; width: 280px; text-align: center; }
.loading .spinner { width: 40px; height: 40px; border: 4px solid #e2e8f0; border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 16px; animation: spin 1s linear infinite; }
.loading .msg { color: var(--text-main); font-size: 18px; font-weight: 700; }
.loading .sec { color: var(--text-muted); font-size: 13px; margin-top: 6px; font-variant-numeric: tabular-nums; } /* Restaurado */

@keyframes spin { to { transform:rotate(360deg) } } @keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

/* Grid PC */
@media (min-width: 720px) { .form-grid { display: grid; gap: 20px; grid-template-areas: "country price" "occasion style" "food gastro"; grid-template-columns: 1fr 1fr; } .field.country { grid-area: country; } .field.price { grid-area: price; } .field.style { grid-area: style; } .field.occasion { grid-area: occasion; } .field.food { grid-area: food; } .field.gastro { grid-area: gastro; margin-top: 0 !important; } }

/* MOBILE FIXES */
@media (max-width: 840px) {
    /* Unlock Scroll */
    html, body { overflow: auto !important; height: auto !important; }
    .app-shell { display: block; position: relative; height: auto; min-height: 100vh; } 
    .content-scroll { height: auto !important; overflow: visible !important; padding: 20px; }
    
    /* Drawer */
    .app-sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 280px !important; transform: translateX(-100%); box-shadow: var(--shadow-lg); z-index: 100; padding: 16px 20px; height: 100%; }
    .app-sidebar.mobile-open { transform: translateX(0); }
    
    .app-sidebar .sidebar-title, .app-sidebar .nav-text, .app-sidebar .footer-info { display: block !important; opacity: 1 !important; }
    .app-sidebar .nav-item { justify-content: flex-start !important; padding: 12px 16px !important; }
    .app-sidebar .nav-icon { margin-right: 14px !important; }
    .app-sidebar .sidebar-header { justify-content: space-between !important; padding: 0 !important;}
    .app-sidebar .footer-brand { justify-content: flex-start !important; }

    .sidebar-toggle { display: none; } .mobile-menu-btn { display: block; }
    .app-header { padding: 0 20px; border-bottom: 1px solid rgba(0,0,0,0.05); background: rgba(243, 246, 241, 0.95); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 30; }
    
    /* Stack Examples */
    .examples-grid { grid-template-columns: 1fr !important; gap: 16px; }
    .form-grid { grid-template-columns: 1fr; }
}

#panel-resultado.gate-fail .kpis, #panel-resultado.gate-fail .titlebox, #panel-resultado.gate-fail .toolbar .btn { display: none; }
#panel-resultado.gate-fail .toolbar #btnNueva { display: inline-flex; margin: 24px auto 0; }
#panel-resultado.gate-fail #salida { border: 0; box-shadow: none; min-height: auto; padding: 60px 20px; text-align: center; font-size: 20px; color: var(--text-muted); pointer-events: none; }