/* =========================================================
   ESTILO APP — ID Soluciones
   Extraído y generalizado desde dashboard-tecnico.php.
   Referencia visual única para todo el sistema (KRONOS-3841).
   Requiere Bootstrap 5.3.3 + Phosphor Icons + fuente Inter.
   ========================================================= */

:root {
  --primary: #DC2626;
  --primary-dark: #B91C1C;
  --secondary: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --dark: #1e293b;
  --light: #f8fafc;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

body.app-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #c6c7ca 0%, #ee6a6a 100%);
  min-height: 100vh;
  margin: 0;
  color: var(--dark);
}

/* ── Barra superior ─────────────────────────────────────── */
.top-bar {
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(10px);
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.1);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo { height: 45px; }
.top-right { display: flex; align-items: center; gap: .75rem; }
.top-user { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 600; color: var(--secondary); }
.top-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),var(--primary-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .9375rem; }
.back-btn { display: inline-flex; align-items: center; gap: .375rem; padding: .4375rem .875rem; background: #fff; border: 2px solid var(--border); border-radius: 20px; font-size: .8125rem; font-weight: 700; color: var(--secondary); text-decoration: none; transition: all .2s; }
.back-btn:hover { border-color: var(--primary); color: var(--primary); }
.logout-btn { width: 45px; height: 45px; border-radius: 50%; background: #fff; border: 2px solid var(--border); color: var(--secondary); cursor: pointer; transition: all .3s; text-decoration: none; display: flex; align-items: center; justify-content: center; font-size: 1.375rem; }
.logout-btn:hover { border-color: var(--primary); color: var(--primary); transform: rotate(15deg); }

/* ── Menú de navegación ─────────────────────────────────── */
.app-menu { background: #fff; padding: .75rem 1rem; display: flex; gap: .5rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.app-menu a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; color: var(--secondary); font-weight: 500; font-size: .875rem; text-decoration: none; transition: all .2s; }
.app-menu a:hover { background: #fef2f2; color: var(--primary); }
.app-menu a.active { background: var(--primary); color: #fff; }

/* ── Banner admin/aviso ─────────────────────────────────── */
.admin-banner { display: flex; align-items: center; gap: .75rem; padding: .875rem 1.25rem; background: linear-gradient(135deg,rgba(220,38,38,.08),rgba(185,28,28,.04)); border: 1.5px solid rgba(220,38,38,.2); border-radius: 12px; margin-bottom: 1.5rem; font-size: .875rem; font-weight: 600; color: var(--primary); }
.admin-banner i { font-size: 1.25rem; }

/* ── Contenedor ──────────────────────────────────────────── */
.app-container { max-width: 1400px; margin: 0 auto; padding: 2rem; }

/* ── Bloque de bienvenida ───────────────────────────────── */
.welcome-section { background: #fff; border-radius: 20px; padding: 2rem; margin-bottom: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,.1); border: 2px solid var(--border); }
.welcome-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1rem; }
.user-avatar-large { width: 70px; height: 70px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),var(--primary-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 2rem; box-shadow: 0 8px 20px rgba(220,38,38,.3); flex-shrink: 0; }
.welcome-content { flex: 1; }
.welcome-title { font-size: 1.75rem; font-weight: 800; color: var(--dark); margin-bottom: .5rem; }
.welcome-subtitle { font-size: 1rem; color: var(--secondary); margin-top: .75rem; }

/* ── Tarjetas de estadísticas ───────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: 16px; padding: 1.5rem; box-shadow: 0 10px 30px rgba(0,0,0,.1); border: 2px solid var(--border); transition: all .3s; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary); }
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 15px 40px rgba(0,0,0,.15); }
.stat-card.c-info::before { background: var(--info); }
.stat-card.c-warning::before { background: var(--warning); }
.stat-card.c-success::before { background: var(--success); }
.stat-card.c-primary::before { background: var(--primary); }
.stat-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: #fff; background: linear-gradient(135deg,var(--primary),var(--primary-dark)); }
.stat-icon.c-info { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.stat-icon.c-warning { background: linear-gradient(135deg,#f59e0b,#d97706); }
.stat-icon.c-success { background: linear-gradient(135deg,#10b981,#059669); }
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: .875rem; color: var(--secondary); font-weight: 600; margin-top: .5rem; }

/* ── Tarjetas de acción rápida ──────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.action-card { background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,.1); border: 2px solid var(--border); text-decoration: none; transition: all .3s; display: flex; flex-direction: column; gap: 1rem; }
.action-card:hover { transform: translateY(-4px); box-shadow: 0 15px 40px rgba(0,0,0,.15); border-color: var(--primary); }
.action-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.75rem; color: #fff; background: linear-gradient(135deg,var(--primary),var(--primary-dark)); }
.action-title { font-size: 1.125rem; font-weight: 700; color: var(--dark); }
.action-desc { font-size: .875rem; color: var(--secondary); line-height: 1.5; }

/* ── Tarjetas de contenido / listados ───────────────────── */
.content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.content-card { background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.1); border: 2px solid var(--border); overflow: hidden; }
.content-header { background: linear-gradient(135deg,var(--light),#fff); padding: 1.5rem; border-bottom: 2px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; }
.content-title { font-size: 1.125rem; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: .5rem; }
.content-title i { font-size: 1.5rem; color: var(--primary); }
.view-all { font-size: .875rem; color: var(--primary); text-decoration: none; font-weight: 600; }
.view-all:hover { text-decoration: underline; }
.content-body { padding: 1.5rem; }

/* ── Item genérico de lista (visita/tarea/ticket/etc.) ──── */
.list-item { padding: 1rem; border: 2px solid var(--border); border-radius: 12px; margin-bottom: 1rem; transition: all .3s; }
.list-item:last-child { margin-bottom: 0; }
.list-item:hover { border-color: var(--primary); background: rgba(220,38,38,.02); }
.list-item-title { font-weight: 700; color: var(--dark); font-size: .9375rem; margin-bottom: .5rem; display: block; }
.list-item-sub { font-size: .875rem; color: var(--secondary); margin-bottom: .5rem; }
.list-item-meta { display: flex; gap: 1rem; font-size: .8125rem; color: var(--secondary); flex-wrap: wrap; }
.list-item-meta span { display: flex; align-items: center; gap: .25rem; }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--secondary); }
.empty-state i { font-size: 4rem; margin-bottom: 1rem; opacity: .3; display: block; }
.empty-state p { font-weight: 600; font-size: .9375rem; }

/* ── Tabla dentro de content-card ───────────────────────── */
.app-table { width: 100%; border-collapse: collapse; }
.app-table th { background: var(--primary); color: #fff; padding: .875rem 1rem; text-align: left; font-weight: 600; font-size: .8125rem; }
.app-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); font-size: .875rem; }
.app-table tr:hover td { background: var(--light); }
.app-table-wrap { overflow-x: auto; }

/* ── Badges / estados ───────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .25rem .75rem; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-success { background: rgba(16,185,129,.1); color: #059669; }
.badge-warning { background: rgba(245,158,11,.1); color: #d97706; }
.badge-danger  { background: rgba(239,68,68,.1); color: #dc2626; }
.badge-info    { background: rgba(59,130,246,.1); color: #2563eb; }
.badge-neutral { background: rgba(100,116,139,.1); color: #64748b; }

/* ── Botones ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .625rem 1.25rem; border-radius: 10px; font-weight: 700; font-size: .875rem; cursor: pointer; border: none; text-decoration: none; transition: all .2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-secondary:hover { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; border: 2px solid var(--border); color: var(--secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: .4375rem .875rem; font-size: .8125rem; }

/* ── Formularios ─────────────────────────────────────────── */
.app-container input,
.app-container select,
.app-container textarea {
  padding: .75rem 1rem; border-radius: 10px; border: 1.5px solid var(--border);
  font-size: .9375rem; width: 100%; transition: all .2s; font-family: inherit;
}
.app-container input:focus,
.app-container select:focus,
.app-container textarea:focus {
  border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.form-label { display: block; font-weight: 600; font-size: .875rem; color: var(--dark); margin-bottom: .5rem; }
.form-group { margin-bottom: 1.25rem; }

/* ── Alertas ─────────────────────────────────────────────── */
.alert { padding: 1rem 1.25rem; border-radius: 12px; margin-bottom: 1rem; font-size: .875rem; display: flex; align-items: center; gap: .75rem; }
.alert-success { background: rgba(16,185,129,.08); border: 2px solid rgba(16,185,129,.3); color: #059669; }
.alert-error   { background: rgba(239,68,68,.08); border: 2px solid rgba(239,68,68,.3); color: #dc2626; }
.alert-info    { background: rgba(59,130,246,.08); border: 2px solid rgba(59,130,246,.3); color: #2563eb; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .top-bar { padding: 1rem; flex-wrap: wrap; gap: .75rem; }
  .app-container { padding: 1rem; }
  .welcome-header { flex-direction: column; text-align: center; gap: 1rem; }
  .welcome-title { font-size: 1.5rem; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .quick-actions { grid-template-columns: 1fr; }
  .content-header { flex-direction: column; align-items: flex-start; }
  .app-table th, .app-table td { padding: .625rem .75rem; font-size: .8125rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .welcome-title { font-size: 1.25rem; }
}
