/* ============================================================
   CIMET FORMS - Estilos globales
   ============================================================ */

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

:root {
  --verde:        #C45D34;
  --verde-mid:    #D4672B;
  --verde-claro:  #D4672B;
  --verde-oscuro: #8B3518;
  --verde-bg:     #FDF1EB;
  --verde-line:   rgba(196,93,52,0.15);
  --acento:       #C0177A;
  --acento-bg:    #FCE4F3;
  --blanco:       #FFFFFF;
  --fondo:        #F5F7F5;
  --fondo2:       #ECEEED;
  --gris:         #6B7280;
  --gris-claro:   #F3F4F6;
  --borde:        #E5E7EB;
  --texto:        #111827;
  --texto-2:      #374151;
  --sombra-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --sombra:       0 4px 16px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --sombra-lg:    0 10px 40px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);
  --radio:        10px;
  --radio-lg:     16px;
  --radio-xl:     20px;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- TIPOGRAFÍA ---- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
a { color: var(--verde); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--verde-oscuro);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radio);
  color: rgba(255,255,255,0.75);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
  margin-bottom: 2px;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}

.nav-item.active {
  background: var(--verde-mid);
  color: #fff;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

.sidebar-footer .user-name {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  font-size: 0.82rem;
}

/* ---- CONTENIDO PRINCIPAL ---- */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--blanco);
  border-bottom: 1px solid var(--borde);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--texto);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-body {
  padding: 28px;
  flex: 1;
}

/* ---- CARDS ---- */
.card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--borde);
  box-shadow: var(--sombra-sm);
}

.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--texto);
}

.card-body { padding: 22px; }

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--blanco);
  border-radius: var(--radio-lg);
  border: 1px solid var(--borde);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--verde);
  line-height: 1;
}

.stat-lbl {
  font-size: 0.78rem;
  color: var(--gris);
  margin-top: 5px;
  font-weight: 500;
}

.stat-icon {
  width: 42px; height: 42px;
  background: var(--verde-bg);
  border-radius: var(--radio);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg { width: 20px; height: 20px; color: var(--verde); }

/* ---- BOTONES ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radio);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.18s;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--verde);
  color: white;
  border-color: var(--verde);
  box-shadow: 0 2px 8px rgba(196,93,52,0.25);
}
.btn-primary:hover {
  background: var(--verde-oscuro);
  border-color: var(--verde-oscuro);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(196,93,52,0.35);
  color: white; text-decoration: none;
}

.btn-secondary {
  background: var(--blanco);
  color: var(--texto-2);
  border-color: var(--borde);
}
.btn-secondary:hover {
  background: var(--gris-claro);
  color: var(--texto);
  text-decoration: none;
}

.btn-danger {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}
.btn-danger:hover { background: #DC2626; color: white; text-decoration: none; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs { padding: 4px 9px; font-size: 0.72rem; }

.btn-excel {
  background: #1D6F42;
  color: white;
  border-color: #1D6F42;
}
.btn-excel:hover { background: #155235; color: white; text-decoration: none; }

/* ---- TABLA ---- */
.table-wrap { overflow-x: auto; }

table.cf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.cf-table thead th {
  background: var(--fondo);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gris);
  border-bottom: 1px solid var(--borde);
  white-space: nowrap;
}

.cf-table tbody tr {
  border-bottom: 1px solid var(--borde);
  transition: background 0.12s;
}

.cf-table tbody tr:hover { background: var(--verde-bg); }

.cf-table td {
  padding: 11px 14px;
  color: var(--texto-2);
  vertical-align: middle;
}

/* ---- FORMULARIOS ---- */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texto-2);
  margin-bottom: 6px;
}

.form-label .req { color: #DC2626; margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--texto);
  background: var(--blanco);
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--verde-claro);
  box-shadow: 0 0 0 3px rgba(196,93,52,0.12);
}

.form-control::placeholder { color: #9CA3AF; }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--gris);
  margin-top: 4px;
}

/* ---- BADGES ---- */
.badge-rol {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-superadmin { background: #FEE2E2; color: #991B1B; }
.badge-admin      { background: #FEF3C7; color: #92400E; }
.badge-visor      { background: #D1FAE5; color: #065F46; }

.badge-estado {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-pendiente  { background: #FEF3C7; color: #92400E; }
.badge-aprobado   { background: #D1FAE5; color: #065F46; }
.badge-rechazado  { background: #FEE2E2; color: #991B1B; }

.badge-tipo {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--verde-bg);
  color: var(--verde-oscuro);
}

/* ---- CHECKBOXES PERSONALIZADOS ---- */
.check-group { display: flex; flex-direction: column; gap: 8px; }

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--texto-2);
  padding: 7px 12px;
  border-radius: var(--radio);
  border: 1px solid var(--borde);
  transition: all 0.15s;
  user-select: none;
}

.check-item:hover {
  border-color: var(--verde-line);
  background: var(--verde-bg);
}

.check-item input[type="checkbox"],
.check-item input[type="radio"] {
  width: 17px; height: 17px;
  accent-color: var(--verde);
  cursor: pointer;
  flex-shrink: 0;
}

.check-item.selected {
  border-color: var(--verde);
  background: var(--verde-bg);
  color: var(--verde-oscuro);
  font-weight: 600;
}

/* ---- FIRMA CANVAS ---- */
.firma-wrapper {
  border: 2px dashed var(--borde);
  border-radius: var(--radio-lg);
  background: #FAFAFA;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.firma-wrapper.has-firma { border-color: var(--verde); border-style: solid; }

.firma-canvas {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}

.firma-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s;
}

.firma-label svg { width: 28px; height: 28px; color: var(--borde); display: block; margin: 0 auto 6px; }
.firma-label span { font-size: 0.75rem; color: var(--gris); }

.firma-wrapper.has-firma .firma-label { opacity: 0; }

.firma-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 8px;
  background: var(--fondo);
  border-top: 1px solid var(--borde);
}

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed var(--borde);
  border-radius: var(--radio-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--verde);
  background: var(--verde-bg);
}

.upload-zone svg { width: 32px; height: 32px; color: var(--verde); margin-bottom: 10px; }
.upload-zone p { font-size: 0.85rem; color: var(--gris); margin: 0; }
.upload-zone span { font-size: 0.75rem; color: var(--borde); display: block; margin-top: 4px; }

.upload-preview {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--verde-bg);
  border-radius: var(--radio);
  border: 1px solid var(--verde-line);
  margin-top: 8px;
  font-size: 0.82rem;
}

.upload-preview.visible { display: flex; }
.upload-preview svg { width: 18px; height: 18px; color: var(--verde); flex-shrink: 0; }
.upload-preview .fname { flex: 1; color: var(--verde-oscuro); font-weight: 600; }

/* ---- STEPPER FORMULARIO ---- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 10px;
}

.step-item {
  display: flex;
  align-items: center;
  flex: 1;
}

.step-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--borde);
  color: var(--gris);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.25s;
  border: 2px solid var(--borde);
}

.step-circle.active {
  background: var(--verde);
  color: white;
  border-color: var(--verde);
  box-shadow: 0 0 0 4px rgba(196,93,52,0.15);
}

.step-circle.done {
  background: var(--verde-bg);
  color: var(--verde);
  border-color: var(--verde);
}

.step-label {
  font-size: 0.7rem;
  color: var(--gris);
  margin-top: 4px;
  text-align: center;
  max-width: 70px;
  line-height: 1.3;
}

.step-label.active { color: var(--verde); font-weight: 600; }

.step-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--borde);
  margin-top: -16px;
  transition: background 0.3s;
}

.step-line.done { background: var(--verde); }

/* ---- FORM SECTIONS ---- */
.form-section {
  display: none;
  animation: fadeInUp 0.3s ease;
}

.form-section.active { display: block; }

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

.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--verde-oscuro);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--verde-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg { width: 18px; height: 18px; color: var(--verde); }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--blanco);
  border-radius: var(--radio-xl);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--sombra-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body { padding: 22px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--borde); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- QR DISPLAY ---- */
.qr-card {
  background: white;
  border-radius: var(--radio-xl);
  padding: 28px;
  text-align: center;
  border: 1px solid var(--borde);
  box-shadow: var(--sombra);
}

.qr-card img { max-width: 200px; margin: 0 auto 14px; display: block; }

/* ---- ALERTAS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radio);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info    { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ---- PAGINACIÓN ---- */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid var(--borde);
  background: var(--blanco);
  color: var(--texto-2);
  transition: all 0.15s;
  text-decoration: none;
}
.page-btn:hover { background: var(--verde-bg); border-color: var(--verde-line); color: var(--verde); text-decoration: none; }
.page-btn.active { background: var(--verde); color: white; border-color: var(--verde); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stepper { gap: 0; }
  .step-label { display: none; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--borde); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gris); }

/* ---- UTILIDADES ---- */
.text-muted  { color: var(--gris); }
.text-verde  { color: var(--verde); }
.text-danger { color: #DC2626; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm  { font-size: 0.82rem; }
.fs-xs  { font-size: 0.72rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
