/* ═══════════════════════════════════════════════════════════════
   TURNERO PROFESIONAL — Main CSS
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary:      #0D2137;
  --primary-dark: #081525;
  --accent:       #C9A84C;
  --accent-light: #F0D78A;
  --white:        #FFFFFF;
  --gray-100:     #F8F9FA;
  --gray-200:     #E9ECEF;
  --gray-600:     #6C757D;
  --success:      #198754;
  --danger:       #DC3545;
  --warning:      #FFC107;
  --radius:       16px;
  --shadow:       0 4px 24px rgba(0,0,0,.12);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.18);
}

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

body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; }

/* ═══════════════════════════════════════════════════════════════
   PANTALLA CLIENTE
   ═══════════════════════════════════════════════════════════════ */

.client-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #F0F4F8 0%, #D9E4EF 100%);
  display: flex;
  flex-direction: column;
}

/* Header */
.client-header {
  background: var(--primary);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 16px rgba(0,0,0,.3);
}
.client-header-inner { display: flex; align-items: center; gap: 16px; }
.header-icon { font-size: 2.2rem; color: var(--accent); }
.header-title { font-size: 1.6rem; font-weight: 700; color: var(--white); margin: 0; }
.header-sub   { font-size: .85rem; color: rgba(255,255,255,.65); margin: 0; }
.header-time  { font-size: 1.6rem; font-weight: 600; color: var(--accent); letter-spacing: 2px; }

/* Screens */
.client-screen {
  display: none;
  flex: 1;
  padding: 32px 24px;
  animation: fadeIn .3s ease;
}
.client-screen.active { display: flex; flex-direction: column; align-items: center; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 28px;
  text-align: center;
}

/* Areas grid */
.areas-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 700px;
}

@media (min-width: 768px) {
  .areas-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; max-width: 800px; }
}
@media (min-width: 992px) {
  .areas-grid { grid-template-columns: repeat(4, 1fr); max-width: 1000px; }
}

.area-card {
  background: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 28px 16px 24px;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.area-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--area-color, var(--primary));
}
.area-card:hover, .area-card:focus {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  outline: none;
}
.area-card:active { transform: translateY(-2px); }

.area-card-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--area-color, var(--primary)) 12%, white);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.8rem;
  color: var(--area-color, var(--primary));
}
.area-card-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}
.area-card-badge {
  position: absolute;
  top: 12px; right: 12px;
  color: var(--area-color, var(--primary));
  font-size: .85rem;
}

/* Botón volver */
.btn-back {
  background: none; border: none;
  color: var(--primary); font-weight: 600;
  cursor: pointer; font-size: .95rem;
  padding: 8px 0; margin-bottom: 16px;
  display: flex; align-items: center;
}
.btn-back:hover { color: var(--accent); }

/* ── Impresión ── */
.printing-container {
  text-align: center;
  padding: 40px 20px;
}
.printer-icon {
  font-size: 4rem;
  color: var(--primary);
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
}
.printer-paper {
  position: absolute;
  bottom: -2px; left: 50%;
  transform: translateX(-50%);
  width: 36px;
  background: white;
  border: 1px solid #ccc;
  height: 0;
  transition: height .1s;
  border-radius: 0 0 4px 4px;
}
.printing-text {
  font-size: 1.2rem;
  color: var(--gray-600);
  margin-bottom: 20px;
}
.printing-progress { width: 260px; margin: 0 auto; height: 8px; border-radius: 4px; }

/* ── Ticket ── */
.ticket-container { display: flex; flex-direction: column; align-items: center; }

.ticket {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 320px;
  overflow: hidden;
  animation: slideUp .4s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ticket-header {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 20px 16px 16px;
}
.ticket-empresa { font-size: .9rem; font-weight: 600; letter-spacing: 1px; }
.ticket-fecha   { font-size: .75rem; opacity: .7; margin-top: 4px; }

.ticket-body {
  padding: 28px 24px;
  text-align: center;
  border-bottom: 2px dashed var(--gray-200);
}
.ticket-label  { font-size: .8rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 1px; }
.ticket-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -1px;
  margin: 8px 0;
}
.ticket-area   { font-size: 1rem; font-weight: 600; color: var(--primary); }
.ticket-subarea { font-size: .85rem; color: var(--gray-600); margin-top: 4px; }

.ticket-footer {
  padding: 14px 16px;
  text-align: center;
  font-size: .85rem;
  color: var(--gray-600);
  background: var(--gray-100);
}
.ticket-tear {
  height: 12px;
  background: repeating-linear-gradient(90deg, white 0, white 8px, var(--gray-200) 8px, var(--gray-200) 10px);
}

.countdown-text { color: var(--gray-600); font-size: .9rem; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════ */

.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-card {
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-header {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 32px 24px 24px;
}
.login-body-inner { padding-top: 24px; }

/* ═══════════════════════════════════════════════════════════════
   VISOR TV
   ═══════════════════════════════════════════════════════════════ */

.visor-body {
  min-height: 100vh;
  background: #0A0E1A;
  color: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visor-header {
  background: var(--primary);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--accent);
  flex-shrink: 0;
}
.visor-header-left { display: flex; align-items: center; gap: 16px; }
.visor-logo-icon   { font-size: 2rem; color: var(--accent); }
.visor-empresa     { font-size: 1.4rem; font-weight: 700; color: white; }
.visor-eslogan     { font-size: .8rem; color: rgba(255,255,255,.6); }
.visor-header-right { text-align: right; }
.visor-clock       { font-size: 2rem; font-weight: 700; color: var(--accent); letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.visor-date        { font-size: .8rem; color: rgba(255,255,255,.6); text-transform: capitalize; }

.visor-body-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  overflow: hidden;
}

/* Columna izquierda */
.visor-left {
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  overflow: hidden;
}

.visor-current-card {
  background: linear-gradient(135deg, #0D2137 0%, #1a3a5c 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  flex-shrink: 0;
  transition: border-color .3s, box-shadow .3s;
}
.visor-current-card.visor-flash {
  border-color: #4CAF50;
  box-shadow: 0 0 40px rgba(76,175,80,.5);
  animation: flashPulse .5s ease 3;
}
@keyframes flashPulse {
  0%, 100% { box-shadow: 0 0 40px rgba(76,175,80,.5); }
  50%       { box-shadow: 0 0 80px rgba(76,175,80,.9); }
}

.visor-current-label {
  font-size: .85rem;
  letter-spacing: 3px;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.visor-current-ticket {
  font-size: 5.5rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -2px;
  text-shadow: 0 0 40px rgba(201,168,76,.4);
  font-variant-numeric: tabular-nums;
}
.visor-current-ventanilla {
  font-size: 1.6rem;
  font-weight: 600;
  color: white;
  margin-top: 10px;
}
.visor-current-area {
  font-size: .95rem;
  color: rgba(255,255,255,.6);
  margin-top: 4px;
}

/* Recientes */
.visor-recientes-wrap {
  flex: 1;
  background: rgba(255,255,255,.04);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.visor-recientes-title {
  font-size: .8rem;
  letter-spacing: 2px;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.visor-recientes-list { flex: 1; overflow: hidden; }

.visor-reciente-row {
  display: grid;
  grid-template-columns: 120px 1fr 140px 80px;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .9rem;
  align-items: center;
}
.visor-reciente-row.vr-first { background: rgba(201,168,76,.06); border-radius: 8px; padding: 10px 12px; }
.vr-ticket { font-weight: 700; color: var(--accent); font-size: 1.05rem; }
.vr-area   { color: rgba(255,255,255,.7); }
.vr-caja   { color: rgba(255,255,255,.5); font-size: .85rem; }
.vr-hora   { color: rgba(255,255,255,.4); font-size: .8rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Columna derecha */
.visor-right {
  background: #060A12;
  border-left: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visor-pub-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}
.visor-pub-label {
  font-size: .75rem;
  letter-spacing: 2px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.visor-pub-slider {
  flex: 1;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #111827;
}
.visor-pub-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .8s ease;
}
.visor-pub-img.active { opacity: 1; }
.visor-pub-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255,255,255,.25);
  text-align: center;
  padding: 24px;
}

.visor-pendientes-wrap {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.visor-pendientes-title {
  font-size: .75rem;
  letter-spacing: 2px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.visor-pendiente-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.vpi-area  { font-size: .82rem; color: rgba(255,255,255,.65); }
.vpi-badge {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.5);
  border-radius: 20px;
  padding: 2px 12px;
  font-size: .8rem;
  font-weight: 600;
  min-width: 36px;
  text-align: center;
}
.vpi-badge.vpi-badge-active {
  background: var(--accent);
  color: var(--primary-dark);
}

/* ═══════════════════════════════════════════════════════════════
   LLAMADOR
   ═══════════════════════════════════════════════════════════════ */

.llamador-body {
  min-height: 100vh;
  background: var(--gray-100);
  display: flex;
  flex-direction: column;
}

.llamador-navbar {
  background: var(--primary);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  flex-shrink: 0;
}
.lnav-left  { display: flex; align-items: center; gap: 10px; color: white; }
.lnav-right { display: flex; align-items: center; gap: 10px; }
.lnav-empresa { font-weight: 700; color: var(--accent); font-size: .95rem; }
.lnav-sep     { color: rgba(255,255,255,.3); }
.lnav-modulo  { color: rgba(255,255,255,.75); font-size: .9rem; }
.lnav-user    { color: white; font-size: .9rem; }
.lnav-clock   { color: var(--accent); font-weight: 600; font-size: .9rem; font-variant-numeric: tabular-nums; }

.llamador-content {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  overflow: hidden;
}

.llamador-sidebar {
  padding: 20px;
  border-right: 1px solid var(--gray-200);
  overflow-y: auto;
  background: white;
}

.lcard {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.lcard-title {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray-600);
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
}

.lcard-turno-actual { text-align: center; padding: 8px 0; }
.lta-ticket {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -1px;
}
.lta-area { font-size: .9rem; color: var(--gray-600); margin-top: 4px; }
.lta-hora { font-size: .8rem; color: var(--gray-600); }

.btn-llamar {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  font-weight: 700 !important;
  padding: 14px !important;
  font-size: 1.05rem !important;
  border-radius: 10px !important;
  letter-spacing: .5px;
  transition: transform .15s, box-shadow .15s !important;
}
.btn-llamar:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13,33,55,.3) !important;
}
.btn-llamar:active:not(:disabled) { transform: translateY(0); }

.lpend-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-200);
}
.lpend-area  { font-size: .88rem; color: #333; }
.lpend-count { min-width: 32px; text-align: center; }

/* Main historial */
.llamador-main {
  padding: 24px;
  overflow-y: auto;
}
.lmain-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.lmain-title    { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin: 0; }
.lmain-subtitle { font-size: .85rem; color: var(--gray-600); }
.lmain-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-600); }

/* ═══════════════════════════════════════════════════════════════
   ESTADÍSTICAS
   ═══════════════════════════════════════════════════════════════ */

.stats-body {
  min-height: 100vh;
  background: var(--gray-100);
  display: flex;
  flex-direction: column;
}
.stats-container { padding: 24px; flex: 1; }

.stats-tabs .nav-link {
  color: var(--gray-600);
  font-weight: 600;
  border-radius: 8px 8px 0 0 !important;
}
.stats-tabs .nav-link.active { color: var(--primary); }

.stats-tab-content { display: none; }
.stats-tab-content.active { display: block; }

.stats-filters { border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.kpi-card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-top: 4px solid transparent;
}
.kpi-total   { border-top-color: var(--primary); }
.kpi-atendido{ border-top-color: var(--success); }
.kpi-ausente { border-top-color: var(--warning); }
.kpi-espera  { border-top-color: #0dcaf0; }

.kpi-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
  opacity: .7;
}
.kpi-val   { font-size: 2.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.kpi-label { font-size: .8rem; color: var(--gray-600); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

.stats-chart-card {
  background: white;
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.stats-chart-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray-600);
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

/* Publicidad gallery */
.pub-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pub-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.pub-thumb {
  width: 140px;
  height: 100px;
  object-fit: cover;
  display: block;
}
.pub-item-name {
  font-size: .7rem;
  padding: 4px 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.pub-delete {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  padding: 0;
  border-radius: 50% !important;
  display: flex; align-items: center; justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .client-header     { padding: 12px 16px; }
  .header-title      { font-size: 1.2rem; }
  .header-time       { display: none; }
  .areas-grid        { grid-template-columns: 1fr 1fr; gap: 14px; }
  .area-card         { padding: 20px 12px 18px; }
  .area-card-icon    { width: 54px; height: 54px; font-size: 1.4rem; }
  .area-card-label   { font-size: .88rem; }
  .ticket            { width: 290px; }
  .ticket-number     { font-size: 2.8rem; }

  .visor-body-grid   { grid-template-columns: 1fr; }
  .visor-right       { display: none; }
  .visor-current-ticket { font-size: 3.5rem; }

  .llamador-content  { grid-template-columns: 1fr; }
  .llamador-sidebar  { border-right: none; border-bottom: 1px solid var(--gray-200); }
}

@media (max-width: 480px) {
  .areas-grid { grid-template-columns: 1fr; }
  .ticket     { width: 100%; max-width: 320px; }
}

/* Scrollbar personalizado */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
