/* ============================================================
   public/css/app.css — Estilos globales de Gurekarta
   ============================================================ */

/* ---- Reset + Base ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
       color: #1a1a1a; background: #f5f4f0; line-height: 1.6; }
img  { max-width: 100%; display: block; }
a    { color: inherit; text-decoration: none; }

/* ---- Tokens --------------------------------------------- */
:root {
  --verde:    #2c7a4e;
  --rojo:     #8b0000;
  --dorado:   #d4a017;
  --gris-100: #f5f4f0;
  --gris-200: #e8e6e0;
  --gris-400: #999;
  --gris-700: #555;
  --sombra:   0 1px 4px rgba(0,0,0,.08);
  --radius:   10px;
  --radius-sm: 6px;
}

/* ---- Buttons -------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn--primary   { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn--primary:hover { background: #333; }
.btn--outline   { background: transparent; color: #1a1a1a; border-color: #ccc; }
.btn--outline:hover { background: var(--gris-200); }
.btn--success   { background: var(--verde); color: #fff; }
.btn--success:hover { background: #235f3c; }
.btn--danger    { background: #c0392b; color: #fff; }
.btn--danger:hover  { background: #a93226; }
.btn--danger-soft   { background: #fdecea; color: #c0392b; border-color: #f5c6c2; }
.btn--google    { background: #fff; color: #444; border-color: #ddd;
                  font-weight: 500; justify-content: center; }
.btn--google:hover  { background: #f8f8f8; }
.btn--full  { width: 100%; justify-content: center; }
.btn--sm    { padding: 6px 14px; font-size: 13px; }
.btn--xs    { padding: 4px 10px; font-size: 12px; }
.btn-group  { display: flex; gap: 8px; }

/* ---- Alerts --------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
         font-size: 14px; }
.alert p { margin: 2px 0; }
.alert--success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.alert--error   { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6c2; }
.alert--warning { background: #fff8e1; color: #7a4a00; border: 1px solid #ffe082; }
.alert--info    { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }

/* ---- Forms ---------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--gris-700); }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.flex-1   { flex: 1; min-width: 180px; }
input[type=text], input[type=email], input[type=password],
input[type=url],  input[type=tel],   input[type=number],
textarea, select {
  width: 100%; padding: 9px 12px; border: 1.5px solid #ddd;
  border-radius: var(--radius-sm); font-size: 14px;
  background: #fff; transition: border .15s;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #1a1a1a;
}
textarea { resize: vertical; }
input[type=color]  { padding: 2px; height: 38px; width: 60px; cursor: pointer; border-radius: 4px; }
input[type=file]   { font-size: 13px; padding: 6px 0; }
.form-link         { font-size: 12px; color: var(--verde); text-align: right; }
.form-legal        { font-size: 12px; color: var(--gris-400); margin-bottom: 12px; }
.form-legal a      { color: var(--verde); text-decoration: underline; }
.form-actions      { display: flex; gap: 12px; justify-content: flex-end; padding-top: 16px; }
.form-section      { border-bottom: 1px solid var(--gris-200); padding-bottom: 24px; margin-bottom: 24px; }
.form-section h3   { font-size: 15px; margin-bottom: 16px; color: var(--gris-700); }
.form-card         { background: #fff; border-radius: var(--radius); padding: 24px;
                     box-shadow: var(--sombra); }
.checkbox-label    { display: flex; align-items: center; gap: 8px; font-size: 14px;
                     cursor: pointer; margin-right: 16px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }

/* Toggle switch */
.toggle-switch      { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input{ opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider      { width: 42px; height: 24px; background: #ccc; border-radius: 12px;
                      transition: .2s; display: block; }
.toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--verde); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); }

/* ---- Auth page ------------------------------------------ */
.auth-page       { background: var(--gris-100); min-height: 100vh;
                   display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-container  { width: 100%; max-width: 420px; }
.auth-card       { background: #fff; border-radius: var(--radius); padding: 36px 32px;
                   box-shadow: 0 2px 16px rgba(0,0,0,.08); }
.auth-logo       { text-align: center; margin-bottom: 24px; }
.auth-card h1    { font-size: 22px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.auth-subtitle   { text-align: center; color: var(--gris-400); font-size: 14px; margin-bottom: 24px; }
.auth-divider    { display: flex; align-items: center; gap: 12px; margin: 20px 0;
                   color: var(--gris-400); font-size: 13px; }
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gris-200);
}
.auth-footer     { text-align: center; font-size: 13px; margin-top: 20px; color: var(--gris-700); }
.auth-footer a   { color: var(--verde); font-weight: 500; }

/* ---- Panel (restaurante + admin) ------------------------ */
.panel-page      { background: var(--gris-100); min-height: 100vh; }
.panel-nav       { background: #fff; border-bottom: 1px solid var(--gris-200);
                   padding: 0 24px; display: flex; align-items: center;
                   gap: 24px; height: 56px; position: sticky; top: 0; z-index: 100; }
.panel-nav__logo { font-weight: 700; font-size: 18px; }
.panel-nav a     { font-size: 14px; color: var(--gris-700); padding: 4px 0;
                   border-bottom: 2px solid transparent; }
.panel-nav a:hover, .panel-nav a.active { color: #1a1a1a; border-color: #1a1a1a; }
.panel-nav__spacer { flex: 1; }
.panel-main      { max-width: 1280px; margin: 0 auto; padding: 24px; }
.panel-header    { display: flex; align-items: flex-start; justify-content: space-between;
                   margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.panel-header h1 { font-size: 22px; font-weight: 600; }
.back-link       { font-size: 13px; color: var(--gris-400); display: block; margin-bottom: 4px; }
.back-link:hover { color: #1a1a1a; }
.text-muted      { color: var(--gris-400); }
.small           { font-size: 13px; }

/* Locales grid en dashboard */
.locales-grid      { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 16px; }
.local-card        { background: #fff; border-radius: var(--radius); padding: 20px;
                     box-shadow: var(--sombra); display: flex; gap: 16px; }
.local-card__logo  { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.local-card__logo-placeholder {
  width: 64px; height: 64px; border-radius: 8px; background: var(--gris-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: var(--gris-400); flex-shrink: 0;
}
.local-card__body  { flex: 1; min-width: 0; }
.local-card__top   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.local-card h2     { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.local-card__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Estado badges */
.estado-badge         { font-size: 11px; font-weight: 500; padding: 2px 8px;
                        border-radius: 10px; white-space: nowrap; }
.estado--borrador     { background: #f0f0f0; color: #666; }
.estado--pendiente    { background: #fff3cd; color: #856404; }
.estado--publicado    { background: #d1e7dd; color: #0a3622; }
.estado--rechazado    { background: #fdecea; color: #b71c1c; }
.estado--suspendido   { background: #f8d7da; color: #842029; }
.tipo-badge           { font-size: 12px; color: var(--gris-400); }

/* Tabs */
.tabs     { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 2px solid var(--gris-200); }
.tab      { padding: 10px 20px; font-size: 14px; color: var(--gris-400); cursor: pointer;
            border-bottom: 2px solid transparent; margin-bottom: -2px; transition: .15s; }
.tab:hover, .tab--active { color: #1a1a1a; border-color: #1a1a1a; }

/* Empty state */
.empty-state   { text-align: center; padding: 60px 20px; }
.empty-icon    { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; }
.empty-state p  { color: var(--gris-400); margin-bottom: 24px; }

/* ---- Carta editor --------------------------------------- */
.carta-editor          { display: grid; grid-template-columns: 1fr 380px; gap: 24px; }
.carta-editor__secciones { min-width: 0; }
.carta-editor__preview { position: sticky; top: 72px; align-self: start; }
.preview-header        { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.preview-iframe        { width: 100%; height: 600px; border: 1.5px solid var(--gris-200);
                         border-radius: var(--radius); background: #fff; }
.preview-iframe--tall  { height: 700px; }

/* Secciones */
.seccion-bloque        { background: #fff; border-radius: var(--radius);
                         box-shadow: var(--sombra); margin-bottom: 16px; overflow: hidden; }
.seccion-bloque__header {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: var(--gris-100); border-bottom: 1px solid var(--gris-200);
}
.seccion-bloque__header strong { flex: 1; font-size: 15px; }
.seccion-bloque__actions { display: flex; gap: 4px; }
.drag-handle           { cursor: grab; color: var(--gris-400); font-size: 18px; }
.seccion-rapida-grid   { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.seccion-rapida-btn    { padding: 6px 12px; font-size: 13px; border-radius: 20px;
                         border: 1px solid var(--gris-200); background: #fff; cursor: pointer; }
.seccion-rapida-btn:hover { background: var(--gris-100); }
.add-plato-btn         { margin: 12px; width: calc(100% - 24px); }
.card { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--sombra); }
.mb-2 { margin-bottom: 16px; }

/* Plato row en el editor */
.plato-row             { display: flex; align-items: center; gap: 12px; padding: 10px 16px;
                         border-bottom: 1px solid var(--gris-200); cursor: pointer; }
.plato-row:hover       { background: var(--gris-100); }
.plato-row__img        { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.plato-row__nombre     { flex: 1; font-size: 14px; font-weight: 500; }
.plato-row__precio     { font-size: 14px; color: var(--verde); font-weight: 500; }
.plato-row__aler       { font-size: 11px; color: var(--gris-400); margin-top: 2px; }

/* Upload area */
.upload-area           { border: 2px dashed var(--gris-200); border-radius: 8px;
                         padding: 24px; text-align: center; cursor: pointer; }
.upload-area:hover     { border-color: #999; }

/* Alérgenos en el modal */
.alergenos-grid        { display: flex; flex-wrap: wrap; gap: 6px; }
.alergeno-check        { cursor: pointer; }
.alergeno-check input  { display: none; }
.alergeno-check__box   { display: inline-block; padding: 4px 10px; font-size: 12px;
                         border-radius: 20px; border: 1.5px solid var(--alergeno-color,#e67e22);
                         color: var(--alergeno-color, #e67e22); transition: .15s; }
.alergeno-check input:checked + .alergeno-check__box {
  background: var(--alergeno-color); color: #fff;
}

/* Personalización estilo */
.estilo-plato-details  { margin-top: 8px; font-size: 13px; }
.estilo-plato-details summary { cursor: pointer; color: var(--gris-700); margin-bottom: 8px; }

/* Estilo editor */
.estilo-editor         { display: grid; grid-template-columns: 1fr 360px; gap: 24px; }
.estilo-editor__form   { min-width: 0; }
.estilo-editor__preview { position: sticky; top: 72px; align-self: start; }
.plantillas-grid       { display: grid; grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); gap: 12px; }
.plantilla-card        { border: 2px solid var(--gris-200); border-radius: var(--radius);
                         padding: 12px; cursor: pointer; text-align: center; font-size: 12px; }
.plantilla-card input  { display: none; }
.plantilla-card--active { border-color: #1a1a1a; }
.plantilla-card:hover  { border-color: #999; }
.tpl-preview           { border-radius: 6px; padding: 10px; margin-bottom: 8px;
                         text-align: left; min-height: 80px; }
.tpl-prev-title        { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.tpl-prev-item         { font-size: 11px; display: flex; justify-content: space-between;
                         padding: 2px 0; }

/* Plantillas predefinidas */
.tpl-clasica   { background:#fdf8f0; color:#3b2a1a; font-family:Georgia,serif; }
.tpl-clasica .tpl-prev-title  { color:#8b0000; }
.tpl-moderna   { background:#fff; color:#1a1a1a; font-family:system-ui; }
.tpl-moderna .tpl-prev-title  { color:#000; letter-spacing:.05em; }
.tpl-oscura    { background:#1a1a2e; color:#e0e0e0; }
.tpl-oscura .tpl-prev-title   { color:#d4a017; }
.tpl-colorida  { background:#fff9f0; color:#333; }
.tpl-colorida .tpl-prev-title { color:#e07b39; }
.tpl-pizarra   { background:#2c2c2c; color:#f0f0f0; font-family:'Courier New',monospace; }
.tpl-pizarra .tpl-prev-title  { color:#fff; }

/* Horarios */
.horarios-table    { width: 100%; border-collapse: collapse; }
.horarios-table th, .horarios-table td { padding: 10px 12px; text-align: left;
                                          border-bottom: 1px solid var(--gris-200); }
.horarios-table th { font-size: 13px; color: var(--gris-400); }

/* Imágenes preview */
.img-preview       { max-height: 80px; border-radius: 6px; margin-bottom: 8px; }
.img-preview--wide { max-height: 60px; max-width: 200px; }

/* Admin */
.stats-grid        { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
                     gap: 16px; margin-bottom: 32px; }
.stat-card         { background: #fff; border-radius: var(--radius); padding: 20px;
                     box-shadow: var(--sombra); }
.stat-card__num    { font-size: 36px; font-weight: 700; }
.stat-card__label  { font-size: 13px; color: var(--gris-400); margin-top: 4px; }
.stat-card--success .stat-card__num { color: var(--verde); }
.stat-card--warning .stat-card__num { color: #d4a017; }

.admin-section     { background: #fff; border-radius: var(--radius); padding: 20px;
                     box-shadow: var(--sombra); margin-bottom: 24px; }
.admin-section h2  { font-size: 17px; margin-bottom: 16px; }
.section-header-row { display: flex; justify-content: space-between; align-items: center;
                      margin-bottom: 16px; }
.table-wrap        { overflow-x: auto; }
.admin-table       { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left;
                                    border-bottom: 1px solid var(--gris-200); }
.admin-table th    { font-size: 12px; color: var(--gris-400); font-weight: 500; }
.actions-cell      { display: flex; gap: 6px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 999;
         display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal__box     { position: relative; background: #fff; border-radius: var(--radius);
                  padding: 28px; width: 100%; max-width: 520px; max-height: 90vh;
                  overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.modal__box--lg { max-width: 720px; }
.modal__box h2  { font-size: 18px; margin-bottom: 20px; }
.modal__footer  { display: flex; gap: 10px; justify-content: flex-end;
                  padding-top: 16px; border-top: 1px solid var(--gris-200); margin-top: 16px; }

/* Directorio público */
.site-header   { background: #fff; border-bottom: 1px solid var(--gris-200);
                 display: flex; align-items: center; padding: 0 24px; height: 60px;
                 gap: 24px; position: sticky; top: 0; z-index: 100; }
.site-logo     { font-weight: 800; font-size: 20px; color: #1a1a1a; letter-spacing: -.02em; }
.site-nav      { display: flex; align-items: center; gap: 20px; margin-left: auto; font-size: 14px; }

.dir-hero      { background: #1a1a1a; color: #fff; padding: 60px 24px; text-align: center; }
.dir-hero h1   { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.dir-hero p    { color: #aaa; margin-bottom: 28px; }
.dir-busqueda  { display: flex; gap: 12px; max-width: 520px; margin: 0 auto; }
.dir-busqueda__input { flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
                       border: none; font-size: 15px; }

.dir-layout    { display: grid; grid-template-columns: 220px 1fr; gap: 0;
                 max-width: 1200px; margin: 0 auto; padding: 24px; }
.dir-sidebar   { padding-right: 24px; border-right: 1px solid var(--gris-200); }
.dir-sidebar h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
                  color: var(--gris-400); margin: 20px 0 8px; }
.dir-filter-list { list-style: none; }
.dir-filter-list li { margin-bottom: 2px; }
.dir-filter-list a   { display: flex; justify-content: space-between;
                       padding: 6px 10px; border-radius: 6px; font-size: 14px;
                       color: var(--gris-700); }
.dir-filter-list a:hover, .dir-filter--active {
  background: var(--gris-200); color: #1a1a1a; }
.dir-filter__count { font-size: 12px; color: var(--gris-400); }

.dir-content   { padding-left: 24px; }
.dir-content__header { display: flex; align-items: center; justify-content: space-between;
                        margin-bottom: 20px; }
.dir-grid      { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 16px; }
.dir-card      { background: #fff; border-radius: var(--radius); overflow: hidden;
                 box-shadow: var(--sombra); transition: transform .15s, box-shadow .15s; }
.dir-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.dir-card__img { height: 140px; overflow: hidden; position: relative; }
.dir-card__img img { width: 100%; height: 100%; object-fit: cover; }
.dir-card__placeholder { width:100%; height:100%; background:var(--gris-200);
                          display:flex; align-items:center; justify-content:center;
                          font-size:48px; font-weight:700; color:var(--gris-400); }
.dir-card__badge { position:absolute; top:8px; left:8px; background:#ffd700; color:#333;
                   font-size:11px; padding:3px 8px; border-radius:10px; font-weight:600; }
.dir-card__body  { padding: 14px; }
.dir-card__tipo  { font-size: 12px; color: var(--gris-400); margin-bottom: 4px; }
.dir-card h3     { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.dir-card__loc   { font-size: 13px; color: var(--gris-400); }
.dir-card__desc  { font-size: 13px; color: var(--gris-700); margin-top: 6px; }

.paginacion    { display: flex; align-items: center; justify-content: center;
                 gap: 16px; margin-top: 32px; }

.site-footer   { background: #1a1a1a; color: #aaa; padding: 24px; margin-top: 48px; }
.site-footer__inner { max-width: 1200px; margin: 0 auto;
                      display: flex; justify-content: space-between; align-items: center;
                      font-size: 13px; flex-wrap: wrap; gap: 12px; }
.site-footer nav a { color: #aaa; margin-left: 16px; }
.site-footer nav a:hover { color: #fff; }

/* Responsive */
@media (max-width: 900px) {
  .carta-editor    { grid-template-columns: 1fr; }
  .carta-editor__preview { display: none; }
  .estilo-editor   { grid-template-columns: 1fr; }
  .dir-layout      { grid-template-columns: 1fr; }
  .dir-sidebar     { border-right: none; border-bottom: 1px solid var(--gris-200); padding: 0 0 16px; }
  .dir-content     { padding-left: 0; }
}
@media (max-width: 600px) {
  .panel-main  { padding: 16px; }
  .locales-grid { grid-template-columns: 1fr; }
  .form-row    { flex-direction: column; }
  .modal__box  { padding: 20px 16px; }
}
