/* ============================================================
   BASE.CSS — Variables, Reset, Shared Components
   ============================================================ */

:root {
  /* Color Palette */
  --c-bg:        #1a1c22;
  --c-surface:   #22252e;
  --c-surface2:  #2a2e38;
  --c-border:    #353944;
  --c-accent:    #c8a96e;   /* gold */
  --c-accent2:   #5b8dee;   /* blue */
  --c-danger:    #d64e4e;
  --c-success:   #4ec98a;
  --c-warn:      #e8a838;
  --c-text:      #e8eaf0;
  --c-text2:     #9ba3b5;
  --c-text3:     #5e6578;
  --c-white:     #ffffff;

  /* Typography */
  --f-display: 'DM Serif Display', Georgia, serif;
  --f-body:    'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 18px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
}

/* ---- MODO CLARO ---- */
body.light-mode {
  --c-bg:       #f0f2f5;
  --c-surface:  #ffffff;
  --c-surface2: #e8ebf0;
  --c-border:   #d0d5de;
  --c-accent:   #9a6f30;
  --c-accent2:  #2563eb;
  --c-danger:   #c0392b;
  --c-success:  #1a7a4a;
  --c-warn:     #c47a00;
  --c-text:     #1a1c22;
  --c-text2:    #4a5568;
  --c-text3:    #8a94a6;
  --c-white:    #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.15);
}

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

html, body {
  font-family: var(--f-body);
  font-size: 14px;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Inputs & Selects ---- */
input, select, textarea {
  font-family: var(--f-body);
  font-size: 13px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  width: 100%;
  outline: none;
  transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-accent);
}
input::placeholder { color: var(--c-text3); }
select option { background: var(--c-surface2); }

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
}
.field-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text2);
}

.category-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}
.flex1 { flex: 1; }

/* ---- Buttons ---- */
.btn-primary {
  background: var(--c-accent);
  color: #1a1208;
  border: none;
  border-radius: var(--r-sm);
  padding: 10px 18px;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  letter-spacing: .03em;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:active { transform: scale(.98); }

.btn-ghost {
  background: transparent;
  color: var(--c-text2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 10px 18px;
  font-family: var(--f-body);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: var(--c-accent); color: var(--c-accent); }

.btn-outline {
  background: transparent;
  color: var(--c-text2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-family: var(--f-body);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.btn-outline:hover { border-color: var(--c-accent2); color: var(--c-accent2); }

.btn-icon {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-accent);
  border-radius: var(--r-sm);
  width: 32px;
  height: 32px;
  display: flex;align-items:center;justify-content:center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.btn-icon:hover { background: var(--c-surface); }

.btn-full { width: 100%; text-align: center; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
.modal-sm { max-width: 360px; }
.modal-xl { max-width: 780px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.modal-title {
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--c-accent);
  margin-bottom: var(--sp-5);
}
.modal-hint {
  font-size: 12px;
  color: var(--c-text2);
  margin-bottom: var(--sp-4);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  flex-wrap: wrap;
}
.modal-error {
  color: var(--c-danger);
  font-size: 12px;
  min-height: 16px;
  margin-bottom: var(--sp-2);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }

/* ---- Utilities ---- */
.hidden { display: none !important; }

/* ---- VOUCHER PRINT ---- */
@media print {
  body > *:not(#voucherPrint) { display: none !important; }
  #voucherPrint { display: block !important; }
}

.voucher-print {
  display: none;
  font-family: var(--f-body);
  padding: 32px;
  color: #111;
  max-width: 480px;
  margin: auto;
}
.voucher-print .v-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid #222;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.voucher-print .v-logo img { width: 60px; height: 60px; object-fit: contain; }
.voucher-print .v-org h2 { font-size: 16px; font-weight: 700; }
.voucher-print .v-org p { font-size: 12px; color: #555; }
.voucher-print .v-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 16px;
}
.voucher-print table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.voucher-print td {
  padding: 6px 10px;
  border-bottom: 1px solid #e0e0e0;
}
.voucher-print td:first-child { color: #555; width: 38%; font-weight: 600; }
.voucher-print .v-monto td { font-size: 18px; font-weight: 700; }
.voucher-print .v-footer {
  margin-top: 20px;
  font-size: 11px;
  color: #999;
  text-align: center;
}

/* ---- TRANSICIÓN SUAVE AL CAMBIAR TEMA ---- */
body, body * {
  transition: background-color .25s, border-color .25s, color .2s;
}
/* Excepciones: no animar estas propiedades en imágenes ni inputs tipo file */
img, input[type="file"] { transition: none !important; }

/* ---- BOTÓN TEMA ---- */
.btn-theme {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  color: var(--c-text2);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.btn-theme:hover { border-color: var(--c-accent); color: var(--c-accent); }
