/* ═══════════════════════════════════════════════════════════
   SecurReport — Premium Dark / Glassmorphism UI
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0F172A;
  --bg2:       #1E293B;
  --bg3:       #334155;
  --blue:      #2563EB;
  --blue-lt:   #3B82F6;
  --blue-dark: #1D4ED8;
  --green:     #10B981;
  --red:       #DC2626;
  --yellow:    #F59E0B;
  --wa:        #25D366;
  --text:      #F1F5F9;
  --text-muted:#94A3B8;
  --border:    rgba(255,255,255,0.08);
  --glass-bg:  rgba(255,255,255,0.04);
  --glass-bg2: rgba(255,255,255,0.07);
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --font:      'Plus Jakarta Sans', system-ui, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Screens ──────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  animation: fadeSlide 0.3s ease;
}
.screen.active { display: flex; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Glass card ───────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15,23,42,0.95);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-logo { height: 28px; width: auto; }
.greeting { font-size: 13px; color: var(--text-muted); max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.back-btn {
  background: none; border: none; color: var(--blue-lt);
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 8px;
  font-family: var(--font);
}
.icon-btn {
  background: var(--glass-bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); cursor: pointer;
  font-size: 16px; padding: 6px 10px; transition: background 0.2s;
}
.icon-btn:hover { background: var(--bg3); }

/* ── Screen body ──────────────────────────────────────────── */
.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 100px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

/* ── Login ────────────────────────────────────────────────── */
.login-bg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at 50% 0%, rgba(37,99,235,0.18) 0%, transparent 70%),
              var(--bg);
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 36px 28px;
}
.brand { text-align: center; margin-bottom: 32px; }
.brand-logo { height: 52px; width: auto; margin-bottom: 14px; }
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.brand-sub { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

.hint { text-align: center; color: var(--text-muted); font-size: 11px; margin-top: 14px; }
.dev-credit { text-align: center; color: rgba(148,163,184,0.5); font-size: 11px; margin-top: 6px; }

/* ── Fields ───────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  background: rgba(37,99,235,0.08);
}
select option { background: var(--bg2); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾'; position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); pointer-events: none; color: var(--text-muted);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 15px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover   { background: var(--blue-dark); }
.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover   { background: #059669; }
.btn-ghost     { background: var(--glass-bg2); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover     { background: var(--bg3); }
.btn-whatsapp  { background: var(--wa); color: #fff; }
.btn-whatsapp:hover  { background: #1aab52; }
.btn-danger    { background: var(--red); color: #fff; }

.btn-full { width: 100%; }
.btn-xl   { padding: 18px 24px; font-size: 17px; border-radius: var(--radius); margin-top: 8px; }
.btn-sm   { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn-icon { font-size: 18px; }

/* ── Toggle (remember) ────────────────────────────────────── */
.remember-row { display: flex; align-items: center; margin-bottom: 20px; }
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-muted); }
.toggle-label input { display: none; }
.toggle {
  width: 40px; height: 22px; background: var(--bg3);
  border-radius: 11px; position: relative; transition: background 0.2s;
  flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; top: 3px; left: 3px;
  transition: transform 0.2s;
}
.toggle-label input:checked + .toggle { background: var(--blue); }
.toggle-label input:checked + .toggle::after { transform: translateX(18px); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  padding: 18px 16px;
  margin-bottom: 14px;
}
.card-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--blue-lt); margin-bottom: 10px;
}
.section-title { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.mt-lg { margin-top: 28px; }

/* ── Recent partes list ───────────────────────────────────── */
.partes-list { display: flex; flex-direction: column; gap: 10px; }
.parte-item {
  background: var(--glass-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: background 0.2s;
}
.parte-item:hover { background: var(--glass-bg2); }
.parte-info h4 { font-size: 14px; font-weight: 600; }
.parte-info p  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.parte-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-ok  { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-inc { background: rgba(220,38,38,0.15);  color: var(--red); }

/* ── Recorder screen ──────────────────────────────────────── */
.recorder-body { display: flex; flex-direction: column; align-items: center; }
.turno-badge { padding: 10px 18px; font-size: 13px; color: var(--text-muted); margin-bottom: 24px; width: 100%; text-align: center; }

.recorder-center {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 200px; height: 200px; margin: 8px 0 24px;
}
.rings { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ring {
  position: absolute; border-radius: 50%;
  border: 2px solid rgba(37,99,235,0.2); transition: all 0.3s;
}
.ring1 { width: 160px; height: 160px; }
.ring2 { width: 180px; height: 180px; }
.ring3 { width: 200px; height: 200px; }

.recording .ring1 { border-color: rgba(37,99,235,0.6); animation: pulse 1.2s ease-in-out infinite; }
.recording .ring2 { border-color: rgba(37,99,235,0.4); animation: pulse 1.2s ease-in-out infinite 0.2s; }
.recording .ring3 { border-color: rgba(37,99,235,0.2); animation: pulse 1.2s ease-in-out infinite 0.4s; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%       { transform: scale(1.06); opacity: 1; }
}

.record-btn {
  width: 120px; height: 120px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  border: 4px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 40px rgba(37,99,235,0.4), 0 8px 24px rgba(0,0,0,0.5);
  font-size: 40px; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; position: relative; z-index: 2;
}
.record-btn:active { transform: scale(0.94); }
.record-btn.recording-active {
  background: linear-gradient(135deg, var(--red) 0%, #991B1B 100%);
  box-shadow: 0 0 40px rgba(220,38,38,0.5), 0 8px 24px rgba(0,0,0,0.5);
}

/* Waveform */
.waveform-container {
  width: 100%; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px; margin-bottom: 8px;
}
#waveformCanvas { width: 100%; max-width: 340px; height: 60px; border-radius: 8px; }
.rec-timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--red); }

.rec-status { font-size: 15px; color: var(--text-muted); text-align: center; margin-bottom: 16px; }

.rec-controls {
  display: flex; gap: 16px; margin-bottom: 24px;
}
.ctrl-btn {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--glass-bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:active { transform: scale(0.94); }
.ctrl-red { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.3); }

/* Transcript */
.transcript-section { width: 100%; margin-top: 16px; }
.transcript-section h3 { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.transcript-area {
  width: 100%; min-height: 120px; resize: vertical;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 14px; padding: 12px; outline: none;
  line-height: 1.6;
}
.transcript-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.transcript-actions .btn { flex: 1; min-width: 140px; }

/* ── Loading ───────────────────────────────────────────────── */
.loading-row {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted); font-size: 13px; margin: 10px 0;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--blue-lt);
  border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Preview ───────────────────────────────────────────────── */
.preview-header {
  padding: 16px; margin-bottom: 14px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ph-item label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; }
.ph-item span  { font-weight: 600; font-size: 14px; }

.preview-text { font-size: 14px; line-height: 1.7; color: var(--text); }

/* Novedades */
.novedad-item {
  border-left: 3px solid var(--blue);
  padding: 10px 12px; margin-bottom: 10px;
  background: rgba(255,255,255,0.03); border-radius: 0 8px 8px 0;
}
.novedad-item.resuelta { border-color: var(--green); }
.novedad-item.pendiente { border-color: var(--red); }
.nov-hora { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; }
.nov-desc { font-size: 14px; margin: 4px 0; }
.nov-acciones { font-size: 12px; color: var(--text-muted); }
.nov-estado {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 12px; margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.estado-ok  { background: rgba(16,185,129,0.15); color: var(--green); }
.estado-pend{ background: rgba(220,38,38,0.15);  color: var(--red); }

.sin-novedad {
  text-align: center; padding: 24px;
  color: var(--green); font-weight: 700; font-size: 16px;
}

.actions-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-top: 8px;
}
.save-status {
  text-align: center; margin-top: 12px; font-size: 13px;
  padding: 10px; border-radius: 8px;
}
.save-ok   { background: rgba(16,185,129,0.15); color: var(--green); }
.save-err  { background: rgba(220,38,38,0.15);  color: var(--red); }

/* ── Admin ─────────────────────────────────────────────────── */
.admin-body { padding-top: 12px; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-btn {
  flex: 1; padding: 10px; border-radius: 10px;
  background: var(--glass-bg); border: 1px solid var(--border);
  color: var(--text-muted); font-family: var(--font); font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.tab-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px; margin-bottom: 14px;
}
.filters input, .filters select { flex: 1; min-width: 120px; padding: 9px 12px; font-size: 13px; }

.admin-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--bg2); padding: 10px 12px; text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: rgba(255,255,255,0.03); }

.add-form {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px; margin-bottom: 14px;
}
.add-form input, .add-form select { flex: 1; min-width: 160px; }

.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-list-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--glass-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.ali-info h4 { font-size: 14px; font-weight: 600; }
.ali-info p  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ali-del { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: color 0.2s; }
.ali-del:hover { color: var(--red); }

/* ── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.error-msg { color: var(--red); font-size: 13px; text-align: center; margin-top: 8px; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
  padding: 12px 24px; border-radius: 100px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9999; pointer-events: none;
  transition: opacity 0.3s;
}
.toast-show { animation: toastIn 0.3s ease; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Adjuntos ──────────────────────────────────────────────── */
.attach-section { width: 100%; margin-top: 16px; }
.attach-label {
  display: flex; align-items: center; gap: 10px;
  background: var(--glass-bg); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  cursor: pointer; transition: background 0.2s; font-size: 14px; color: var(--text-muted);
}
.attach-label:hover { background: var(--glass-bg2); color: var(--text); }
.attach-icon { font-size: 20px; }
.attach-preview {
  margin-top: 10px; border-radius: var(--radius-sm);
  overflow: hidden; border: 1px solid var(--border);
}
.attach-preview img { width: 100%; max-height: 200px; object-fit: cover; display: block; }
.attach-preview .attach-file {
  padding: 10px 14px; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}
.attach-remove {
  margin-top: 6px; background: none; border: none;
  color: var(--red); font-size: 12px; cursor: pointer; padding: 2px 8px;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

/* ── Responsive tweaks ─────────────────────────────────────── */
@media (max-width: 380px) {
  .record-btn { width: 100px; height: 100px; font-size: 34px; }
  .ring1 { width: 136px; height: 136px; }
  .ring2 { width: 152px; height: 152px; }
  .ring3 { width: 168px; height: 168px; }
  .actions-grid { grid-template-columns: 1fr; }
}
@media (min-width: 600px) {
  .screen-body { padding: 28px 24px 80px; }
}
