/* ============================================================
   Auditoría Competencia Ashley – Estilos
   ============================================================ */

:root {
  --ashley-blue:   #003B8E;
  --ashley-blue2:  #0051c4;
  --ashley-red:    #E31837;
  --white:         #ffffff;
  --gray-50:       #f8f9fa;
  --gray-100:      #f1f3f5;
  --gray-200:      #e9ecef;
  --gray-300:      #dee2e6;
  --gray-400:      #ced4da;
  --gray-500:      #adb5bd;
  --gray-600:      #6c757d;
  --gray-700:      #495057;
  --gray-800:      #343a40;
  --green:         #198754;
  --green-light:   #d1e7dd;
  --red-light:     #f8d7da;
  --yellow:        #ffc107;
  --yellow-light:  #fff3cd;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(0,59,142,.10);
  --shadow-lg:     0 4px 24px rgba(0,59,142,.15);
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition:    .2s ease;
}

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

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

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }

/* ── Login ─────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--ashley-blue) 0%, var(--ashley-blue2) 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 160px;
  margin-bottom: 1.5rem;
}

.login-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ashley-blue);
  margin-bottom: .3rem;
}

.login-subtitle {
  font-size: .82rem;
  color: var(--gray-600);
  margin-bottom: 1.8rem;
}

/* ── App wrapper ───────────────────────────────────────────── */
#app { display: none; flex-direction: column; min-height: 100vh; }

/* ── Header ────────────────────────────────────────────────── */
.app-header {
  background: var(--ashley-blue);
  color: var(--white);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-logo { height: 36px; }

.header-title {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  flex: 1;
  text-align: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.header-user {
  font-size: .78rem;
  opacity: .85;
}

/* ── Nav tabs ──────────────────────────────────────────────── */
.nav-tabs-bar {
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  overflow-x: auto;
}

.nav-tab {
  padding: .7rem 1.2rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-600);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nav-tab.active {
  color: var(--ashley-blue);
  border-bottom-color: var(--ashley-red);
}

.nav-tab:hover:not(.active) {
  color: var(--ashley-blue);
  background: var(--gray-50);
}

/* ── Content ───────────────────────────────────────────────── */
.content { flex: 1; padding: 1.25rem; max-width: 700px; margin: 0 auto; width: 100%; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card-header {
  background: var(--ashley-blue);
  color: var(--white);
  padding: .75rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.card-header-icon {
  font-size: 1.1rem;
}

.card-header h3 {
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.card-body { padding: 1.1rem; }

/* Bloque A accent */
.card-header.bloque-a { background: var(--ashley-blue); }
.card-header.bloque-b { background: #1a5276; }

/* ── Form elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.form-label .required { color: var(--ashley-red); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  font-size: .9rem;
  color: var(--gray-800);
  transition: var(--transition);
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--ashley-blue2);
  box-shadow: 0 0 0 3px rgba(0,81,196,.12);
}

/* ── GPS bar ───────────────────────────────────────────────── */
.gps-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  padding: .55rem .85rem;
  font-size: .82rem;
  color: var(--gray-600);
}

.gps-bar.active { border-color: var(--green); background: var(--green-light); color: #0a3622; }
.gps-bar.error  { border-color: var(--ashley-red); background: var(--red-light); }

.gps-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gray-400);
  flex-shrink: 0;
}

.gps-bar.active .gps-dot { background: var(--green); }
.gps-bar.error .gps-dot  { background: var(--ashley-red); }

/* ── Radio/Checkbox groups ─────────────────────────────────── */
.radio-group, .check-group {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.radio-option, .check-option {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-300);
  border-radius: 7px;
  padding: .5rem .85rem;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 500;
  transition: var(--transition);
  user-select: none;
}

.radio-option input, .check-option input { display: none; }

.radio-option:has(input:checked),
.check-option:has(input:checked) {
  border-color: var(--ashley-blue);
  background: #e8eef8;
  color: var(--ashley-blue);
  font-weight: 600;
}

.radio-option.si:has(input:checked) { border-color: var(--green); background: var(--green-light); color: #0a3622; }
.radio-option.no:has(input:checked) { border-color: var(--ashley-red); background: var(--red-light); color: #721c24; }

/* ── Conditional block ─────────────────────────────────────── */
.conditional-block {
  display: none;
  border-left: 3px solid var(--ashley-blue);
  padding-left: 1rem;
  margin-top: .75rem;
  animation: slideDown .2s ease;
}

.conditional-block.visible { display: block; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Marca row ─────────────────────────────────────────────── */
.marca-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.marca-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--gray-600);
  min-width: 52px;
  text-transform: uppercase;
}

/* ── Foto upload ───────────────────────────────────────────── */
.foto-upload-zone {
  border: 2px dashed var(--gray-400);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
  position: relative;
}

.foto-upload-zone:hover { border-color: var(--ashley-blue); background: #eef2fa; }
.foto-upload-zone.has-file { border-color: var(--green); background: var(--green-light); }

.foto-upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.foto-upload-icon { font-size: 2rem; margin-bottom: .4rem; }
.foto-upload-text { font-size: .82rem; color: var(--gray-600); font-weight: 500; }

.foto-preview {
  display: none;
  margin-top: .75rem;
}

.foto-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--gray-300);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: var(--ashley-blue);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) { background: var(--ashley-blue2); }

.btn-success {
  background: var(--green);
  color: var(--white);
}

.btn-success:hover:not(:disabled) { background: #146c43; }

.btn-danger {
  background: var(--ashley-red);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) { background: #b71429; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: .35rem .75rem; font-size: .78rem; }

.btn-block { width: 100%; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: .3rem;
  border-radius: 6px;
  font-size: 1rem;
  transition: var(--transition);
}

.btn-icon:hover { background: var(--gray-200); }

/* ── Submit footer ─────────────────────────────────────────── */
.form-footer {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 2px solid var(--gray-200);
  padding: 1rem 1.25rem;
  display: flex;
  gap: .75rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
  min-width: 280px;
}

.toast {
  background: var(--gray-800);
  color: var(--white);
  padding: .75rem 1.2rem;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: toastIn .25s ease;
}

.toast.success { background: var(--green); }
.toast.error   { background: var(--ashley-red); }
.toast.warning { background: var(--yellow); color: var(--gray-800); }

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

/* ── Admin table ───────────────────────────────────────────── */
.admin-filters {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-filters .form-control {
  flex: 1;
  min-width: 140px;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.data-table thead {
  background: var(--ashley-blue);
  color: var(--white);
}

.data-table th {
  padding: .65rem .85rem;
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.data-table td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: top;
}

.data-table tbody tr:hover { background: var(--gray-50); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
}

.badge-si   { background: var(--green-light);  color: #0a3622; }
.badge-no   { background: var(--red-light);    color: #721c24; }
.badge-na   { background: var(--gray-200);     color: var(--gray-600); }

.thumb-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--gray-300);
  transition: var(--transition);
}

.thumb-img:hover { transform: scale(1.08); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}

.modal-header {
  background: var(--ashley-blue);
  color: var(--white);
  padding: .85rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 14px 14px 0 0;
}

.modal-header h4 { font-size: .9rem; font-weight: 700; }

.modal-body { padding: 1.1rem; }

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

.detail-row {
  display: flex;
  gap: .5rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .83rem;
}

.detail-key {
  font-weight: 600;
  color: var(--gray-600);
  min-width: 140px;
  flex-shrink: 0;
  font-size: .76rem;
  text-transform: uppercase;
}

.detail-val { color: var(--gray-800); }

.section-divider {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--white);
  background: var(--ashley-blue);
  padding: .3rem .7rem;
  border-radius: 4px;
  margin: .75rem 0 .5rem;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.page-btn {
  padding: .35rem .7rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  background: var(--white);
  font-size: .8rem;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn.active { background: var(--ashley-blue); color: var(--white); border-color: var(--ashley-blue); }
.page-btn:hover:not(.active) { background: var(--gray-100); }

/* ── Stats cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-number {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ashley-blue);
  line-height: 1;
}

.stat-label {
  font-size: .72rem;
  color: var(--gray-600);
  margin-top: .3rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p    { font-size: .88rem; }

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .content { padding: .75rem; }
  .card-body { padding: .85rem; }
  .header-title { font-size: .82rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
