/* =========================================================
   FLETES LARGA DISTANCIA - ADMIN CSS (PREMIUM RECOVERY)
   /static/css/admin.css
   ========================================================= */

:root {
  --primary: #D3A129;
  --accent: #2F4858;
  --bg: #F8FAFB;
  --card: #FFFFFF;
  --ink: #1A1A1B;
  --muted: #64748B;
  --stroke: #E2E8F0;
  --ok: #10B981;
  --warn: #F59E0B;
  --bad: #EF4444;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* HIDDEN ELEMENTS BY DEFAULT */
.overlay {
  display: none !important;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  z-index: 9999;
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.overlay.open {
  display: flex !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 4%;
}

h1 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 30px;
}

h1 .accent {
  color: var(--primary);
}

.panel {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 30px;
}

/* LOGIN */
.login-row {
  max-width: 420px;
  margin: 60px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
  align-items: center;
}

.input {
  width: 100%;
  padding: 16px 20px;
  border: 1.5px solid var(--stroke);
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  outline: none;
  background: #fdfdfd;
  color: var(--ink);
}

.input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(211, 161, 41, 0.12);
}

.login-row .btn-primary {
  width: 100%;
  padding: 18px;
  font-size: 1rem;
  margin-top: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 10px;
}

.tag.muted {
  background: #f1f5f9;
  color: #94a3b8;
}

.tag.ok {
  background: #ecfdf5;
  color: #10b981;
}

/* TABS */
.view-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 25px;
  background: #eaeff2;
  padding: 6px;
  border-radius: 12px;
  width: fit-content;
}

.btn-out {
  background: #f1f5f9;
  border: none;
  padding: 8px 16px;
  border-radius: 50px;
  color: #64748b;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: .2s;
  font-family: 'Montserrat', sans-serif;
}

.btn-out:hover {
  background: var(--bad);
  color: #fff;
}

.view-tab {
  border: none;
  background: transparent;
  padding: 10px 22px;
  cursor: pointer;
  font-weight: 700;
  border-radius: 8px;
  color: #788fa1;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  transition: .2s;
}

.view-tab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.requests-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  border: 1px solid var(--stroke);
  background: #fff;
  padding: 8px 18px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  color: #777;
  font-size: 0.85rem;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* CALENDAR ARROWS & HEAD */
.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  gap: 15px;
}

.cal-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent);
  text-transform: capitalize;
}

.mini-btn {
  background: #fff;
  border: 1.5px solid var(--stroke);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 800;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fdfdfd;
}

.mini-btn.primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
}

/* CALENDAR GRID */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.cal-dow {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  padding-bottom: 10px;
}

.cal-cell {
  background: #fff;
  border: 1px solid var(--stroke);
  min-height: 110px;
  border-radius: 12px;
  padding: 12px;
  transition: .2s;
}

.cal-cell:hover:not(.muted) {
  border-color: var(--primary);
  background: #fffdf5;
}

.cal-num {
  font-weight: 800;
  color: #d1d5db;
  font-size: 1.1rem;
}

.cal-cell.has-flete .cal-num {
  background: var(--primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  text-align: center;
  line-height: 28px;
  display: inline-block;
}

/* CALENDAR DETAIL */
.cal-detail {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 2px solid #f1f5f9;
}

.cal-detail-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  margin-bottom: 20px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal-detail-title strong {
  color: var(--primary);
  margin-left: 5px;
}

.cal-detail-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 10px;
}

.cal-detail-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.empty {
  grid-column: 1 / -1;
  padding: 40px 10px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.cal-card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s;
}

.cal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.cal-card-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.cal-card-time {
  color: var(--primary);
}

.cal-card-title {
  font-weight: 800;
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 6px;
}

.cal-card-route {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 15px;
  line-height: 1.4;
}

.cal-card-actions {
  display: flex;
  justify-content: flex-end;
}

/* DISPONIBILIDAD BAR */
/* DISPONIBILIDAD BAR */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
  background: #f8fafb;
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

.disp-group {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.date-input {
  padding: 8px 12px;
  border: 1.5px solid var(--stroke);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  color: var(--accent);
  font-weight: 700;
  outline: none;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.date-input:focus {
  border-color: var(--primary);
}

.disp-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.disp-pill {
  padding: 6px 14px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.disp-pill.on {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.disp-pill.off {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* SLOTS */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 15px;
  margin-top: 30px;
}

.disp-hint {
  margin-top: 15px;
  font-size: 0.85rem;
  color: #94a3b8;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

.disp-hint::before {
  content: 'ℹ';
  display: inline-flex;
  width: 18px;
  height: 18px;
  background: #f1f5f9;
  color: var(--accent);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-weight: 700;
  font-size: 0.7rem;
}

.slot {
  background: #fff;
  border: 1.5px solid var(--stroke);
  padding: 14px 10px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
  color: var(--muted);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
}

.slot:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.slot.on {
  border-color: var(--ok);
  color: #fff;
  background: var(--ok);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.slot.off {
  border-style: dashed;
  color: #a1a1aa;
  background: #fafafa;
  opacity: 0.6;
}

.slot.locked {
  background: #f1f5f9;
  color: #cbd5e1;
  cursor: not-allowed;
  border-style: solid;
  border-color: #e2e8f0;
}

/* TABLE */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.thead th {
  text-align: left;
  padding: 12px 20px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.row td {
  padding: 18px 20px;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}

.row td:first-child {
  border-left: 1px solid #f1f5f9;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.row td:last-child {
  border-right: 1px solid #f1f5f9;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  text-align: right;
}

.row:hover td {
  background: #fdfdfd;
}

.client .name {
  font-weight: 700;
  color: var(--accent);
  display: block;
}

.client .sub {
  color: var(--muted);
  font-size: 0.85rem;
}

/* MODAL */
.modal {
  background: #fff;
  padding: 40px;
  border-radius: 20px;
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 25px;
}

.grid-modal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.kv {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  overflow-wrap: anywhere;
}

.kv small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  display: block;
}

.kv strong {
  font-size: 0.95rem;
  color: var(--ink);
  display: block;
  margin-top: 4px;
}

.kv.total {
  grid-column: 1 / -1;
  background: #fffdf5;
  padding: 15px 25px;
  border-radius: 12px;
  text-align: right;
  border: 1px solid var(--primary);
  margin-top: 10px;
}

#m_total {
  font-size: 1.6rem;
  color: var(--primary);
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  display: block;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  outline: none;
  background: none;
  appearance: none;
  -webkit-appearance: none;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .2s ease;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-ok {
  background: var(--ok);
  color: #fff;
}

.btn-reject {
  background: var(--bad);
  color: #fff;
}

.btn-danger {
  background: #f4f4f5;
  color: #52525b;
}

.btn-ghost {
  background: transparent;
  color: #64748b;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-ghost:hover {
  background: #f8fafb;
  border-color: var(--accent) !important;
  color: var(--accent);
}

.modal-close {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-weight: 700;
  transition: .2s;
}

.modal-close:hover {
  background: #e2e8f0;
  color: var(--bad);
  transform: rotate(90deg);
}

.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #f1f5f9;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .container {
    padding: 130px 20px 40px;
  }

  .table {
    display: block !important;
    border: none !important;
  }

  .thead {
    display: none !important;
  }

  tbody {
    display: block;
    width: 100%;
  }

  .row {
    display: block;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  }

  .row td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none !important;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafb !important;
    text-align: left !important;
  }

  .row td:first-child {
    border-radius: 0;
  }

  .row td:last-child {
    border: none !important;
    margin-top: 5px;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    text-align: center !important;
  }

  .row td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
  }

  .grid-modal {
    grid-template-columns: 1fr;
  }

  .cal-cell {
    min-height: 65px;
    padding: 8px;
  }

  .cal-num {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .nav-links {
    gap: 8px;
  }

  .nav-links a {
    font-size: 0.75rem;
    padding: 0 4px;
  }

  .btn-out {
    padding: 6px 10px;
    font-size: 0.7rem;
  }

  .container {
    padding: 130px 15px 40px;
  }

  .cal-grid {
    gap: 6px;
  }

  .cal-cell {
    min-height: 55px;
    padding: 4px;
  }

  .cal-num {
    font-size: 0.85rem;
  }

  .cal-detail-body {
    grid-template-columns: 1fr;
  }

  .slots {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .view-tab {
    padding: 10px 10px;
    font-size: 0.7rem;
  }

  /* Disp Mobile */
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .disp-group {
    justify-content: space-between;
  }

  .disp-actions {
    justify-content: space-between;
  }

  .disp-actions .mini-btn {
    flex: 1;
    justify-content: center;
  }
}

/* HISTORICAL TOOLBAR */
.hist-toolbar {
  background: transparent;
  margin-bottom: 25px;
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.hist-select {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  /* More rounded */
  padding: 12px 40px 12px 18px;
  /* Bigger padding */
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--accent);
  background-color: #fff;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D3A129' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  /* Gold arrow */
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  transition: all 0.3s ease;
  min-width: 180px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  /* Subtle lift */
}

.hist-select:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.hist-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(211, 161, 41, 0.15);
}

.hist-search {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.hist-search input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  /* Matches select height */
  border: 1px solid var(--stroke);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s ease;
  background-color: #fff;
  color: var(--ink);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.hist-search input::placeholder {
  color: #94a3b8;
}

.hist-search input:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.hist-search input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(211, 161, 41, 0.15);
}

.hist-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.3s;
}

.hist-search input:focus+.hist-search-icon {
  color: var(--primary);
  /* Icon activates on focus */
}