/* ============================================
   APOLOGAS PENSIONES — STYLES
   ============================================ */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #1c2330;
  --border: #30363d;
  --accent: #e8a000;
  --accent2: #ff6b35;
  --text: #e6edf3;
  --text2: #8b949e;
  --green: #3fb950;
  --red: #f85149;
  --admin: #58a6ff;
  --radius: 10px;
  --font-head: 'Oswald', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ---- LOGIN ---- */
.login-bg {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, #e8a00022 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, #ff6b3515 0%, transparent 50%);
  pointer-events: none;
}

#screen-login {
  display: flex; align-items: center; justify-content: center;
}
#screen-login.active { display: flex; }

.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.logo-area {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
}

.logo-area h1 {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
  line-height: 1;
}

.logo-area .subtitle {
  font-family: var(--font-head);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--text2);
  text-transform: uppercase;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text2);
}

/* ---- FIELDS ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text2);
}

.field input, .field select {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 14px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  width: 100%;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,160,0,0.15);
}

.field select option { background: var(--surface2); }
.req { color: var(--accent); }

.login-form { display: flex; flex-direction: column; gap: 18px; }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 13px 24px;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  text-transform: uppercase;
  width: 100%;
}

.btn-primary:hover {
  background: #ffb800;
  box-shadow: 0 4px 20px rgba(232,160,0,0.4);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 11px 20px;
  font-family: var(--font-head);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .2s;
}

.btn-secondary:hover {
  background: rgba(232,160,0,0.1);
}

.btn-logout {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}

.btn-logout:hover { color: var(--red); border-color: var(--red); }

.btn-print {
  background: #1c3a5e;
  color: var(--admin);
  border: 1px solid var(--admin);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-print:hover { background: #2a4f7a; }

.btn-delete {
  background: #3a1c1c;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.btn-delete:hover { background: #5c2424; }

.error-msg {
  background: rgba(248,81,73,0.12);
  color: var(--red);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
}

/* ---- TOPBAR ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}

.admin-bar { border-bottom-color: rgba(88,166,255,0.3); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-icon { font-size: 28px; }

.topbar-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}

.topbar-sub {
  font-size: 11px;
  color: var(--text2);
  letter-spacing: .5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  background: rgba(232,160,0,0.1);
  color: var(--accent);
  border: 1px solid rgba(232,160,0,0.3);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
}

.admin-badge {
  background: rgba(88,166,255,0.1);
  color: var(--admin);
  border-color: rgba(88,166,255,0.3);
}

/* ---- EMPLEADO MAIN ---- */
.emp-main {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-card, .table-card, .filter-card, .chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.form-header h2 {
  font-family: var(--font-head);
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--accent);
}

.folio-badge {
  background: var(--surface2);
  border: 1.5px dashed var(--accent);
  border-radius: 8px;
  padding: 8px 18px;
  font-family: var(--font-head);
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 1px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.field.full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.form-actions .btn-primary {
  width: auto;
  min-width: 260px;
}

/* ---- TABLE ---- */
.table-card h3 {
  font-family: var(--font-head);
  font-size: 16px;
  letter-spacing: 1.5px;
  color: var(--text);
  margin-bottom: 16px;
}

.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid rgba(48,54,61,0.5);
  transition: background .15s;
}

tbody tr:hover { background: rgba(255,255,255,0.02); }

tbody td {
  padding: 10px 14px;
  color: var(--text);
}

td.folio-cell {
  font-family: var(--font-head);
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 1px;
}

.empty-msg {
  text-align: center;
  color: var(--text2);
  padding: 32px;
  font-size: 14px;
}

/* ---- ADMIN MAIN ---- */
.admin-main {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  align-items: end;
  margin-top: 16px;
}

.btn-field {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

.btn-field .btn-primary,
.btn-field .btn-secondary {
  width: 100%;
}

/* KPI */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text2);
}

.kpi-value {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.kpi-sub { font-size: 12px; color: var(--text2); }

/* CHARTS */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-card.wide {
  grid-column: 1 / -1;
}

.chart-card h3 {
  font-family: var(--font-head);
  font-size: 15px;
  letter-spacing: 1.5px;
  color: var(--text);
  margin-bottom: 16px;
}

canvas { max-height: 240px; }
.chart-card.wide canvas { max-height: 200px; }

.table-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.count-badge {
  background: rgba(232,160,0,0.1);
  color: var(--accent);
  border: 1px solid rgba(232,160,0,0.3);
  border-radius: 12px;
  padding: 3px 12px;
  font-size: 12px;
}

/* ---- PRINT TICKET ---- */
@media print {
  body > * { display: none !important; }
  #print-area { display: block !important; }
}

#print-area {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  width: 72mm;
  padding: 4mm;
  color: #000;
}

.ticket {
  width: 100%;
}

.ticket-header {
  text-align: center;
  border-bottom: 1px dashed #000;
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.ticket-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
}

.ticket-sub {
  font-size: 9px;
  color: #333;
  margin-top: 2px;
}

.ticket-folio {
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 3px;
  padding: 8px 0;
  border: 2px solid #000;
  margin: 8px 0;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  margin: 3px 0;
  font-size: 10px;
}

.ticket-row span:first-child { font-weight: bold; }

.ticket-total {
  text-align: right;
  font-size: 14px;
  font-weight: 900;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #000;
}

.ticket-footer {
  text-align: center;
  margin-top: 10px;
  font-size: 9px;
  border-top: 1px dashed #000;
  padding-top: 6px;
}

/* Responsive */
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: 1; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: 1; }
  .topbar { padding: 12px 16px; }
  .topbar-sub { display: none; }
  .emp-main, .admin-main { padding: 0 12px; margin: 16px auto; }
  .login-card { padding: 32px 24px; margin: 16px; }
}
