/* ============================================================
   styles.css — FarmaRed
   Estilos globales del sistema.
   Paleta azul corporativo + neutros.
   ============================================================ */

/* ── RESET Y BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f4f3ef;
  -webkit-font-smoothing: antialiased;
}

/* ── VARIABLES ────────────────────────────────────────────── */
:root {
  --azul:        #185FA5;
  --azul-dark:   #0C447C;
  --azul-light:  #E6F1FB;
  --verde:       #3B6D11;
  --verde-light: #EAF3DE;
  --amber:       #BA7517;
  --amber-light: #FAEEDA;
  --rojo:        #A32D2D;
  --rojo-light:  #FCEBEB;
  --gris:        #5F5E5A;
  --gris-light:  #F1EFE8;
  --border:      rgba(0,0,0,0.10);
  --border-md:   rgba(0,0,0,0.18);
  --bg:          #f4f3ef;
  --surface:     #ffffff;
  --radius:      8px;
  --radius-lg:   12px;
}

/* ── LAYOUT PRINCIPAL ─────────────────────────────────────── */
.fdd-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.fdd-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 52px);
}

.fdd-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  background: var(--bg);
}

/* ── HEADER ───────────────────────────────────────────────── */
.fdd-header {
  background: var(--azul);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
}

.fdd-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.fdd-header-mark {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
}

.fdd-header-mark svg { width: 14px; height: 14px; }

.fdd-header-brand {
  font-size: 14px; font-weight: 500; color: #fff;
}

.fdd-header-divider {
  width: 1px; height: 18px;
  background: rgba(255,255,255,0.2);
}

.fdd-header-section {
  font-size: 13px; color: rgba(255,255,255,0.7);
}

.fdd-header-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 12px;
}

.fdd-suc-badge {
  font-size: 12px; color: #B5D4F4;
  border: 0.5px solid rgba(255,255,255,0.2);
  padding: 3px 10px; border-radius: 20px;
}

.fdd-user-info { text-align: right; cursor: pointer; }
.fdd-user-name { font-size: 12px; font-weight: 500; color: #fff; }
.fdd-user-role { font-size: 11px; color: rgba(255,255,255,0.55); }

.fdd-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: #fff;
}

/* ── SIDEBAR (íconos) ─────────────────────────────────────── */
.fdd-sidenav {
  width: 52px; min-width: 52px;
  border-right: 0.5px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; padding: 10px 0; gap: 2px;
}

.fdd-nav-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.12s;
  position: relative; text-decoration: none;
  border: none; background: transparent;
}

.fdd-nav-btn:hover  { background: #f4f3ef; }
.fdd-nav-btn.active { background: var(--azul-light); }
.fdd-nav-btn svg    { width: 16px; height: 16px; color: #888780; }
.fdd-nav-btn.active svg { color: var(--azul); }

.fdd-nav-spacer { flex: 1; }

.fdd-nav-notif {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); border: 1.5px solid var(--surface);
}

/* ── TARJETAS ─────────────────────────────────────────────── */
.fdd-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
}

.fdd-card:last-child { margin-bottom: 0; }

.fdd-card-head {
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.fdd-card-title { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.fdd-card-body  { padding: 14px 16px; }

/* ── MÉTRICAS ─────────────────────────────────────────────── */
.fdd-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.fdd-metric {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative; overflow: hidden;
}

.fdd-metric-bar {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 3px; border-radius: 2px 2px 0 0;
}

.fdd-metric-label { font-size: 11px; color: #888780; margin-bottom: 5px; margin-top: 4px; }
.fdd-metric-val   { font-size: 24px; font-weight: 500; color: #1a1a1a; line-height: 1; }
.fdd-metric-sub   { font-size: 11px; color: #b4b2a9; margin-top: 3px; }

/* ── TABLA ────────────────────────────────────────────────── */
.fdd-table-wrap {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.fdd-table {
  width: 100%; border-collapse: collapse;
  table-layout: fixed;
}

.fdd-table th {
  font-size: 11px; font-weight: 500; color: #888780;
  padding: 8px 14px; text-align: left;
  background: #f9f8f5;
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
}

.fdd-table td {
  font-size: 12px; color: #1a1a1a;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}

.fdd-table tr:last-child td { border-bottom: none; }

.fdd-table tbody tr {
  cursor: pointer; transition: background 0.12s;
}

.fdd-table tbody tr:hover { background: #f9f8f5; }

.fdd-table .r { text-align: right; }
.fdd-table .muted { color: #888780; font-size: 11px; }

/* ── FORMULARIOS ──────────────────────────────────────────── */
.fdd-field { margin-bottom: 14px; }
.fdd-field:last-child { margin-bottom: 0; }

.fdd-label {
  display: block;
  font-size: 11px; font-weight: 500; color: #888780;
  margin-bottom: 5px;
}

.fdd-input {
  width: 100%;
  padding: 8px 11px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 13px; color: #1a1a1a;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fdd-input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 2px rgba(24,95,165,0.12);
}

.fdd-input:disabled {
  background: #f4f3ef; color: #888780; cursor: not-allowed;
}

.fdd-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fdd-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* Toggle de forma de pago */
.fdd-pago-toggle { display: flex; gap: 6px; }

.fdd-pago-btn {
  flex: 1; padding: 8px 0;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  color: #888780; font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: center;
  transition: all 0.15s;
}

.fdd-pago-btn.sel {
  background: var(--azul); color: #fff; border-color: var(--azul);
}

.fdd-pago-btn.sel-green {
  background: var(--verde); color: #fff; border-color: var(--verde);
}

/* ── BOTONES ──────────────────────────────────────────────── */
.fdd-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-md);
  background: var(--surface);
  font-size: 13px; font-weight: 500; color: #1a1a1a;
  cursor: pointer; transition: all 0.12s;
  text-decoration: none; white-space: nowrap;
}

.fdd-btn:hover    { background: #f4f3ef; }
.fdd-btn:active   { transform: scale(0.98); }
.fdd-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.fdd-btn-primary {
  background: var(--azul); color: #fff; border-color: var(--azul);
}
.fdd-btn-primary:hover { background: var(--azul-dark); }

.fdd-btn-success {
  background: var(--verde); color: #fff; border-color: var(--verde);
}
.fdd-btn-success:hover { background: #27500A; }

.fdd-btn-danger {
  background: var(--rojo); color: #fff; border-color: var(--rojo);
}
.fdd-btn-danger:hover { background: #791F1F; }

.fdd-btn-sm { padding: 4px 10px; font-size: 11px; }
.fdd-btn-lg { padding: 11px 20px; font-size: 14px; width: 100%; }

.fdd-btn-outline-blue {
  border-color: var(--azul); color: var(--azul); background: transparent;
}
.fdd-btn-outline-blue:hover { background: var(--azul-light); }

.fdd-btn-outline-green {
  border-color: var(--verde); color: var(--verde); background: transparent;
}
.fdd-btn-outline-green:hover { background: var(--verde-light); }

/* ── TOOLBAR DE FILTROS ───────────────────────────────────── */
.fdd-toolbar {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; flex-wrap: wrap;
}

.fdd-search-wrap { position: relative; flex: 1; min-width: 160px; }

.fdd-search-wrap svg {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px; color: #b4b2a9;
  pointer-events: none;
}

.fdd-search {
  width: 100%; padding: 7px 10px 7px 30px;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  font-size: 13px; color: #1a1a1a;
  background: var(--surface);
}

.fdd-search:focus {
  outline: none; border-color: var(--azul);
  box-shadow: 0 0 0 2px rgba(24,95,165,0.10);
}

.fdd-filter-group { display: flex; gap: 4px; }

.fdd-filter-btn {
  padding: 5px 12px; border-radius: 20px;
  border: 0.5px solid var(--border-md);
  background: var(--surface); color: #888780;
  font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: all 0.12s;
}

.fdd-filter-btn:hover { background: #f4f3ef; }
.fdd-filter-btn.f-active { background: var(--azul); color: #fff; border-color: var(--azul); }
.fdd-filter-btn.f-amber  { background: var(--amber-light); color: #633806; border-color: #FAC775; }
.fdd-filter-btn.f-green  { background: var(--verde-light); color: #27500A; border-color: #C0DD97; }

.fdd-sep {
  width: 1px; height: 20px;
  background: var(--border); flex-shrink: 0;
}

/* ── PAGINACIÓN ───────────────────────────────────────────── */
.fdd-pag {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  border-top: 0.5px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}

.fdd-pag-info { font-size: 12px; color: #888780; }

.fdd-pag-btns { display: flex; gap: 4px; }

.fdd-pag-btn {
  padding: 5px 10px; border-radius: var(--radius);
  border: 0.5px solid var(--border-md);
  background: var(--surface); font-size: 12px;
  color: #888780; cursor: pointer;
}

.fdd-pag-btn.on {
  background: var(--azul); color: #fff; border-color: var(--azul);
}

/* ── CHECK DE MERCANCÍA ───────────────────────────────────── */
.fdd-check-box {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1.5px solid var(--border-md);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; flex-shrink: 0;
}

.fdd-check-box.on {
  background: var(--verde); border-color: var(--verde);
}

.fdd-check-box svg { width: 12px; height: 12px; opacity: 0; }
.fdd-check-box.on svg { opacity: 1; }

/* ── BARRA DE PROGRESO ────────────────────────────────────── */
.fdd-progress-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-top: 0.5px solid var(--border);
  background: #f9f8f5;
}

.fdd-progress-track {
  flex: 1; height: 6px;
  background: var(--border);
  border-radius: 3px; overflow: hidden;
}

.fdd-progress-fill {
  height: 100%; background: var(--verde);
  border-radius: 3px; transition: width 0.3s;
}

/* ── TICKET PREVIEW ───────────────────────────────────────── */
.fdd-ticket {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px; line-height: 1.7;
  color: #1a1a1a;
}

.fdd-ticket-center { text-align: center; }
.fdd-ticket-bold   { font-weight: 700; }
.fdd-ticket-sep    { border: none; border-top: 1px dashed #b4b2a9; margin: 5px 0; }
.fdd-ticket-row    { display: flex; justify-content: space-between; }

.fdd-ticket-stamp {
  text-align: center; font-size: 13px; font-weight: 700;
  color: var(--verde); border: 2px solid var(--verde);
  border-radius: var(--radius); padding: 5px 0;
  margin: 6px 0; letter-spacing: 0.08em;
}

.fdd-barcode {
  width: 100%; height: 32px;
  background: repeating-linear-gradient(
    90deg, #1a1a1a 0px, #1a1a1a 2px,
    transparent 2px, transparent 4px
  );
  opacity: 0.75; border-radius: 2px;
  margin: 6px 0 2px;
}

/* ── PÁGINA DE LOGIN ──────────────────────────────────────── */
.fdd-login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}

.fdd-login-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 380px;
  overflow: hidden;
}

.fdd-login-header {
  background: var(--azul);
  padding: 28px 28px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.fdd-login-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
}

.fdd-login-icon svg { width: 22px; height: 22px; }
.fdd-login-title { font-size: 18px; font-weight: 500; color: #fff; }
.fdd-login-sub   { font-size: 12px; color: rgba(255,255,255,0.6); }

.fdd-login-body { padding: 24px 28px 28px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .fdd-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fdd-main { padding: 14px 14px; }

  .fdd-toolbar { padding: 8px 14px; }

  .fdd-row2, .fdd-row3 {
    grid-template-columns: 1fr;
  }

  /* Oculta columnas menos importantes en móvil */
  .fdd-hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
  .fdd-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .fdd-header { padding: 0 14px; gap: 10px; }
  .fdd-user-info { display: none; }
}
