/* Base layout styles extending main.css */
@import url("./main.css");

:root {
  /* Header gradient (primary → secondary) */
  --grad-start: var(--color-primary);
  --grad-end: var(--color-secondary);
  --bg-warm: #fcf0c4;    /* warm paper */
  --ink: #111111;        /* strong black for outlines */
  --header-h: 72px;      /* used for full-height sections below header */
}

/* Page defaults for base layout */
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: var(--font-size-md); line-height: var(--line-height); }

/* Main page wrapper */
.page { padding: var(--space-6) 0; min-height: calc(100vh - var(--header-h)); background: var(--bg-warm); }
.page .container { display: block; }
.page.login-page { background: var(--bg-warm); }
.page.page--warm { background: var(--bg-warm); }

/* Simple card alignment used in auth and small forms */
.card {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-5);
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card--wide { max-width: 1100px; }
.card--fluid { max-width: none; }
/* Transparent card variant for split panels */
.card--ghost { background: transparent; border: none; box-shadow: none; }

/* Spacing helper used across legacy templates */
.row { margin-bottom: var(--space-3); }

/* Form basics matching legacy inline styles but using tokens */
label { display: block; font-weight: 600; margin-bottom: var(--space-2); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
}

/* Plain button look for unclassed <button> in base templates */
button {
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #000;
  cursor: pointer;
}
button:hover { background: var(--color-primary-dark); }

/* Anchor buttons */
.button { display:inline-block; padding:.5rem .8rem; border:none; border-radius:6px; background: var(--color-primary); color:#000; text-decoration:none; }
.button:hover { filter: brightness(1.02); }
.button--secondary { background: var(--color-secondary); color:#fff; }
.button--danger { background: #ef4444; color:#fff; }
.button--muted { background: #6b7280; color:#fff; }
.button + .button { margin-left:.5rem; }

/* Text utilities */
.muted { color: var(--muted); font-size: var(--font-size-sm); }
.page-title { font-size: 2rem; font-weight: 800; color: var(--gray-900); margin-bottom: var(--space-3); }
.error { color: var(--color-danger); margin-bottom: var(--space-2); }

/* Top navigation (header) */
.site-header {
  background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
  box-shadow: var(--shadow-md);
  margin-bottom: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  max-width: 1200px;
  margin: 0 auto;
}
.nav-actions { display: flex; gap: var(--space-4); }
.btn { display: inline-flex; align-items: center; gap: var(--space-2); padding: 12px 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 700; text-decoration: none; font-size: 1rem; }
.btn--nav-pill {
  background: var(--color-primary);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.btn--nav-pill:hover { filter: brightness(1.02); transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.25); }
.btn--nav-pill:active { transform: translateY(0); box-shadow: 0 2px 0 rgba(0,0,0,0.25); }
.btn--secondary-filled {
  background: var(--color-secondary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn--secondary-filled:hover { filter: brightness(0.97); box-shadow: var(--shadow-md); }
.btn--secondary-filled.is-active,
.btn--secondary-filled:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(251,4,4,0.15), var(--shadow-md);
}
.nav-logo { height: 70px; width: auto; display: block; }
.nav-brand a { text-decoration: none; display: inline-block; }

/* Flash messages area */
.flash-area { margin-top: var(--space-4); }
.alert-info { background: #e3f2fd; color: #0d47a1; }
/* Opt-in larger flash errors */
.page.flash-lg .flash-area .alert-error { font-size: 1.15rem; font-weight: 700; padding: 14px 16px; }

/* Content helpers */
.content-stack > * + * { margin-top: var(--space-4); }

/* Auth (login) page styles */
.auth-hero { text-align: center; padding: 7rem 0 5rem; }
.auth-title { font-size: 3rem; line-height: 1.15; color: var(--gray-900); margin-bottom: var(--space-2); }
.auth-subtitle { color: var(--gray-600); margin-bottom: var(--space-6); font-size: 1.05rem; }
.auth-form { max-width: 560px; margin: 0 auto; display: grid; gap: var(--space-4); }
.field-label { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gray-700); margin-bottom: var(--space-2); text-align: left; }
.auth-form .input, .auth-form input { width: 100%; height: 48px; font-size: 1rem; }
.btn--cta-gradient {
  background: linear-gradient(90deg, #ff4d4d, #f39c12);
  color: #fff;
  border-radius: 12px;
  border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  text-transform: uppercase;
  justify-content: center;
  padding: 12px 24px;
  min-width: 160px;
  font-weight: 800;
}
.btn--cta-gradient:hover { filter: brightness(1.02); box-shadow: 0 6px 14px rgba(0,0,0,0.12); }

/* Quiet link/button for secondary actions */
.btn--link-quiet { color: var(--gray-800); text-decoration: none; font-weight: 700; padding: 8px 10px; border-radius: 8px; }
.btn--link-quiet:hover { text-decoration: underline; }
.auth-note { text-align: center; margin-top: var(--space-2); }

/* Subtle divider for form sections */
.divider { height: 1px; background: var(--border); margin: var(--space-4) 0; }

/* Dashboard tiles (admin/receptor/cajera) */
.dashboard { padding: 3rem 0; }
.dashboard-title { text-align: center; font-size: 2rem; font-weight: 800; margin-bottom: var(--space-6); color: var(--gray-900); }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: var(--space-6); align-items: stretch; }
.tile {
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--color-primary);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.25);
  padding: var(--space-6) var(--space-4);
  font-weight: 800;
  font-size: 1.8rem;
  text-decoration: none;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 0 rgba(0,0,0,0.25); }
.tile:active { transform: translateY(0); box-shadow: 0 6px 0 rgba(0,0,0,0.25); }

/* Dashboard CTA below grid */
.dashboard-cta { margin-top: var(--space-6); display: flex; justify-content: center; }
.tile--wide { width: min(420px, 92%); margin: 0 auto; }

/* Dashboard find form */
.dashboard-form {
  margin-top: var(--space-6);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
}
.dashboard-form .input { width: 280px; height: 44px; }

/* Responsive layout */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}
@media (max-width: 640px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .tile { font-size: 1.6rem; padding: var(--space-6) var(--space-4); }
  .nav-inner { padding: var(--space-3) var(--space-4); }
}

/* Modal styles for inline edit ficha */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  z-index: 5000;
}
.modal {
  background: #fff;
  width: min(640px, 92%);
  margin: 8vh auto;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
}
.modal--ficha {
  background: #f7c948; /* warm yellow card */
  border: 4px solid #b11919;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.modal-header h3 { font-size: 1.8rem; font-weight: 800; }
.modal-close { background: transparent; color: var(--gray-700); font-size: 1.2rem; }
.modal-subtitle { color: #111; margin-bottom: var(--space-3); }
.modal-form .row { margin-bottom: var(--space-3); }
.modal-actions { display: flex; gap: var(--space-3); justify-content: flex-end; }
.btn-secondary { background: var(--gray-300); color: #111; }
.section-label { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: #111; margin-bottom: var(--space-2); font-weight: 700; }
.input--ficha { width: 100%; }
.btn--success { background: #2e7d32; color: #fff; }
.btn--success:hover { filter: brightness(1.02); }
.btn--danger { background: #d32f2f; color: #fff; }
.btn--danger:hover { filter: brightness(0.98); }

/* Ficha field blocks */
.ficha-group { margin-bottom: var(--space-4); }
.ficha-field { margin-bottom: var(--space-3); }
.ficha-field--readonly .ficha-label { font-weight: 700; color: #111; text-transform: none; }
.ficha-field--readonly .ficha-value { color: #111; background: transparent; padding: 6px 0; border-radius: 6px; }
.ficha-field--editable .ficha-label { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: #111; margin-bottom: var(--space-2); font-weight: 700; }

/* Clickable table rows helper */
.table-clickable tbody tr:hover { background: #f8fafc; }

/* Toolbar (filters/sort) */
.toolbar { margin: .5rem 0 1rem; display:grid; gap: var(--space-3); align-items:start; }
.toolbar-row { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.toolbar select, .toolbar input { width:auto; }
.input--sm { width: 220px; height: 36px; }

/* Form action alignment helpers */
.form-actions--left { display: flex; gap: var(--space-3); justify-content: flex-start; align-items: center; }

/* Equal-width action buttons */
.btn-eq { display: inline-flex; justify-content: center; align-items: center; width: 200px; }

/* Larger text utility for compact forms */
.text-lg { font-size: var(--font-size-lg); }
.text-lg .field-label { font-size: 0.95rem; }
.text-lg .input { height: 52px; font-size: 1.05rem; }
.text-lg .button { font-size: 1rem; }

/* Simple text alignment helpers */
.text-center { text-align: center; }

/* Simple metrics block to highlight key values */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: var(--space-4); margin: var(--space-4) 0; }
.metrics--vertical { grid-template-columns: 1fr; }
.metric { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: var(--space-4); text-align: center; }
.metric-label { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gray-700); margin-bottom: var(--space-2); font-weight: 700; }
.metric-value { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); }
.metric--saldo .metric-value { color: var(--color-danger); }
.metric--saldo-favor .metric-value { color: #31d139; }
.metric--limite-max .metric-value { font-weight: 800; }
.metric--limite-compra .metric-value { color: var(--color-success); font-weight: 800; }

/* Two-column split layout for side-by-side panels */
.layout-split { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-5); align-items: start; margin: var(--space-5) 0; }

/* Table styles */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem; border-bottom: 1px solid #e5e7eb; }
.table thead th { font-weight: 700; color: var(--gray-800); background: #fafafa; }
.table tbody tr:nth-child(odd) { background: #fcfcfc; }
.table .nowrap { white-space: nowrap; }
.table .col-observaciones { width: 340px; }

/* Badges for compact status labels */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; }
.badge--danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge--success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* Pagos calendar overrides */
.calendar-wrap { margin: var(--space-4) 0; }
#pagos-calendar .fc-daygrid .fc-daygrid-event { display: none !important; }
#pagos-calendar .fc-daygrid .fc-daygrid-more-link { display: none !important; }
#pagos-calendar .fc-daygrid-day-frame { position: relative; }
#pagos-calendar .fc-day-count { position: absolute; top: 50%; left: 0; width: 100%; transform: translateY(-50%); display: block; font-weight: 700; font-size: clamp(0.95rem, 1.4vw, 1.25rem); line-height: 1.2; text-align: center; pointer-events: none; }
