/* ============================================================
   COTIZADOR VG POWER SYSTEMS v2.0 — style.css
   Paleta: Negro · Dorado · Amarillo · Blanco
   ============================================================ */

/* ── VARIABLES ─────────────────────────────────────────── */
:root {
  /* Paleta principal VG Power */
  --primary:       #C9970C;   /* dorado */
  --primary-dark:  #A67C00;   /* dorado oscuro */
  --primary-light: #FFF8E1;   /* dorado muy claro */
  --accent:        #FFD600;   /* amarillo brillante */
  --accent-dark:   #F9A825;   /* amarillo ámbar */

  /* Escala de negros */
  --bg-dark:       #0D0D0D;   /* negro profundo (topbar/sidebar) */
  --bg-dark2:      #1A1A1A;   /* negro sidebar */
  --bg-dark3:      #242424;   /* negro hover */
  --bg-dark4:      #2E2E2E;   /* negro cards oscuras */

  /* Grises */
  --gray-50:      #F9F9F9;
  --gray-100:     #F0F0F0;
  --gray-200:     #E0E0E0;
  --gray-300:     #BDBDBD;
  --gray-400:     #9E9E9E;
  --gray-500:     #757575;
  --gray-600:     #616161;
  --gray-700:     #424242;
  --gray-800:     #212121;
  --gray-900:     #111111;

  /* Estados */
  --danger:        #E53935;
  --success:       #2E7D32;
  --warning:       #F57F17;
  --info:          #1565C0;

  /* Layout */
  --sidebar-w:    245px;
  --topbar-h:     60px;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,.13);
  --shadow-md:    0 4px 16px rgba(0,0,0,.18);
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; } /* +1pt base */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1C1C1C;
  color: #D0D0D0;
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--topbar-h);
  background: var(--bg-dark);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.40);
  border-bottom: 2px solid var(--primary);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.sidebar-toggle {
  background: none; border: none; color: #fff; font-size: 19px;
  cursor: pointer; padding: 6px 9px; border-radius: var(--radius);
  transition: background .2s;
}
.sidebar-toggle:hover { background: rgba(201,151,12,.15); }

/* LOGO + MARCA */
.topbar-logo {
  height: 36px; width: auto; object-fit: contain;
  filter: brightness(0) invert(1); /* logo blanco sobre fondo negro */
}
.brand { display: flex; align-items: center; gap: 10px; line-height: 1.2; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 16px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.brand-accent { color: var(--accent); }
.brand-sub { font-size: 10px; color: var(--gray-400); letter-spacing: .3px; }

.user-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-admin    { background: rgba(201,151,12,.25); color: var(--accent); border: 1px solid rgba(201,151,12,.3); }
.badge-vendedor { background: rgba(255,255,255,.08); color: var(--gray-300); border: 1px solid rgba(255,255,255,.12); }
.badge-cliente  { background: rgba(255,255,255,.05); color: var(--gray-400); border: 1px solid rgba(255,255,255,.08); }

.btn-logout {
  background: none; border: none; color: var(--gray-400); font-size: 17px;
  cursor: pointer; padding: 6px 9px; border-radius: var(--radius);
  transition: color .2s;
}
.btn-logout:hover { color: var(--danger); text-decoration: none; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w); z-index: 900;
  background: var(--bg-dark2);
  display: flex; flex-direction: column;
  transition: transform .25s ease;
  overflow-y: auto;
  border-right: 1px solid rgba(201,151,12,.15);
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--primary);
  padding: 14px 16px 5px;
  opacity: .8;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 16px; color: var(--gray-300); font-size: 14px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(201,151,12,.1);
  color: var(--accent);
  text-decoration: none;
}
.nav-item.active {
  background: rgba(201,151,12,.15);
  color: var(--accent);
  border-left-color: var(--primary);
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(201,151,12,.15);
  font-size: 12px; color: #757575;
}

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 850;
  background: rgba(0,0,0,.55);
}
.sidebar-overlay.show { display: block; }

/* ── MAIN CONTENT ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left .25s ease;
  padding: 24px;
}
.main-content.expanded { margin-left: 0; }
.content-wrapper { max-width: 1400px; margin: 0 auto; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 22px; font-weight: 800; color: #F0F0F0; }
.page-title span { color: var(--primary); }
.page-subtitle { font-size: 13px; color: #9E9E9E; margin-top: 2px; }
.breadcrumb { font-size: 12px; color: #9E9E9E; margin-bottom: 8px; }
.breadcrumb a { color: var(--primary); }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: #242424;
  color: #D0D0D0; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.card-title {
  font-size: 15px; font-weight: 700; color: #E0E0E0;
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }
.card-body { padding: 20px; background: #242424; border-radius: 0 0 var(--radius) var(--radius); }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,.08); color: #D0D0D0;
  background: #1E1E1E;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── STATS GRID ─────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #2A2A2A; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
  border-left: 4px solid var(--primary);
}
.stat-card.green  { border-left-color: var(--success); }
.stat-card.yellow { border-left-color: var(--warning); }
.stat-card.red    { border-left-color: var(--danger); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(201,151,12,.15); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.stat-card.green  .stat-icon { background: rgba(46,125,50,.2); color: #66BB6A; }
.stat-card.yellow .stat-icon { background: rgba(245,127,23,.2); color: #FFB74D; }
.stat-card.red    .stat-icon { background: rgba(229,57,53,.2); color: #EF9A9A; }
.stat-value { font-size: 24px; font-weight: 800; color: #F0F0F0; }
.stat-label { font-size: 12px; color: #9E9E9E; text-transform: uppercase; letter-spacing: .5px; }

/* ── TABLA ───────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #9E9E9E;
  background: #1E1E1E;
  border-bottom: 2px solid rgba(201,151,12,.2);
}
tbody td { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; color: #D0D0D0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(201,151,12,.08); }
code { font-family: monospace; font-size: 12px; background: #1A1A1A; padding: 2px 6px; border-radius: 4px; color: var(--accent); border: 1px solid rgba(201,151,12,.2); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-borrador  { background: #2A2A2A; color: #B0B0B0; border: 1px solid #444; }
.badge-enviado   { background: #0D2137; color: #64B5F6; border: 1px solid #1565C0; }
.badge-aprobado  { background: #0D2110; color: #66BB6A; border: 1px solid #2E7D32; }
.badge-rechazado { background: #1A0505; color: #EF9A9A; border: 1px solid #C62828; }
.badge-vencido   { background: #1A0E00; color: #FFB74D; border: 1px solid #E65100; }
.badge-admin     { background: rgba(201,151,12,.25); color: var(--accent); border: 1px solid rgba(201,151,12,.4); }
.badge-vendedor  { background: #0D0F1A; color: #7986CB; border: 1px solid #3949AB; }
.badge-cliente   { background: #160D1A; color: #CE93D8; border: 1px solid #6A1B9A; }
.badge-activo    { background: #0D2110; color: #66BB6A; border: 1px solid #2E7D32; }
.badge-inactivo  { background: #1A0505; color: #EF9A9A; border: 1px solid #C62828; }
.badge-perdido { background: #1A0000; color: #EF9A9A; border: 1px solid #E53935; }

/* ── FORMULARIOS ─────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 600; color: #C0C0C0; }
.form-control {
  padding: 9px 12px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; font-family: inherit;
  color: #E0E0E0; background: #2E2E2E;
  transition: border-color .15s, box-shadow .15s;
  border-color: rgba(255,255,255,.12);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,151,12,.15);
}
select.form-control {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23C9970C' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  background-size: 16px; padding-right: 34px;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint  { font-size: 11px; color: #757575; }
.form-error { font-size: 11px; color: var(--danger); display: none; }
.has-error .form-control { border-color: var(--danger); }
.has-error .form-error { display: block; }
.req { color: var(--primary); }

/* ── BOTONES ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; border: none; transition: all .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); filter: none; }
.btn-secondary { background: #3A3A3A; color: #D0D0D0; }
.btn-secondary:hover { background: #484848; filter: none; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #1B5E20; filter: none; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B71C1C; filter: none; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #E65100; filter: none; }
.btn-outline   { background: transparent; border: 1.5px solid rgba(255,255,255,.35); color: #E0E0E0; }
.btn-outline:hover { background: rgba(201,151,12,.1); border-color: var(--primary); color: var(--accent); filter: none; }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 7px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── ALERTAS ──────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 14px;
  animation: slideDown .3s ease;
}
.alert-success  { background: #0D2110; color: #81C784; border: 1px solid #2E7D32; }
.alert-error    { background: #1A0505; color: #EF9A9A; border: 1px solid #C62828; }
.alert-warning  { background: #1A0E00; color: #FFB74D; border: 1px solid #E65100; }
.alert-info     { background: #0D1A2E; color: #64B5F6; border: 1px solid #1565C0; }
.alert-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 16px; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* ── COTIZADOR ───────────────────────────────────────────── */
.familia-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 16px; background: #1E1E1E;
  border-bottom: 1px solid rgba(201,151,12,.15);
}
.familia-tab {
  padding: 8px 15px; border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1.5px solid rgba(201,151,12,.25); background: #2A2A2A; color: #B0B0B0;
  transition: all .15s;
}
.familia-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.familia-tab.active {
  background: var(--bg-dark); color: var(--accent);
  border-color: var(--primary);
}

.cotizador-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }
.opciones-panel { display: flex; flex-direction: column; gap: 12px; }

.opcion-row {
  display: grid; grid-template-columns: 230px 1fr;
  align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.opcion-row:last-child { border-bottom: none; }
.opcion-label { font-size: 13px; color: #B0B0B0; font-weight: 500; }

.precio-panel { position: sticky; top: calc(var(--topbar-h) + 20px); }
.precio-desglose { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.precio-line {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px;
}
.precio-line.total {
  font-size: 18px; font-weight: 800; color: var(--accent);
  padding-top: 12px; border-top: 2px solid var(--gray-200);
}
.precio-line .label { color: #9E9E9E; }
.precio-line .value { font-weight: 700; color: #E0E0E0; }

/* ── RESUMEN DE PARTIDAS ─────────────────────────────────── */
.partidas-list { display: flex; flex-direction: column; gap: 8px; }
.partida-item {
  border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius);
  padding: 12px 16px; display: flex; align-items: flex-start; gap: 12px;
  background: #2E2E2E;
}
.partida-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-dark); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  border: 1px solid var(--primary);
}
.partida-desc { flex: 1; }
.partida-nombre { font-weight: 600; font-size: 14px; color: #E0E0E0; }
.partida-opts { font-size: 12px; color: var(--gray-500); margin-top: 3px; }
.partida-precio { text-align: right; white-space: nowrap; }
.partida-precio .precio-unit { font-size: 11px; color: var(--gray-500); }
.partida-precio .precio-total { font-size: 15px; font-weight: 700; color: var(--accent); }

/* ── TOTALES FINALES ─────────────────────────────────────── */
.totales-card {
  background: var(--bg-dark);
  border: 1px solid var(--primary);
  color: #fff; border-radius: var(--radius); padding: 20px;
}
.totales-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totales-row.big {
  font-size: 19px; font-weight: 800; padding-top: 12px;
  border-top: 1px solid rgba(201,151,12,.4);
  color: var(--accent);
}
.totales-row .t-label { opacity: .7; }

/* ── LOGIN ───────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0A0A0A 0%, #1A1400 60%, #0A0A0A 100%);
  padding: 20px;
}
.login-box {
  background: #1A1A1A;
  border: 1px solid rgba(201,151,12,.3);
  border-radius: 14px; box-shadow: 0 8px 40px rgba(0,0,0,.6);
  padding: 40px; width: 100%; max-width: 420px;
}
/* Campos del login sobre fondo oscuro */
.login-box .form-control {
  background: #2A2A2A;
  border-color: rgba(201,151,12,.3);
  color: #fff;
}
.login-box .form-control::placeholder { color: var(--gray-500); }
.login-box .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,151,12,.2);
}
.login-box .form-label { color: var(--gray-300); }

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 60px; margin-bottom: 16px; }
.login-logo .logo-title {
  font-size: 24px; font-weight: 800; color: #fff;
  letter-spacing: .5px;
}
.login-logo .logo-title span { color: var(--accent); }
.login-logo .logo-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.login-box .alert-error { background: rgba(229,57,53,.15); border-color: rgba(229,57,53,.4); color: #EF9A9A; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.65); align-items: center; justify-content: center;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #242424; border-radius: 10px; box-shadow: var(--shadow-md);
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-header {
  padding: 16px 20px; border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-dark); border-radius: 10px 10px 0 0;
}
.modal-title { font-weight: 700; font-size: 15px; color: var(--accent); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--gray-400); }
.modal-close:hover { color: #fff; }
.modal-body { padding: 20px; background: #242424; }
.modal-footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: flex-end; gap: 8px; }

/* ── BÚSQUEDA Y FILTROS ──────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}
.search-box { position: relative; }
.search-box .form-control { padding-left: 34px; }
.search-box .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }

/* ── UTILITIES ───────────────────────────────────────────── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: #9E9E9E; }
.text-small  { font-size: 12px; }
.fw-bold     { font-weight: 700; }
.d-flex      { display: flex; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mb-16       { margin-bottom: 16px; }
.w-100       { width: 100%; }
.empty-state { text-align: center; padding: 60px 20px; color: #757575; }
.empty-state i { font-size: 50px; margin-bottom: 14px; display: block; color: var(--gray-300); }

/* ── ANIMACIONES ─────────────────────────────────────────── */
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn   { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Forzar fondo oscuro en toda la card del cotizador */
.cotizador-layout .card,
.cotizador-layout .card-body,
.cotizador-layout .familia-tabs,
.precio-panel,
.precio-panel .card-body { background: #242424 !important; }
/* Opciones del select en modo oscuro */
select.form-control option { background: #2E2E2E; color: #E0E0E0; }

/* Scrollbar oscuro */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1A1A1A; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }


/* ── FIXES DARK MODE ADICIONALES ──────────────────────────── */

/* Botones outline — iconos y texto visibles */
.btn-outline { color: #E0E0E0 !important; border-color: rgba(255,255,255,.35) !important; }
.btn-outline:hover { color: var(--accent) !important; border-color: var(--primary) !important; background: rgba(201,151,12,.1) !important; }
.btn-outline i { color: inherit; }

/* Botón bloqueo/desactivar naranja visible */
.btn-warning.btn-icon, .btn-warning.btn-sm { background: rgba(245,127,23,.15); color: #FFB74D; border: 1px solid rgba(245,127,23,.5); }
.btn-warning.btn-icon:hover, .btn-warning.btn-sm:hover { background: var(--warning); color: #fff; }

/* Cards de info general — fondo oscuro uniforme */
[style*="background:var(--gray-50)"],
[style*="background: var(--gray-50)"] {
  background: #1E1E1E !important;
  border: 1px solid rgba(201,151,12,.15) !important;
}

/* fw-bold en cards oscuras */
.card .fw-bold { color: #E0E0E0; }

/* text-muted en dark */
.card .text-muted { color: #9E9E9E !important; }

/* Íconos de acciones en tablas — visibles */
.btn.btn-outline.btn-sm i,
.btn.btn-outline.btn-icon i { color: #C0C0C0; }
.btn.btn-outline.btn-sm:hover i,
.btn.btn-outline.btn-icon:hover i { color: var(--accent); }

/* Badge sin clase definida — fallback */
.badge:not([class*="badge-"]) { background: #2A2A2A; color: #C0C0C0; border: 1px solid #444; }

/* "Perdido" sin badge class en texto plano */
td:not(.badge) { color: #D0D0D0; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .cotizador-layout { grid-template-columns: 1fr; }
  .opcion-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .topbar, .sidebar, .sidebar-overlay, .btn, .no-print { display: none !important; }
  .main-content { margin: 0; padding: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   📱 RESPONSIVE MOBILE - Solo afecta pantallas pequeñas
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  /* ─────────────────────────────────────────────────────────────
     LAYOUT GENERAL
     ───────────────────────────────────────────────────────────── */
  
  body {
    font-size: 15px; /* Texto más grande en móvil */
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  
  .page-title {
    font-size: 22px !important;
  }
  
  .page-subtitle {
    font-size: 13px;
  }
  
  .breadcrumb {
    font-size: 12px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     BOTONES MÁS GRANDES (mínimo 44px para táctil)
     ───────────────────────────────────────────────────────────── */
  
  .btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 15px;
    width: 100%; /* Botones ocupan todo el ancho */
    margin-bottom: 8px;
  }
  
  .btn-sm {
    min-height: 38px;
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  
  .btn-group .btn {
    margin: 0;
  }
  
  /* ─────────────────────────────────────────────────────────────
     CARDS - Stack vertical, sin grid
     ───────────────────────────────────────────────────────────── */
  
  .card {
    margin-bottom: 16px;
  }
  
  .card-body {
    padding: 16px;
  }
  
  .card-header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  
  .card-title {
    font-size: 16px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     TABLAS - Convertir a cards verticales
     ───────────────────────────────────────────────────────────── */
  
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 100%;
    font-size: 13px;
  }
  
  table th,
  table td {
    padding: 10px 8px;
    font-size: 13px;
  }
  
  /* Ocultar algunas columnas en móvil para que quepa */
  table th:nth-child(4),
  table td:nth-child(4) {
    display: none; /* Oculta columna de teléfono/detalles */
  }
  
  /* ─────────────────────────────────────────────────────────────
     PRODUCTOS - Layout vertical
     ───────────────────────────────────────────────────────────── */
  
  .producto-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #1E1E1E;
    border: 1px solid rgba(201,151,12,0.2);
    border-radius: 8px;
    margin-bottom: 12px;
  }
  
  .producto-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .producto-nombre {
    font-size: 16px;
    font-weight: 700;
    color: #E0E0E0;
  }
  
  .producto-familia {
    display: inline-block;
    background: rgba(201,151,12,0.15);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
  }
  
  .producto-precio {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 8px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     DETALLE PROYECTO - 2 columnas → 1 columna
     ───────────────────────────────────────────────────────────── */
  
  /* Forzar 1 columna en lugar de 2 */
  div[style*="display:grid"][style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px;
  }
  
  /* Cards del lado derecho (cliente, vendedor) apilados */
  .card:has(.cliente-info),
  .card:has(.vendedor-info) {
    order: -1; /* Mover arriba */
  }
  
  /* ─────────────────────────────────────────────────────────────
     FORMULARIOS
     ───────────────────────────────────────────────────────────── */
  
  .form-control,
  select,
  textarea,
  input {
    min-height: 44px;
    font-size: 15px;
    padding: 12px;
  }
  
  .form-grid {
    grid-template-columns: 1fr !important; /* 1 columna */
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  .form-label {
    font-size: 14px;
    margin-bottom: 6px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     MODALES
     ───────────────────────────────────────────────────────────── */
  
  .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 20px auto;
  }
  
  .modal-body {
    padding: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
  }
  
  /* ─────────────────────────────────────────────────────────────
     SIDEBAR - Desde la IZQUIERDA en móvil con cierre funcional
     ───────────────────────────────────────────────────────────── */
  
  .sidebar {
    position: fixed;
    left: -280px;  /* Oculto a la izquierda */
    right: auto;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.3);
  }
  
  .sidebar.open {
    left: 0;  /* Se desliza desde la izquierda */
    right: auto;
  }
  
  /* Overlay cuando sidebar abierto - CLICKEABLE PARA CERRAR */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9998;
    cursor: pointer;
  }
  
  body.sidebar-open .sidebar-overlay {
    display: block;
  }
  
  body.sidebar-open .sidebar {
    left: 0;
  }
  
  /* Botón X para cerrar dentro del sidebar */
  .sidebar-close {
    display: block !important;
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: #E0E0E0;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
  }
  
  .sidebar-close:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
  }
  
  /* Content ocupa todo el ancho */
  .content {
    margin-left: 0 !important;
    padding: 16px;
  }
  
  /* Botón hamburguesa visible a la izquierda */
  .menu-toggle {
    display: block !important;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 10000;
    background: var(--primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: #000;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
  }
  
  .menu-toggle:active {
    transform: scale(0.95);
  }
  
  /* Ocultar botón hamburguesa cuando sidebar está abierto */
  body.sidebar-open .menu-toggle {
    opacity: 0;
    pointer-events: none;
  }
  
  /* ─────────────────────────────────────────────────────────────
     TOPBAR
     ───────────────────────────────────────────────────────────── */
  
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  
  .topbar-logo {
    font-size: 18px;
  }
  
  .topbar-user {
    font-size: 13px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     BADGES Y ESTADOS
     ───────────────────────────────────────────────────────────── */
  
  .badge {
    font-size: 12px;
    padding: 4px 10px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     FILTROS Y BÚSQUEDA
     ───────────────────────────────────────────────────────────── */
  
  .filter-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch !important;
  }
  
  .search-box {
    width: 100% !important;
  }
  
  .search-box input {
    width: 100% !important;
  }
  
  /* ─────────────────────────────────────────────────────────────
     TEXTOS Y TIPOGRAFÍA
     ───────────────────────────────────────────────────────────── */
  
  .text-small {
    font-size: 13px;
  }
  
  .text-muted {
    font-size: 12px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     TOTALES Y PRECIOS (recuadro amarillo)
     ───────────────────────────────────────────────────────────── */
  
  .totales-wrap {
    padding: 16px;
  }
  
  .totales-box {
    padding: 16px;
  }
  
  .tot-row {
    font-size: 15px;
    margin-bottom: 10px;
  }
  
  .tot-final {
    font-size: 18px;
    padding-top: 12px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     ESPACIADO Y MÁRGENES
     ───────────────────────────────────────────────────────────── */
  
  .mb-1 { margin-bottom: 8px; }
  .mb-2 { margin-bottom: 12px; }
  .mb-3 { margin-bottom: 16px; }
  .mb-4 { margin-bottom: 24px; }
  
  .mt-1 { margin-top: 8px; }
  .mt-2 { margin-top: 12px; }
  .mt-3 { margin-top: 16px; }
  .mt-4 { margin-top: 24px; }
  
  /* ─────────────────────────────────────────────────────────────
     EMPTY STATES
     ───────────────────────────────────────────────────────────── */
  
  .empty-state {
    padding: 40px 20px;
  }
  
  .empty-state i {
    font-size: 48px;
  }
  
  .empty-state p {
    font-size: 15px;
  }
  
  /* ─────────────────────────────────────────────────────────────
     UTILIDADES
     ───────────────────────────────────────────────────────────── */
  
  .w-100 {
    width: 100% !important;
  }
  
  .d-none-mobile {
    display: none !important;
  }
  
  .d-block-mobile {
    display: block !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   📱 RESPONSIVE TABLET (768px - 1024px)
   ══════════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1024px) {
  
  .content {
    margin-left: 60px; /* Sidebar colapsado */
  }
  
  .sidebar {
    width: 60px;
  }
  
  .sidebar-item span {
    display: none; /* Solo iconos */
  }
  
  .form-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en tablet */
  }
}

/* ═══════════════════════════════════════════════════════════════
   🔔 PANEL DE NOTIFICACIONES - Responsive
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  /* Panel de notificaciones en móvil */
  .notif-panel,
  .notifications-dropdown,
  [class*="notif"],
  [class*="notification-panel"] {
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 0 !important;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
  }
  
  /* Botón de notificaciones */
  .topbar [onclick*="notif"],
  .topbar [data-toggle="notif"],
  .notif-btn,
  button[aria-label*="otificacion"] {
    position: relative;
  }
  
  /* Badge de contador de notificaciones */
  .notif-badge,
  .notification-badge,
  [class*="notif-count"] {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    padding: 2px 5px;
  }
  
  /* Items de notificación más grandes */
  .notif-item,
  .notification-item,
  [class*="notif-"][class*="item"] {
    padding: 16px !important;
    font-size: 14px !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  
  /* Título del panel */
  .notif-header,
  .notifications-header {
    padding: 16px !important;
    font-size: 16px !important;
    position: sticky;
    top: 0;
    background: #1C1C1C;
    z-index: 10;
  }
  
  /* Marcar todas como leídas */
  .notif-mark-all,
  [class*="mark-all"] {
    padding: 12px 16px !important;
    font-size: 14px !important;
  }
  
  /* Footer del panel */
  .notif-footer,
  .notifications-footer {
    padding: 12px 16px !important;
    position: sticky;
    bottom: 0;
    background: #1C1C1C;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  
  /* Texto de notificaciones */
  .notif-title {
    font-size: 14px !important;
    margin-bottom: 4px;
  }
  
  .notif-message,
  .notif-text {
    font-size: 13px !important;
    line-height: 1.4;
  }
  
  .notif-time,
  .notif-date {
    font-size: 11px !important;
    margin-top: 6px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   🔧 CORRECCIONES ADICIONALES MÓVIL
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  
  /* ─────────────────────────────────────────────────────────────
     TOPBAR - Más espacioso en móvil
     ───────────────────────────────────────────────────────────── */
  
  .topbar {
    padding: 14px 16px !important;
    min-height: 60px;
    gap: 12px;
    flex-wrap: nowrap !important;
  }
  
  .topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
  }
  
  .topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  /* Logo más pequeño pero legible */
  .topbar-left img {
    height: 36px !important;
    width: auto;
  }
  
  .topbar-left .brand span {
    font-size: 13px !important;
  }
  
  .topbar-left .brand span span:last-child {
    font-size: 8px !important;
  }
  
  /* Usuario - Solo icono en móvil */
  .topbar-user {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px !important;
  }
  
  /* Botón salir más pequeño */
  .topbar-right .btn-icon {
    width: 38px !important;
    height: 38px !important;
    padding: 8px !important;
  }
  
  /* ─────────────────────────────────────────────────────────────
     NOTIFICACIONES - Arreglar campana y panel
     ───────────────────────────────────────────────────────────── */
  
  /* Wrapper de notificaciones */
  .notif-wrapper {
    position: relative;
  }
  
  /* Botón de campana */
  .notif-btn,
  button[id*="notif"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 8px !important;
    background: none !important;
    border: none !important;
    cursor: pointer;
    position: relative;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Badge contador */
  .notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: #E53935;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 5px;
    z-index: 1;
  }
  
  /* Panel de notificaciones */
  .notif-panel {
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: calc(100vh - 60px) !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #1C1C1C !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    overflow-y: auto !important;
    z-index: 9997 !important;
    display: none;
  }
  
  /* Cuando está abierto */
  .notif-panel.active,
  .notif-panel.show,
  .notif-panel[style*="display: block"] {
    display: block !important;
  }
  
  /* Header del panel */
  .notif-header {
    position: sticky;
    top: 0;
    background: #1C1C1C;
    padding: 16px !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
  }
  
  .notif-header h3,
  .notif-header .notif-title {
    font-size: 16px !important;
    margin: 0;
    color: #E0E0E0;
  }
  
  /* Items de notificación */
  .notif-item {
    padding: 16px !important;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px !important;
  }
  
  .notif-item:last-child {
    border-bottom: none;
  }
  
  /* Footer del panel */
  .notif-footer {
    position: sticky;
    bottom: 0;
    background: #1C1C1C;
    padding: 12px 16px !important;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
    z-index: 10;
  }
  
  /* Overlay para cerrar notificaciones */
  .notif-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9996;
    display: none;
  }
  
  .notif-panel.active ~ .notif-overlay,
  .notif-panel.show ~ .notif-overlay {
    display: block;
  }
}

