/* ============================================
   SIDIT — Sistema de Digitalización de Trámites
   Gómez Palacio — Identidad institucional
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --guinda:        #6D1226;
  --guinda-dark:   #4E0D1A;
  --guinda-light:  #8B1A31;
  --dorado:        #C8922A;
  --blanco:        #FFFFFF;
  --gris-cool:     #4A4A5A;
  --gris-medio:    #7A7A8C;
  --gris-claro:    #F2F2F4;
  --gris-borde:    #E0E0E8;
  --texto:         #1E1E2E;
  --sombra-s:      0 1px 4px rgba(0,0,0,.08);
  --sombra-m:      0 4px 16px rgba(0,0,0,.10);
  --sombra-l:      0 8px 32px rgba(0,0,0,.14);
  --radio:         8px;
  --radio-lg:      14px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--texto);
  background: var(--gris-claro);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ——— TIPOGRAFÍA ——— */
h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h1.display {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
}

/* ——— BOTONES ——— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.75rem;
  border-radius: var(--radio);
  font-family: 'Inter', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s ease;
  letter-spacing: .01em;
}
.btn-primary {
  background: var(--guinda);
  color: var(--blanco);
  box-shadow: 0 2px 12px rgba(109,18,38,.30);
}
.btn-primary:hover {
  background: var(--guinda-dark);
  box-shadow: 0 4px 20px rgba(109,18,38,.40);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--blanco);
  color: var(--guinda);
  border: 2px solid var(--guinda);
}
.btn-secondary:hover {
  background: var(--guinda);
  color: var(--blanco);
}
.btn-ghost {
  background: transparent;
  color: var(--gris-cool);
  border: 1.5px solid var(--gris-borde);
}
.btn-ghost:hover {
  border-color: var(--guinda);
  color: var(--guinda);
}
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #96281b; }
.btn-success { background: #218c4e; color: #fff; }
.btn-success:hover { background: #196b3c; }

/* ——— NAVBAR ——— */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--guinda);
  box-shadow: 0 2px 12px rgba(0,0,0,.20);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 2rem;
  gap: 1rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: var(--blanco);
}
.navbar-brand img {
  height: 38px;
  width: auto;
  object-fit: contain;
}
.navbar-brand-text { display: flex; flex-direction: column; }
.navbar-brand-text .sistema { font-size: .65rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.navbar-brand-text .nombre  { font-size: 1.1rem; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.navbar-links { display: flex; align-items: center; gap: .5rem; }
.navbar-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .45rem .9rem;
  border-radius: var(--radio);
  transition: all .18s;
}
.navbar-links a:hover, .navbar-links a.active {
  background: rgba(255,255,255,.15);
  color: var(--blanco);
}

/* ——— FRANJA INSTITUCIONAL ——— */
.franja-institucional {
  height: 5px;
  background: linear-gradient(90deg, var(--guinda-dark) 0%, var(--guinda) 40%, var(--dorado) 100%);
}

/* ——— CARDS ——— */
.card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  box-shadow: var(--sombra-s);
  border: 1px solid var(--gris-borde);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--sombra-m); transform: translateY(-2px); }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gris-borde);
  background: var(--gris-claro);
  font-weight: 600;
  color: var(--gris-cool);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card-body { padding: 1.5rem; }

/* ——— TRAMITE CARD (público) ——— */
.tramite-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--gris-borde);
  border-left: 4px solid var(--guinda);
  padding: 1.5rem;
  box-shadow: var(--sombra-s);
  transition: all .2s;
  cursor: pointer;
}
.tramite-card:hover {
  box-shadow: var(--sombra-m);
  border-left-color: var(--dorado);
  transform: translateX(2px);
}
.tramite-card .giro-badge {
  display: inline-block;
  background: rgba(109,18,38,.10);
  color: var(--guinda);
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .7rem;
  border-radius: 20px;
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tramite-card h3 { font-size: 1.05rem; margin-bottom: .4rem; color: var(--texto); }
.tramite-card p  { font-size: .88rem; color: var(--gris-medio); line-height: 1.5; }
.tramite-card .tramite-footer {
  margin-top: 1rem;
  padding-top: .75rem;
  border-top: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.requisito-count {
  font-size: .8rem;
  color: var(--gris-medio);
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ——— MODAL ——— */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  box-shadow: var(--sombra-l);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform .25s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gris-borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--blanco);
  z-index: 10;
}
.modal-header h2 { font-size: 1.1rem; color: var(--texto); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--gris-medio); font-size: 1.4rem; line-height: 1;
  padding: .25rem; border-radius: 4px;
  transition: color .15s;
}
.modal-close:hover { color: var(--guinda); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--gris-borde);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  background: var(--gris-claro);
}

/* ——— FORMULARIOS ——— */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  color: var(--gris-cool);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--gris-borde);
  border-radius: var(--radio);
  font-family: 'Inter', sans-serif;
  font-size: .93rem;
  color: var(--texto);
  background: var(--blanco);
  transition: border-color .18s, box-shadow .18s;
}
.form-control:focus {
  outline: none;
  border-color: var(--guinda);
  box-shadow: 0 0 0 3px rgba(109,18,38,.12);
}
.form-control::placeholder { color: var(--gris-medio); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ——— BUSCADOR ——— */
.search-wrap {
  position: relative;
  max-width: 520px;
}
.search-wrap input {
  padding-left: 2.8rem;
  background: var(--blanco);
}
.search-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gris-medio);
  pointer-events: none;
}

/* ——— TABLAS ADMIN ——— */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radio-lg);
  border: 1px solid var(--gris-borde);
  box-shadow: var(--sombra-s);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--blanco);
}
table thead {
  background: var(--guinda);
  color: var(--blanco);
}
table thead th {
  padding: .9rem 1.1rem;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  text-align: left;
}
table tbody tr {
  border-bottom: 1px solid var(--gris-borde);
  transition: background .15s;
}
table tbody tr:last-child { border-bottom: none; }
table tbody tr:hover { background: rgba(109,18,38,.035); }
table tbody td {
  padding: .85rem 1.1rem;
  font-size: .9rem;
  color: var(--texto);
  vertical-align: middle;
}
.td-actions { display: flex; gap: .5rem; align-items: center; }

/* ——— SIDEBAR ADMIN ——— */
.admin-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--guinda-dark);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.10);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-logo img { height: 36px; width: auto; object-fit: contain; }
.sidebar-logo-text { color: var(--blanco); }
.sidebar-logo-text .s-sistema { font-size: .6rem; opacity: .7; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-logo-text .s-nombre  { font-size: .95rem; font-weight: 700; }
.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; padding: 0 .75rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  padding: .7rem .9rem;
  border-radius: var(--radio);
  transition: all .18s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: var(--blanco);
}
.sidebar-nav a.active { background: rgba(255,255,255,.18); }
.sidebar-nav .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-section-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.40);
  padding: 1rem 1.5rem .4rem;
}
.admin-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ——— TOPBAR ADMIN ——— */
.admin-topbar {
  background: var(--blanco);
  border-bottom: 1px solid var(--gris-borde);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--sombra-s);
}
.admin-topbar h1 { font-size: 1.2rem; font-weight: 700; color: var(--texto); }
.admin-topbar .breadcrumb { font-size: .8rem; color: var(--gris-medio); margin-top: .1rem; }

/* ——— TABS ——— */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--gris-borde);
  margin-bottom: 1.5rem;
}
.tab-btn {
  padding: .7rem 1.3rem;
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: .88rem;
  font-weight: 500;
  color: var(--gris-medio);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .18s;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.tab-btn:hover { color: var(--guinda); }
.tab-btn.active { color: var(--guinda); border-bottom-color: var(--guinda); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ——— BADGES ——— */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-guinda  { background: rgba(109,18,38,.12); color: var(--guinda); }
.badge-green   { background: rgba(33,140,78,.12); color: #196b3c; }
.badge-gray    { background: var(--gris-claro); color: var(--gris-cool); }
.badge-gold    { background: rgba(200,146,42,.15); color: #9a6e1a; }

/* ——— CHIP FORMATO ——— */
.formato-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--gris-claro);
  border: 1px solid var(--gris-borde);
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .78rem;
  font-weight: 500;
  color: var(--gris-cool);
  text-decoration: none;
  transition: all .15s;
}
.formato-chip:hover {
  border-color: var(--guinda);
  color: var(--guinda);
  background: rgba(109,18,38,.05);
}
.formato-chip.pdf  { border-color: #c0392b33; color: #c0392b; }
.formato-chip.word { border-color: #2980b933; color: #2471a3; }

/* ——— EMPTY STATE ——— */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gris-medio);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ——— TOAST ——— */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--texto);
  color: var(--blanco);
  padding: .8rem 1.25rem;
  border-radius: var(--radio);
  font-size: .88rem;
  box-shadow: var(--sombra-l);
  display: flex;
  align-items: center;
  gap: .6rem;
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast.success { background: #1a6b3a; }
.toast.error   { background: var(--guinda); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ——— UTILITIES ——— */
.flex         { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.grid-cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-sm { font-size: .85rem; }
.text-muted { color: var(--gris-medio); }
.fw-600 { font-weight: 600; }
.page-main { flex: 1; padding: 2rem; overflow-y: auto; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-header h2 { font-size: 1.15rem; color: var(--texto); }
.divider { height: 1px; background: var(--gris-borde); margin: 1.5rem 0; }

/* ——— REQUISITO ROW en modal ——— */
.requisito-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem;
  background: var(--gris-claro);
  border-radius: var(--radio);
  border: 1px solid var(--gris-borde);
  margin-bottom: .5rem;
}
.requisito-row-info { flex: 1; min-width: 0; }
.requisito-row-info strong { display: block; font-size: .9rem; }
.requisito-row-info span   { font-size: .8rem; color: var(--gris-medio); }
.requisito-num {
  width: 28px; height: 28px;
  background: var(--guinda);
  color: var(--blanco);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  flex-shrink: 0;
}

/* ——— RESPONSIVE ——— */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .page-main { padding: 1rem; }
  .grid-cols-2, .grid-cols-3 { grid-template-columns: 1fr; }

  /* Navbar móvil */
  .navbar {
    padding: .6rem 1rem;
    flex-wrap: wrap;
    gap: .5rem;
  }
  .navbar-brand img { height: 28px; }
  .navbar-brand-text .sistema { font-size: .58rem; }
  .navbar-brand-text .nombre  { font-size: .95rem; }
  .navbar-links { gap: .25rem; }
  .navbar-links a { font-size: .78rem; padding: .35rem .6rem; }
  .navbar-links .btn { font-size: .78rem; padding: .35rem .7rem; }
}

@media (max-width: 480px) {
  .navbar { padding: .5rem .75rem; }
  .navbar-brand-text .sistema { display: none; }
  .navbar-brand-text .nombre  { font-size: .9rem; }
}
