/* mobile.css - paleta admin AFISCOB adaptada a /obras-web/ (movil-first) */

:root {
  --color-bg:           #f1f5f9;
  --color-primary:      #0D47A1;
  --color-primary-dark: #08306B;
  --color-primary-soft: #e7f0ff;
  --color-accent:       #2196F3;
  --color-text:         #0f172a;
  --color-muted:        #64748b;
  --color-line:         #e5e7eb;
  --color-card:         #ffffff;
  --color-danger:       #dc2626;
  --color-success:      #16a34a;
  --radius:             12px;
  --radius-lg:          16px;
  --shadow-soft:        0 1px 3px rgba(15,23,42,.08);
  --shadow-card:        0 6px 18px rgba(13,71,161,.08);
}

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

html,body {
  margin: 0;
  padding: 0;
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 16px;
}
.topbar .logo {
  width: 40px; height: 40px; border-radius: 10px;
}
.topbar .titles { line-height: 1.15; }
.topbar .title {
  font-size: 16px; font-weight: 900; color: var(--color-text); margin: 0;
}
.topbar .subtitle {
  font-size: 12px; font-weight: 700; color: var(--color-muted); margin: 1px 0 0;
}
.topbar .spacer { flex: 1; }
.topbar .btn-icon {
  background: transparent; border: 0; cursor: pointer; padding: 6px 8px;
  font-size: 14px; font-weight: 800; color: var(--color-primary);
}

/* ===== Header de pagina ===== */
.page-header { margin: 4px 0 14px; }
.page-title  { font-size: 20px; font-weight: 900; margin: 0; }
.page-subtitle {
  font-size: 13px; font-weight: 600; color: var(--color-muted);
  margin: 2px 0 0;
}

.back-link {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 13px; font-weight: 800;
  color: var(--color-primary);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* ===== Card ===== */
.card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}
.card + .card { margin-top: 0; }

.section-title {
  font-size: 14px; font-weight: 800;
  margin: 16px 0 8px;
  border-left: 4px solid var(--color-primary);
  padding-left: 8px;
  color: var(--color-text);
}

/* ===== Forms ===== */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px; font-weight: 800;
  color: #334155; margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field input[type="file"],
.field select,
.field textarea {
  width: 100%; padding: 11px 12px;
  font-size: 14px;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--color-text);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13,71,161,.12);
}
.field textarea { min-height: 80px; resize: vertical; }

.field-inline { display: flex; gap: 10px; }
.field-inline .field { flex: 1; margin-bottom: 0; }

.matricula-highlight {
  display: inline-block;
  font-weight: 900;
  font-size: 15px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 8px 12px;
  border-radius: 10px;
}

/* ===== Botones ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  margin-top: 8px;
  transition: filter .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.99); }
.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-primary:hover   { filter: brightness(1.07); }
.btn-secondary { background: var(--color-primary-soft); color: var(--color-primary); }
.btn-secondary:hover { background: #d8e6ff; }
.btn-outline  {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-soft); }
.btn-danger   { background: var(--color-danger); color: #fff; }
.btn[disabled], .btn.btn-disabled {
  opacity: .55; cursor: default; pointer-events: none;
}

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 140px; }

/* ===== Alerts ===== */
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px; font-weight: 700;
  margin-bottom: 10px;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info  { background: #dbeafe; color: #1e3a8a; border: 1px solid #bfdbfe; }
.alert-ok    { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* ===== Loader simple ===== */
.loader {
  display: none;
  text-align: center;
  font-size: 13px; font-weight: 700;
  color: var(--color-muted);
  margin: 8px 0;
}
.loader.show { display: block; }
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid var(--color-primary-soft);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty/Loading state ===== */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--color-muted);
}
.empty-state .emoji { font-size: 32px; display: block; margin-bottom: 8px; }

/* ===== Lista de asignaciones ===== */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: block;
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-soft);
  border-left: 4px solid var(--color-accent);
  text-decoration: none;
  color: inherit;
  transition: transform .05s, box-shadow .15s;
}
.list-item:hover { box-shadow: 0 4px 14px rgba(13,71,161,.10); }
.list-item:active { transform: scale(.997); }
.list-item .li-fecha {
  font-size: 13px; font-weight: 800; color: var(--color-text);
}
.list-item .li-subdel {
  font-size: 11px; font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 2px 8px; border-radius: 999px;
  margin-left: 6px;
}
.list-item .li-desc {
  margin: 6px 0 0;
  font-size: 13px; color: var(--color-muted);
  font-weight: 600;
}
.list-item .li-obras {
  margin: 8px 0 0;
  font-size: 12px; font-weight: 700;
  color: var(--color-text);
}
.list-item .li-obras.empty { color: var(--color-muted); }

/* ===== Mapa ===== */
#map, #mapCenso, #mapAsignacion {
  width: 100%;
  height: clamp(280px, 50vh, 460px);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 8px 0 12px;
  background: #cfd8e3;
}
/* Mapa de asignacion: que aproveche mas alto en pantallas grandes */
#mapAsignacion {
  height: clamp(320px, 60vh, 620px);
}

.info-ubicacion {
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
  margin: 0 0 10px;
}

/* ===== Foto preview ===== */
#previewFoto {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 10px;
  background: #e2e8f0;
  margin-top: 8px;
  display: none;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.photos-grid img {
  width: 100%; height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: #e2e8f0;
}

/* ===== Radios / switches ===== */
.radio-group { display: flex; flex-wrap: wrap; gap: 12px; font-size: 14px; }
.radio-group label { font-weight: 600; }
.switch-row {
  display: flex; gap: 12px; align-items: center;
  font-size: 14px; font-weight: 700;
}

/* ===== Tablet / desktop ===== */
@media (min-width: 768px) {
  .page { padding: 24px; }
  .page-title { font-size: 24px; }
  .card { padding: 22px; }
}
