/* ===== CAS Reclamos · estilos PWA ===== */

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

:root {
  /* Light */
  --bg:          #f1f4f8;
  --surface:     #ffffff;
  --surface2:    #f5f7fa;
  --border:      #d8dde3;
  --text:        #1a2030;
  --text2:       #555f6f;
  --text3:       #8a93a0;
  --primary:     #179BD7;
  --primary-dk:  #1383b8;
  --primary-lt:  #e6f4fb;
  --accent:      #179BD7;
  --accent-dk:   #1383b8;
  --green:       #16a34a;
  --orange:      #ea580c;
  --red:         #dc2626;
  --yellow:      #ca8a04;
  --shadow:      0 1px 3px rgba(15, 25, 50, .08), 0 1px 2px rgba(15, 25, 50, .04);
  --shadow-lg:   0 10px 30px rgba(15, 25, 50, .15);
  --radius:      10px;
  --radius-sm:   6px;
  --header-h:    56px;
  --bottomnav-h: 64px;
}

[data-theme="dark"] {
  --bg:          #0f1623;
  --surface:     #1a2333;
  --surface2:    #232e43;
  --border:      #324158;
  --text:        #e8edf5;
  --text2:       #9aa6b9;
  --text3:       #5e6c84;
  --primary:     #179BD7;
  --primary-dk:  #1383b8;
  --primary-lt:  #0d3d54;
  --accent:      #4fb6e1;
  --accent-dk:   #2da4d2;
  --shadow:      0 1px 3px rgba(0,0,0,.4);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.6);
}

html, body { height: 100%; }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ===== Login ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #179BD7 0%, #1383b8 100%);
}
[data-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #0f1623 0%, #082c3e 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px 28px 24px;
}
.login-brand {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo {
  display: inline-block;
  width: 72px; height: 72px;
  border-radius: 16px;
  background: linear-gradient(135deg, #179BD7, #1383b8);
  color: #fff;
  font-weight: 800; font-size: 26px;
  letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 6px 16px rgba(23, 155, 215, .4);
}
.login-title {
  font-size: 22px; font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
}
.login-sub {
  font-size: 13px; color: var(--text3);
  margin-top: 4px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 11px; color: var(--text3);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.login-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
[data-theme="dark"] .login-error {
  background: #3a1414;
  border-color: #5b1f1f;
  color: #fca5a5;
}

/* ===== Form ===== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 155, 215, .18);
}
.form-group textarea { resize: vertical; min-height: 90px; }

/* ===== Botones ===== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 2px 6px rgba(23, 155, 215, .25);
}
.btn-primary:hover  { background: var(--primary-dk); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary-sm {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}
[data-theme="dark"] .btn-primary { background: var(--accent); }
[data-theme="dark"] .btn-primary:hover { background: var(--accent-dk); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.btn-icon:hover  { background: var(--surface2); }
.btn-icon:active { transform: scale(.95); }

.btn-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: var(--surface2);
  color: var(--text);
  border: none;
  border-radius: 50%;
  font-size: 20px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ===== Header (app principal) ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-title {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700;
  letter-spacing: -.2px;
}
.header-title i { font-size: 18px; opacity: .85; }
.header .btn-icon { color: #fff; }
.header .btn-icon:hover { background: rgba(255,255,255,.12); }
[data-theme="dark"] .header .btn-icon { color: var(--text); }
[data-theme="dark"] .header .btn-icon:hover { background: var(--surface2); }
.header-user {
  display: flex; flex-direction: column; align-items: flex-end;
  margin-left: 4px; line-height: 1.15;
}
.header-user-name {
  font-size: 12px; font-weight: 700; max-width: 130px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-user-alias {
  font-size: 10px; color: rgba(255,255,255,.7);
  text-transform: uppercase; letter-spacing: .5px;
}
[data-theme="dark"] .header-user-alias { color: var(--text3); }

/* ===== Main ===== */
.main {
  padding: calc(var(--header-h) + 14px) 12px calc(var(--bottomnav-h) + 28px);
  max-width: 760px;
  margin: 0 auto;
}
.section-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-title {
  font-size: 18px; font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
}

/* ===== Lista de reclamos ===== */
.reclamos-list {
  display: flex; flex-direction: column; gap: 10px;
}
.reclamo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.reclamo-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.reclamo-titulo {
  font-size: 15px; font-weight: 700; color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.reclamo-fecha {
  font-size: 11px; color: var(--text3);
  text-transform: uppercase; letter-spacing: .4px;
  flex-shrink: 0;
}
.reclamo-desc {
  font-size: 13px; color: var(--text2);
  line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.reclamo-meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 2px;
}
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .3px;
  border: 1px solid var(--border);
}
.tag i { font-size: 9px; }
.tag-id      { background: var(--primary-lt); color: var(--primary); border-color: transparent; }
[data-theme="dark"] .tag-id { background: var(--surface2); color: var(--accent); }

.tag-prio-1 { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.tag-prio-2 { background: #ecfeff; color: #0e7490; border-color: #cffafe; }
.tag-prio-3 { background: #e6f4fb; color: #1383b8; border-color: #c7e6f4; }
.tag-prio-4 { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-prio-5 { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
[data-theme="dark"] .tag-prio-1,
[data-theme="dark"] .tag-prio-2,
[data-theme="dark"] .tag-prio-3,
[data-theme="dark"] .tag-prio-4,
[data-theme="dark"] .tag-prio-5 {
  background: var(--surface2);
  border-color: var(--border);
}
[data-theme="dark"] .tag-prio-1 { color: #cbd5e1; }
[data-theme="dark"] .tag-prio-2 { color: #67e8f9; }
[data-theme="dark"] .tag-prio-3 { color: #4fb6e1; }
[data-theme="dark"] .tag-prio-4 { color: #fdba74; }
[data-theme="dark"] .tag-prio-5 { color: #fca5a5; }

.tag-estado-A { background: #e6f4fb; color: #1383b8; border-color: #c7e6f4; }
.tag-estado-T { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.tag-estado-C { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.tag-estado-V { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.tag-estado-N { background: #fafafa; color: #525252; border-color: #e5e5e5; }
[data-theme="dark"] .tag-estado-A,
[data-theme="dark"] .tag-estado-T,
[data-theme="dark"] .tag-estado-C,
[data-theme="dark"] .tag-estado-V,
[data-theme="dark"] .tag-estado-N {
  background: var(--surface2);
  border-color: var(--border);
}
[data-theme="dark"] .tag-estado-A { color: #4fb6e1; }
[data-theme="dark"] .tag-estado-T { color: #fde68a; }
[data-theme="dark"] .tag-estado-C { color: #86efac; }
[data-theme="dark"] .tag-estado-V { color: #6ee7b7; }
[data-theme="dark"] .tag-estado-N { color: #d4d4d4; }

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.empty-icon  { font-size: 56px; margin-bottom: 14px; opacity: .35; }
.empty-text  { font-size: 15px; font-weight: 600; color: var(--text2); }
.empty-hint  { font-size: 13px; margin-top: 4px; color: var(--text3); }

/* ===== Spinner ===== */
.spinner { display: flex; justify-content: center; padding: 40px 0; }
.spin {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rot 0.7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 18px); right: 22px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(23, 155, 215, .4);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: transform .12s, background .15s;
  z-index: 50;
}
.fab:hover  { background: var(--primary-dk); }
.fab:active { transform: scale(.92); }
[data-theme="dark"] .fab { background: var(--accent); }
[data-theme="dark"] .fab:hover { background: var(--accent-dk); }

/* ===== Bottom nav ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 90;
  box-shadow: 0 -2px 10px rgba(15, 25, 50, .06);
}
.bn-item {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-family: inherit;
  color: var(--text3);
  font-size: 11px; font-weight: 700;
  letter-spacing: .3px;
  padding: 6px 4px;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.bn-item i { font-size: 18px; }
.bn-item:active { background: var(--surface2); }
.bn-item.active { color: var(--primary); }
[data-theme="dark"] .bn-item.active { color: var(--accent); }

/* ===== Hero card (cabecera de Inicio/Perfil) ===== */
.hero-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 8px 22px rgba(23, 155, 215, .25);
  margin-bottom: 14px;
}
[data-theme="dark"] .hero-card {
  background: linear-gradient(135deg, var(--surface2), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
[data-theme="dark"] .hero-avatar { background: var(--primary-lt); color: var(--accent); }
.hero-info { min-width: 0; flex: 1; }
.hero-name {
  font-size: 18px; font-weight: 800; letter-spacing: -.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-alias {
  font-size: 12px; opacity: .85;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 2px;
}

/* ===== Info card ===== */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 16px;
  margin-bottom: 12px;
  overflow: hidden;
}
.info-card-title {
  font-size: 11px; font-weight: 800;
  color: var(--text3);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 13px; color: var(--text2); font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.info-label i { color: var(--primary); width: 16px; text-align: center; font-size: 13px; }
[data-theme="dark"] .info-label i { color: var(--accent); }
.info-value {
  font-size: 14px; color: var(--text); font-weight: 700;
  text-align: right;
  word-break: break-word;
  max-width: 60%;
}
.info-value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ===== Stats row (Inicio) ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-mini-label {
  display: block;
  font-size: 10px; font-weight: 700;
  color: var(--text3);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 4px;
}
.stat-mini-value {
  display: block;
  font-size: 22px; font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
}
.stat-mini-value.blue  { color: var(--primary); }
.stat-mini-value.green { color: var(--green); }
[data-theme="dark"] .stat-mini-value.blue { color: var(--accent); }

/* ===== Action row (Perfil) ===== */
.action-row {
  width: 100%;
  background: none; border: none;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  font-family: inherit; font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.action-row:active { background: var(--surface2); }
.action-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary-lt);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
[data-theme="dark"] .action-icon { background: var(--surface2); color: var(--accent); }
.action-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.action-title { font-size: 14px; font-weight: 700; color: var(--text); }
.action-sub   { font-size: 12px; color: var(--text3); }
.action-arrow { color: var(--text3); font-size: 12px; }
.action-row.danger .action-icon { background: #fee2e2; color: var(--red); }
.action-row.danger .action-title { color: var(--red); }
[data-theme="dark"] .action-row.danger .action-icon { background: #3a1414; color: #fca5a5; }
[data-theme="dark"] .action-row.danger .action-title { color: #fca5a5; }

/* ===== Modal ===== */
.modal-wrap {
  position: fixed; inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-wrap.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 25, 50, .55);
  animation: fade-in .2s ease;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  color: var(--text);
  border-radius: 16px 16px 0 0;
  padding: 22px 22px 24px;
  box-shadow: var(--shadow-lg);
  max-height: 92vh;
  overflow-y: auto;
  animation: slide-up .25s cubic-bezier(.2,.9,.3,1);
}
@media (min-width: 600px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 16px; }
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 14px;
}
@media (min-width: 600px) { .modal-handle { display: none; } }
.modal-title {
  font-size: 18px; font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.modal-sub {
  font-size: 13px; color: var(--text2);
  margin-bottom: 18px;
}
#reclamoForm { display: flex; flex-direction: column; gap: 14px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #b91c1c; }
.toast.ok    { background: #166534; }

/* ===== Safe area iOS ===== */
@supports (padding: max(0px)) {
  .header     { padding-top: env(safe-area-inset-top); height: calc(var(--header-h) + env(safe-area-inset-top)); }
  .main       { padding-top: calc(var(--header-h) + 14px + env(safe-area-inset-top)); }
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
  .fab        { bottom: calc(var(--bottomnav-h) + 18px + env(safe-area-inset-bottom)); }
}
