/* ============================================================
   OxidApp · shared.css
   Sistema de diseño unificado — v1.0
   ============================================================ */

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

/* ── Variables ──────────────────────────────────────────── */
:root {
  /* Fondos */
  --bg-page:      #0f172a;   /* fondo de página */
  --bg-nav:       #1e293b;   /* sidebar, header, tarjetas */
  --bg-card:      #1e293b;   /* tarjetas principales */
  --bg-inner:     #0f172a;   /* paneles internos, inputs */
  --bg-raised:    #263144;   /* hover, elementos elevados */

  /* Bordes */
  --border:       #334155;   /* borde estándar 1px */
  --border-focus: #3b82f6;   /* borde en foco/activo */

  /* Colores semánticos */
  --green:        #2ecc71;
  --red:          #ef4444;
  --blue:         #3b82f6;
  --yellow:       #facc15;

  /* Semánticos con opacidad (badges, alertas) */
  --green-bg:     rgba(46, 204, 113, 0.15);
  --green-border: rgba(46, 204, 113, 0.35);
  --red-bg:       rgba(239, 68,  68,  0.15);
  --red-border:   rgba(239, 68,  68,  0.35);
  --blue-bg:      rgba(59,  130, 246, 0.15);
  --blue-border:  rgba(59,  130, 246, 0.35);
  --yellow-bg:    rgba(250, 204, 21,  0.15);
  --yellow-border:rgba(250, 204, 21,  0.35);

  /* Textos */
  --text-strong:  #ffffff;
  --text-main:    #f1f5f9;
  --text-muted:   #94a3b8;
  --text-dim:     #475569;

  /* Tipografía */
  --font:         'Segoe UI', Roboto, system-ui, sans-serif;

  /* Escala de texto */
  --text-h1:      1.2rem;
  --text-h2:      1.1rem;
  --text-h3:      0.95rem;
  --text-base:    0.9rem;
  --text-sm:      0.82rem;
  --text-xs:      0.75rem;

  /* Radios */
  --radius-card:  20px;
  --radius-inner: 12px;
  --radius-badge: 8px;
  --radius-btn:   40px;

  /* Sombras */
  --shadow-card:  0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.55);
  --shadow-toast: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ── Base ───────────────────────────────────────────────── */
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ── Contenedor principal ───────────────────────────────── */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 16px;
}
@media (min-width: 800px) {
  .app-container { max-width: 900px; }
}

/* ── AdSpace ────────────────────────────────────────────── */
.ad-space {
  height: 55px;
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.header-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 8px 6px 0;
  flex-shrink: 0;
  line-height: 1;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.header-back:hover { color: var(--text-main); }

.header-title {
  flex: 1;
  font-size: var(--text-h1);
  font-weight: 600;
  color: var(--yellow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-title .tool-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ── Selector de idioma (dropdown) ─────────────────────── */
.lang-dropdown {
  position: relative;
  flex-shrink: 0;
}

.lang-trigger {
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 5px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.lang-trigger:hover { border-color: var(--blue); }
.lang-trigger .lang-arrow {
  font-size: 0.4rem;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.lang-dropdown.open .lang-trigger { border-color: var(--blue); }
.lang-dropdown.open .lang-arrow { transform: rotate(180deg); }

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  box-shadow: var(--shadow-card);
  z-index: 500;
  min-width: 100px;
  overflow: hidden;
}
.lang-dropdown.open .lang-menu { display: block; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--font);
  transition: background 0.1s, color 0.1s;
}
.lang-option:hover { background: var(--bg-raised); color: var(--text-main); }
.lang-option.active { color: var(--blue); font-weight: 700; }

/* ── Tarjeta principal ──────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

/* ── Separador de sección ───────────────────────────────── */
.separator {
  text-transform: uppercase;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin: 18px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--yellow);
}
.separator:first-child { margin-top: 0; }

/* ── Panel interno ──────────────────────────────────────── */
.section-card {
  background: var(--bg-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 14px;
  margin-bottom: 10px;
}
.section-card:last-child { margin-bottom: 0; }

.section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-size {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 10px;
}
.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Botones de acción ──────────────────────────────────── */
.action-btn {
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.action-btn:active { opacity: 0.75; }

/* Variantes */
.btn-primary {
  background: var(--green);
  color: #0f172a;
  border: none;
}
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-raised); }

.btn-export {
  background: var(--blue-bg);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}
.btn-export:hover { background: rgba(59,130,246,0.25); }

.btn-import {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.btn-import:hover { background: rgba(46,204,113,0.25); }

.btn-delete {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-delete:hover { background: rgba(239,68,68,0.25); }

/* ── Zona de peligro ────────────────────────────────────── */
.danger-zone {
  background: var(--bg-inner);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-inner);
  padding: 14px;
  margin-bottom: 10px;
}
.danger-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--red);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.danger-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
  padding: 9px 14px;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.zip-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 10px;
  font-style: italic;
  line-height: 1.5;
}

/* ── Footer de navegación ───────────────────────────────── */
.footer-bar {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}

.footer-btn {
  text-align: center;
  background: var(--bg-nav);
  border: 1px solid var(--border);
  padding: 12px 10px;
  border-radius: var(--radius-btn);
  color: var(--text-main);
  text-decoration: none;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.footer-btn:hover {
  background: var(--bg-raised);
  border-color: var(--yellow);
  color: var(--yellow);
}

/* Ancho footer: 40% menú / 60% guía */
.footer-btn.btn-menu  { flex: 0 0 38%; }
.footer-btn.btn-guide { flex: 1; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text-main);
  color: var(--bg-page);
  padding: 11px 22px;
  border-radius: var(--radius-btn);
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 700;
  box-shadow: var(--shadow-toast);
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  border-left: 4px solid var(--green);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-error  { border-left-color: var(--red); }
.toast.toast-info   { border-left-color: var(--blue); }
.toast.toast-warn   { border-left-color: var(--yellow); }

/* ── Modal / Dialog ─────────────────────────────────────── */
.custom-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 8000;
  padding: 20px;
}
.custom-dialog-overlay.active { display: flex; }

.custom-dialog-box {
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-modal);
}
.custom-dialog-msg {
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-main);
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.custom-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.custom-dialog-actions button {
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-family: var(--font);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.custom-dialog-actions button:active { opacity: 0.75; }
.custom-dialog-ok     { background: var(--green); color: #0f172a; }
.custom-dialog-cancel { background: transparent; color: var(--text-muted); border: 1px solid var(--border) !important; }

/* ── Inputs y selects ───────────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
  background: var(--bg-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  color: var(--text-main);
  font-family: var(--font);
  font-size: var(--text-base);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}
input::placeholder { color: var(--text-dim); }

/* ── Labels ─────────────────────────────────────────────── */
label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

/* ── Badges semánticos ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: var(--text-xs);
  font-weight: 600;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-border); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }

/* ── Links ──────────────────────────────────────────────── */
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--text-main); }

/* ── Utilidades ─────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-main   { color: var(--text-main); }
.text-yellow { color: var(--yellow); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.italic      { font-style: italic; }
.mt-8        { margin-top: 8px; }
.mt-12       { margin-top: 12px; }
.mt-16       { margin-top: 16px; }
.mb-8        { margin-bottom: 8px; }
.mb-12       { margin-bottom: 12px; }
.mb-16       { margin-bottom: 16px; }

/* ── Scrollbar (webkit) ─────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
