/* ============================================================
   Sistema LOPDP Ecuador — Estilos globales
   ============================================================ */

:root {
  --primary:       #1a3a6b;
  --primary-light: #2451a0;
  --primary-dark:  #0f2347;
  --accent:        #e8a020;
  --sidebar-width: 260px;
  --header-h:      60px;

  /* Semáforo */
  --color-verde:    #16a34a;
  --color-amarillo: #ca8a04;
  --color-naranja:  #ea580c;
  --color-rojo:     #dc2626;
  --color-vencida:  #6b21a8;
}

/* ---- Base ------------------------------------------------- */
body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: .9rem; }

a { color: var(--primary); }
a:hover { color: var(--primary-light); }

/* ---- Portal público --------------------------------------- */
.portal-navbar { background: var(--primary) !important; }
.portal-navbar .navbar-brand { font-weight: 700; letter-spacing: .5px; }

.hero-section {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 3.5rem 0;
}
.hero-section .lead { opacity: .9; }

.derecho-card {
  border: none;
  border-radius: 12px;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  cursor: default;
}
.derecho-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(26,58,107,.15);
}
.derecho-card .icon { font-size: 2.2rem; margin-bottom: .6rem; }

.card-codigo {
  background: #f0f4ff;
  border: 2px dashed var(--primary-light);
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  text-align: center;
}
.card-codigo .codigo-valor {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary);
}

/* ---- Admin layout ----------------------------------------- */
.admin-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  overflow-y: auto;
  transition: transform .25s;
}
.sidebar-brand {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.sidebar-nav { flex: 1; padding: .75rem 0; }
.sidebar-nav .nav-item { margin: 1px .5rem; }
.sidebar-nav .nav-link {
  color: rgba(255,255,255,.75);
  border-radius: 6px;
  padding: .55rem .9rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  transition: background .15s, color .15s;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.sidebar-nav .nav-link .icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sidebar-section {
  font-size: .7rem;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: .9rem 1.4rem .3rem;
  letter-spacing: 1px;
}
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .78rem;
  color: rgba(255,255,255,.5);
}

.admin-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.topbar-title { font-weight: 600; font-size: 1rem; flex: 1; color: #374151; }
.topbar .user-info { font-size: .82rem; color: #6b7280; }

.page-content { padding: 1.5rem; flex: 1; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; color: var(--primary-dark); margin: 0; }

/* ---- Dashboard cards -------------------------------------- */
.stat-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: .78rem; color: #6b7280; margin-top: .2rem; }

/* ---- Semáforo --------------------------------------------- */
.semaforo-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25em .65em;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.semaforo-verde    { background: #dcfce7; color: var(--color-verde); }
.semaforo-amarillo { background: #fef9c3; color: var(--color-amarillo); }
.semaforo-naranja  { background: #ffedd5; color: var(--color-naranja); }
.semaforo-rojo     { background: #fee2e2; color: var(--color-rojo); }
.semaforo-vencida  { background: #f3e8ff; color: var(--color-vencida); }
.semaforo-finalizada { background: #f0fdf4; color: #166534; }

/* ---- Badges de estado ------------------------------------- */
.estado-badge {
  display: inline-block;
  padding: .25em .7em;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-recibida          { background: #dbeafe; color: #1e40af; }
.badge-validacion        { background: #e0e7ff; color: #3730a3; }
.badge-subsanacion       { background: #fef3c7; color: #92400e; }
.badge-admitida          { background: #d1fae5; color: #065f46; }
.badge-analisis          { background: #cffafe; color: #155e75; }
.badge-preparacion       { background: #ede9fe; color: #5b21b6; }
.badge-respondida        { background: #dcfce7; color: #166534; }
.badge-rechazada         { background: #fee2e2; color: #991b1b; }
.badge-cerrada           { background: #f3f4f6; color: #374151; }
.badge-vencida           { background: #fce7f3; color: #831843; }

/* ---- Tabla de solicitudes --------------------------------- */
.table-solicitudes thead th {
  background: #f8fafc;
  color: #374151;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.table-solicitudes tbody tr:hover { background: #f8fafc; }
.table-solicitudes .codigo-link {
  font-family: monospace;
  font-weight: 700;
  font-size: .85rem;
  color: var(--primary);
}

/* ---- Expediente / Timeline -------------------------------- */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: .6rem;
  top: 0; bottom: 0;
  width: 2px;
  background: #e5e7eb;
}
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-dot {
  position: absolute;
  left: -1.6rem;
  top: .3rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}
.timeline-item.is-last .timeline-dot { background: var(--color-verde); box-shadow: 0 0 0 2px var(--color-verde); }
.timeline-fecha { font-size: .75rem; color: #9ca3af; }
.timeline-texto { font-size: .88rem; color: #374151; margin-top: .15rem; }
.timeline-meta  { font-size: .75rem; color: #6b7280; margin-top: .1rem; }

/* ---- Formulario portal ------------------------------------ */
.form-portal .card {
  border: none;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}
.form-portal .card-header {
  background: var(--primary);
  color: #fff;
  border-radius: 14px 14px 0 0 !important;
  padding: 1.1rem 1.5rem;
  font-weight: 600;
}
.step-indicator {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
}
.step {
  flex: 1;
  text-align: center;
  padding: .6rem;
  background: #f3f4f6;
  font-size: .8rem;
  color: #6b7280;
  position: relative;
}
.step.active  { background: var(--primary); color: #fff; font-weight: 700; }
.step.done    { background: #d1fae5; color: var(--color-verde); }
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child  { border-radius: 0 8px 8px 0; }

/* ---- Responsive ------------------------------------------- */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .admin-content { margin-left: 0; }
}

/* ---- Utilidades ------------------------------------------- */
.cursor-pointer { cursor: pointer; }
.font-mono { font-family: monospace; }
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-custom  { background-color: var(--primary) !important; }
