/* ============================================================
   PAPIRO STUDIO — Base CSS
   css/ps-base.css
   Reset · Variables · Tipografía · Utilidades
   ============================================================ */

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); background: var(--color-bg-page); color: var(--color-text-primary); min-height: 100vh; line-height: 1.5; }
img, video { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Tokens de diseño ─────────────────────────────────────── */
:root {
  /* Tipografía */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Marca */
  --ps-red:     #E63025;
  --ps-red-dk:  #C9261C;
  --ps-dark:    #0F1117;
  --ps-mid:     #1A1D2B;
  --ps-panel:   #22263A;
  --ps-light:   #F0F1F5;

  /* Redes sociales */
  --fb:  #1877F2; --fb-bg:  #EBF3FE; --fb-txt:  #0D4DB8;
  --ig:  #C13584; --ig-bg:  #FCE4F3; --ig-txt:  #831059;
  --li:  #0A66C2; --li-bg:  #E7F0FA; --li-txt:  #054D96;
  --tt:  #161616; --tt-bg:  #E5E5E5; --tt-txt:  #111111;
  --yt:  #FF0000; --yt-bg:  #FFE5E5; --yt-txt:  #CC0000;
  --tw:  #1DA1F2; --tw-bg:  #E5F5FE; --tw-txt:  #0D7BC4;
  --pi:  #E60023; --pi-bg:  #FFE5E8; --pi-txt:  #B5001C;
  --gn:  #34A853; --gn-bg:  #E6F4EA; --gn-txt:  #1E7A35;

  /* Objetivos */
  --edu-color: #059669; --edu-bg: #D1FAE5;
  --com-color: #7C3AED; --com-bg: #EDE9FE;
  --exp-color: #D97706; --exp-bg: #FEF3C7;
  --atr-color: #DC2626; --atr-bg: #FEE2E2;

  /* Escala de grises */
  --g50:  #F9FAFB; --g100: #F3F4F6; --g200: #E5E7EB;
  --g300: #D1D5DB; --g400: #9CA3AF; --g500: #6B7280;
  --g600: #4B5563; --g700: #374151; --g800: #1F2937; --g900: #111827;

  /* Colores semánticos */
  --color-success:  #059669; --color-success-bg:  #D1FAE5;
  --color-warning:  #D97706; --color-warning-bg:  #FEF3C7;
  --color-danger:   #E63025; --color-danger-bg:   #FEE2E2;
  --color-info:     #2563EB; --color-info-bg:     #DBEAFE;

  /* Fondos */
  --color-bg-page:    #F0F1F5;
  --color-bg-card:    #FFFFFF;
  --color-bg-surface: #F9FAFB;

  /* Texto */
  --color-text-primary:   #111827;
  --color-text-secondary: #374151;
  --color-text-muted:     #6B7280;
  --color-text-disabled:  #9CA3AF;

  /* Bordes */
  --color-border:       #E5E7EB;
  --color-border-dark:  #D1D5DB;
  --color-border-focus: #94A3B8;

  /* Radios */
  --r-xs:  4px;
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Sombras */
  --sh-xs: 0 1px 2px rgba(0,0,0,.06);
  --sh-sm: 0 1px 4px rgba(0,0,0,.08);
  --sh-md: 0 4px 16px rgba(0,0,0,.12);
  --sh-lg: 0 8px 32px rgba(0,0,0,.16);
  --sh-xl: 0 20px 60px rgba(0,0,0,.22);

  /* Transiciones */
  --tr-fast:   0.1s ease;
  --tr-base:   0.15s ease;
  --tr-slow:   0.25s ease;

  /* Z-index layers */
  --z-base:    1;
  --z-dropdown: 100;
  --z-sticky:  200;
  --z-modal:   500;
  --z-toast:   900;
}

/* ── Scrollbars ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g300); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--g400); }

/* ── Focus visible (accesibilidad) ───────────────────────── */
:focus-visible {
  outline: 2px solid var(--ps-red);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ── Tipografía ───────────────────────────────────────────── */
.text-xs   { font-size: 10px; }
.text-sm   { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg   { font-size: 16px; }
.text-xl   { font-size: 20px; }
.text-2xl  { font-size: 24px; }
.text-3xl  { font-size: 30px; }

.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

.text-muted   { color: var(--color-text-muted); }
.text-primary { color: var(--color-text-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-info    { color: var(--color-info); }
.text-white   { color: #fff; }

.label-caps {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--color-text-muted);
}

/* ── Utilidades de layout ─────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1      { flex: 1; }
.flex-wrap   { flex-wrap: wrap; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.hidden   { display: none !important; }
.sr-only  {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── Tags / Chips ─────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 10px; font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--r-full);
  line-height: 1.5;
  white-space: nowrap;
}
/* Tag de objetivo — rectangular con acento izquierdo */
.tag-obj {
  border-radius: var(--r-xs);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .02em;
  border-left: 2.5px solid currentColor;
}
/* Tags de redes */
.tag-fb  { background: var(--fb-bg);  color: var(--fb-txt); }
.tag-ig  { background: var(--ig-bg);  color: var(--ig-txt); }
.tag-li  { background: var(--li-bg);  color: var(--li-txt); }
.tag-tt  { background: var(--tt-bg);  color: var(--tt-txt); }
.tag-yt  { background: var(--yt-bg);  color: var(--yt-txt); }
.tag-tw  { background: var(--tw-bg);  color: var(--tw-txt); }
.tag-pi  { background: var(--pi-bg);  color: var(--pi-txt); }
.tag-gn  { background: var(--gn-bg);  color: var(--gn-txt); }
/* Tags de objetivos */
.tag-edu  { background: var(--edu-bg);  color: var(--edu-color); }
.tag-com  { background: var(--com-bg);  color: var(--com-color); }
.tag-exp  { background: var(--exp-bg);  color: var(--exp-color); }
.tag-atr  { background: var(--atr-bg);  color: var(--atr-color); }
.tag-div  { background: #FCE7F3; color: #BE185D; }
.tag-meme { background: #FFF7ED; color: #C2410C; }
.tag-ins  { background: #EEF2FF; color: #4338CA; }
.tag-test { background: #E0F2FE; color: #0369A1; }
.tag-vend { background: #ECFDF5; color: #065F46; }
.tag-tend { background: #F5F3FF; color: #5B21B6; }
.tag-efem { background: #F0FDFA; color: #0F766E; }
.tag-bts  { background: #F1F5F9; color: #475569; }
/* Otros */
.tag-prio { background: #FEE2E2; color: #991B1B; }
.tag-hora { background: var(--g100); color: var(--g500); border: 1px solid var(--g200); }

/* ── Botones ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-size: 12px; font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--tr-base);
  white-space: nowrap; line-height: 1;
  cursor: pointer;
}
.btn:disabled { opacity: .4; pointer-events: none; }

.btn-primary   { background: var(--ps-red);  color: #fff; border-color: var(--ps-red); }
.btn-primary:hover  { background: var(--ps-red-dk); }

.btn-secondary { background: var(--g100); color: var(--g700); border-color: var(--g200); }
.btn-secondary:hover { background: var(--g200); }

.btn-ghost    { background: transparent; color: var(--g500); border-color: var(--g200); }
.btn-ghost:hover { background: var(--g100); color: var(--g700); }

.btn-danger   { background: var(--color-danger-bg); color: var(--color-danger); border-color: rgba(230,48,37,.3); }
.btn-danger:hover { background: rgba(230,48,37,.2); }

/* Dark variants (para headers oscuros) */
.btn-dark     { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.15); }
.btn-dark:hover { background: rgba(255,255,255,.18); }

.btn-dark-primary { background: var(--ps-red); color: #fff; border-color: var(--ps-red); }
.btn-dark-primary:hover { background: var(--ps-red-dk); }

/* Tamaños */
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px 8px; }

/* ── Formularios ──────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--color-text-muted);
}
.field-input, .field-textarea, .field-select {
  width: 100%; padding: 8px 11px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--r-sm);
  font-size: 13px; color: var(--color-text-primary);
  font-family: var(--font-sans);
  transition: border-color var(--tr-base), box-shadow var(--tr-base);
  outline: none;
}
.field-input:focus, .field-textarea:focus, .field-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(148,163,184,.15);
}
.field-input::placeholder, .field-textarea::placeholder {
  color: var(--color-text-disabled);
}
.field-textarea { resize: vertical; min-height: 70px; line-height: 1.6; }

/* Dark field variants */
.field-input-dark, .field-select-dark {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.13);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 8px 11px;
  font-size: 13px; font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--tr-base);
}
.field-input-dark::placeholder { color: rgba(255,255,255,.25); }
.field-input-dark:focus, .field-select-dark:focus { border-color: rgba(255,255,255,.35); }
.field-select-dark option { background: var(--ps-mid); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle-switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--g300);
  border-radius: var(--r-full); cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; left: 3px; top: 3px; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--ps-red); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }
.toggle-label { font-size: 13px; color: var(--color-text-secondary); cursor: pointer; }

/* ── Toast / Notificaciones ───────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 18px; border-radius: var(--r-lg);
  font-size: 13px; font-weight: 500; color: #fff;
  background: var(--g800); border: 1px solid rgba(255,255,255,.1);
  box-shadow: var(--sh-lg);
  transform: translateY(80px); opacity: 0;
  transition: all var(--tr-slow);
  z-index: var(--z-toast); pointer-events: none;
}
.toast.show  { transform: translateY(0); opacity: 1; }
.toast.ok    { background: rgba(5,150,105,.9);   border-color: rgba(110,231,183,.3); }
.toast.err   { background: rgba(230,48,37,.9);   border-color: rgba(252,165,165,.3); }
.toast.warn  { background: rgba(217,119,6,.9);   border-color: rgba(253,230,138,.3); }
.toast.info  { background: rgba(37,99,235,.9);   border-color: rgba(147,197,253,.3); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { font-size: 14px; }
}
