/* ============================================
   MisCobros - Prueba de Concepto
   Estilos Globales
   ============================================ */

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

/* --- Variables y Reset --- */
:root {
  --primary: #1a56db;
  --primary-dark: #1239a5;
  --primary-light: #e8f0fd;
  --success: #0e9f6e;
  --success-light: #def7ec;
  --warning: #e3a008;
  --warning-light: #fdf6b2;
  --danger: #e02424;
  --danger-light: #fde8e8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --font: 'Inter', sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.10), 0 4px 6px rgba(0,0,0,0.05);
}

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

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  min-height: 100vh;
}

/* ============================================
   LAYOUT
   ============================================ */
#app { min-height: 100vh; }

.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

/* ============================================
   TOPBAR / NAV
   ============================================ */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.topbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #4c7fff);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}

.avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #4c7fff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 600;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.page-content {
  flex: 1;
  padding: 28px 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 1px 4px rgba(26,86,219,0.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(26,86,219,0.4); }

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); }

.btn-success {
  background: var(--success);
  color: var(--white);
}
.btn-success:hover { background: #0a7a55; }

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover { background: #b91c1c; }

.btn-warning {
  background: var(--warning);
  color: var(--white);
}
.btn-warning:hover { background: #b47d07; }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}

.required-mark { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

textarea { resize: vertical; min-height: 80px; }

.form-error {
  font-size: 12px;
  color: var(--danger);
  display: none;
}
.form-group.has-error input,
.form-group.has-error textarea { border-color: var(--danger); }
.form-group.has-error .form-error { display: block; }

/* ============================================
   LOGIN PAGE
   ============================================ */
#page-login {
  background: linear-gradient(135deg, #1239a5 0%, #1a56db 50%, #4c7fff 100%);
  justify-content: center;
  align-items: center;
}

.login-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon-lg {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary), #4c7fff);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  margin-bottom: 12px;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.login-logo p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.login-form .form-group { margin-bottom: 14px; }

.login-form .btn { width: 100%; justify-content: center; margin-top: 8px; }

.login-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 12px;
  display: none;
}
.login-error.visible { display: block; }

/* ============================================
   DASHBOARD - LISTADO
   ============================================ */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.dashboard-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

.dashboard-header p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 3px;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); }
.stat-icon.green { background: var(--success-light); }
.stat-icon.yellow { background: var(--warning-light); }
.stat-icon.red { background: var(--danger-light); }

.stat-info .stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}
.stat-info .stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 1px;
}

/* Reclamaciones table */
.reclamaciones-table {
  width: 100%;
  border-collapse: collapse;
}

.reclamaciones-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.reclamaciones-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.reclamaciones-table tr:last-child td { border-bottom: none; }

.reclamaciones-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

.reclamaciones-table tbody tr:hover { background: var(--primary-light); }

/* Badge de estado */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  gap: 4px;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-active { background: var(--success-light); color: #065f46; }
.badge-active::before { background: var(--success); }
.badge-paused { background: var(--warning-light); color: #723b13; }
.badge-paused::before { background: var(--warning); }
.badge-closed { background: var(--gray-100); color: var(--gray-600); }
.badge-closed::before { background: var(--gray-400); }

/* ============================================
   NUEVA RECLAMACIÓN - FORMULARIO
   ============================================ */
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 20px 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* Modal de éxito blockchain */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.visible .modal-box { transform: scale(1); }

.modal-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.modal-sub {
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
  margin-bottom: 20px;
}

.hash-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--gray-700);
  word-break: break-all;
  margin-bottom: 20px;
  text-align: center;
}

.hash-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 6px;
}

/* ============================================
   CALENDARIO DE AVISOS
   ============================================ */
.calendar-wrapper {
  margin-top: 20px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calendar-month {
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-800);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  padding: 6px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-600);
  background: transparent;
  position: relative;
  cursor: default;
}

.cal-day.other-month { color: var(--gray-300); }
.cal-day.today {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.cal-day.aviso {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.cal-day.aviso .aviso-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  margin-top: 2px;
}

.aviso-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 10px;
}
.aviso-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
}

/* ============================================
   DETALLE RECLAMACIÓN
   ============================================ */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.detail-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.detail-header-meta {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.info-item label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-item .info-val {
  font-size: 14px;
  color: var(--gray-800);
  margin-top: 3px;
  font-weight: 500;
}

/* Timeline de avisos */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item {
  position: relative;
  margin-bottom: 18px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 500;
  margin-bottom: 3px;
}

.timeline-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
}

.timeline-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.type-email { background: #e0f2fe; color: #0369a1; }
.type-sms { background: #f3e8ff; color: #7c3aed; }
.type-burofax { background: #fef9c3; color: #a16207; }
.type-creacion { background: var(--success-light); color: #065f46; }

/* Alert boxes */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.alert-info { background: var(--primary-light); color: #1e3a8a; border: 1px solid #bfdbfe; }
.alert-warning { background: var(--warning-light); color: #78350f; border: 1px solid #fde68a; }
.alert-success { background: var(--success-light); color: #064e3b; border: 1px solid #a7f3d0; }

/* ============================================
   DESCARGO DE RESPONSABILIDAD
   ============================================ */
.disclaimer-block {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 4px;
}

.disclaimer-block.has-error {
  border-color: var(--danger);
  background: var(--danger-light);
}

.disclaimer-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-weight: 400;
}

.disclaimer-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-width: 17px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.disclaimer-label span {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.6;
}

.disclaimer-block .form-error {
  margin-top: 8px;
  padding-left: 27px;
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--gray-500); }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 20px;
}
.breadcrumb a {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--gray-300); }

/* Estado badge en detalle */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

/* Hash chip */
.hash-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  border-radius: 6px;
  padding: 4px 10px;
  font-family: monospace;
  font-size: 11px;
  color: var(--gray-600);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
