/* ============================
   NINOBURG TIENDA - ESTILO MINIMALISTA MODERNO
   ============================ */

/* --- VARIABLES --- */
:root {
  --primary: #4e73df;
  --primary-dark: #3a5fc8;
  --success: #1cc88a;
  --success-dark: #17a673;
  --warning: #f6c23e;
  --danger: #e74a3b;
  --info: #36b9cc;
  --gray-100: #f8f9fc;
  --gray-200: #eaecf4;
  --gray-300: #dddfeb;
  --gray-400: #b7b9cc;
  --gray-600: #858796;
  --gray-800: #5a5c69;
  --gray-900: #3a3b45;
  --font: 'Segoe UI', 'Roboto', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
  --radius: 12px;
  --radius-sm: 8px;
}

/* --- GLOBAL --- */
* { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--gray-100) !important;
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); transition: color 0.2s; }
a:hover { color: var(--primary-dark); text-decoration: none; }

/* --- TIPOGRAFÍA --- */
h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--gray-900); }

/* --- PANELS (Bootstrap 3 → Cards modernos) --- */
.panel {
  border: none !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-md) !important;
  background: #fff !important;
  margin-bottom: 20px !important;
}

.panel-heading {
  background: #fff !important;
  border-bottom: 1px solid var(--gray-200) !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: 16px 20px !important;
  color: var(--gray-900) !important;
}

.panel-heading h4 { font-size: 15px; margin: 0; }

.panel-body { padding: 20px !important; }

.panel-info > .panel-heading {
  border-left: 4px solid var(--primary) !important;
}

.panel-footer {
  background: var(--gray-100) !important;
  border-top: 1px solid var(--gray-200) !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
}

/* --- FORMULARIOS --- */
.form-control {
  border-radius: var(--radius-sm) !important;
  border: 1.5px solid var(--gray-300) !important;
  padding: 10px 14px !important;
  height: auto !important;
  font-size: 14px;
  box-shadow: none !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.15) !important;
}

select.form-control { cursor: pointer; }

textarea.form-control { padding: 10px 14px !important; }

.input-group .form-control:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}

.input-group-btn:last-child > .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  height: 100%;
}

label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  margin-bottom: 4px;
}

/* --- BOTONES --- */
.btn {
  border-radius: var(--radius-sm) !important;
  padding: 8px 16px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border: none !important;
  transition: all 0.2s ease !important;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-lg {
  padding: 12px 24px !important;
  font-size: 15px !important;
  border-radius: var(--radius) !important;
}

.btn-sm {
  padding: 5px 10px !important;
  font-size: 12px !important;
}

.btn-xs {
  padding: 3px 8px !important;
  font-size: 11px !important;
}

.btn-primary { background: var(--primary) !important; }
.btn-primary:hover { background: var(--primary-dark) !important; }

.btn-success { background: var(--success) !important; }
.btn-success:hover { background: var(--success-dark) !important; }

.btn-info { background: var(--info) !important; }
.btn-warning { background: var(--warning) !important; color: #fff !important; }
.btn-danger { background: var(--danger) !important; }

.btn-default {
  background: #fff !important;
  border: 1.5px solid var(--gray-300) !important;
  color: var(--gray-800) !important;
}
.btn-default:hover {
  background: var(--gray-100) !important;
  border-color: var(--gray-400) !important;
}

.btn-block { width: 100%; }

/* --- TABLAS --- */
.table {
  margin-bottom: 0 !important;
  font-size: 13px;
}

.table > thead > tr > th {
  border-bottom: 2px solid var(--gray-200) !important;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  padding: 10px 8px !important;
}

.table > tbody > tr > td {
  padding: 10px 8px !important;
  vertical-align: middle !important;
  border-top: 1px solid var(--gray-200) !important;
}

.table > tbody > tr:hover { background: var(--gray-100); }

.table-responsive {
  border: none !important;
  margin-bottom: 0;
}

/* Tablas en móvil: cards en vez de filas */
@media (max-width: 767px) {
  .table-mobile-cards thead { display: none; }
  .table-mobile-cards tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
  }
  .table-mobile-cards tbody tr td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0 !important;
    border: none !important;
    font-size: 13px;
  }
  .table-mobile-cards tbody tr td:before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-600);
    letter-spacing: 0.3px;
  }
}

/* --- NAVBAR --- */
.navbar {
  border-radius: 0 !important;
  margin-bottom: 20px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.navbar .navbar-nav > li > a {
  padding: 12px 14px !important;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s;
}

.navbar .navbar-nav > li > a:hover {
  background: rgba(255,255,255,0.1) !important;
}

.navbar .dropdown-menu {
  border: none !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 6px 0 !important;
}

.navbar .dropdown-menu > li > a {
  padding: 8px 18px !important;
  font-size: 13px;
  color: var(--gray-800) !important;
}

.navbar .dropdown-menu > li > a:hover {
  background: var(--gray-100) !important;
  color: var(--primary) !important;
}

/* Mobile: menú más vertical y táctil */
@media (max-width: 767px) {
  .navbar .navbar-nav > li > a {
    padding: 14px 16px !important;
    font-size: 15px;
  }
  .navbar .navbar-collapse {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* --- MODALES --- */
.modal-content {
  border: none !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}

.modal-header {
  border-bottom: 1px solid var(--gray-200) !important;
  padding: 16px 20px !important;
}

.modal-header h4 { font-size: 16px; }

.modal-body { padding: 20px !important; }

.modal-footer {
  border-top: 1px solid var(--gray-200) !important;
  padding: 14px 20px !important;
}

/* --- ALERTAS --- */
.alert {
  border: none !important;
  border-radius: var(--radius-sm) !important;
  font-size: 13px;
  padding: 12px 16px !important;
}

.alert-success { background: #d4edda !important; color: #155724 !important; }
.alert-danger { background: #f8d7da !important; color: #721c24 !important; }
.alert-warning { background: #fff3cd !important; color: #856404 !important; }
.alert-info { background: #d1ecf1 !important; color: #0c5460 !important; }

/* --- LABELS / BADGES --- */
.label {
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 4px 8px !important;
  border-radius: 4px !important;
}

/* --- DROPDOWN --- */
.dropdown-menu { font-size: 13px; }

/* --- PAGINACIÓN --- */
.pagination > li > a,
.pagination > li > span {
  border: 1px solid var(--gray-200) !important;
  color: var(--gray-800) !important;
  padding: 6px 12px !important;
  font-size: 13px;
}

.pagination > li.active > a {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

/* --- CHECKBOX (crédito) --- */
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--success);
}

/* --- ESPACIADOS RESPONSIVE --- */
@media (max-width: 767px) {
  .panel-body { padding: 14px !important; }
  .container { padding-left: 10px; padding-right: 10px; }
  h4 { font-size: 15px; }
}

/* --- CARD-VENTA (nueva_factura.php) --- */
.card-venta {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.label-titulo {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-600);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.dato-valor {
  font-size: 14px;
  color: var(--gray-900);
  font-weight: 600;
}

.seccion-credito {
  background: #fff9e6;
  border: 2px dashed var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
}

/* --- BLOQUES DE FACTURACIÓN (60/40) --- */
.seccion-facturacion-total {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.bloque-vta {
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  float: left;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 992px) {
  .w-60 { width: 60% !important; }
  .w-40 { width: 40% !important; }
}

@media (max-width: 991px) {
  .w-60, .w-40 {
    width: 100% !important;
    float: none !important;
    display: block !important;
    margin-bottom: 14px;
  }
}

.clearfix-vta::after {
  content: "";
  clear: both;
  display: table;
}

/* --- PRODUCTOS EN TABLA (más táctil en móvil) --- */
@media (max-width: 767px) {
  #primero table tr td,
  #primero table tr th {
    padding: 8px 4px !important;
    font-size: 12px;
  }
  .input-tabla-ajustable {
    width: 44px !important;
    font-size: 14px !important;
    height: 32px !important;
  }
  .btn-tabla-ajustable {
    padding: 6px 12px !important;
    font-size: 14px !important;
  }
}

/* --- DETALLE FACTURA (segundo bloque) --- */
#segundo .table { font-size: 12px; }
#segundo .table td { padding: 8px 6px !important; }

/* --- RESPONSIVE UTILITY --- */
.hide-mobile { display: block; }
.show-mobile { display: none; }

@media (max-width: 767px) {
  .hide-mobile { display: none; }
  .show-mobile { display: block; }
}

/* --- BOTÓN FLOTANTE PARA MÓVIL (Nueva Venta) --- */
.btn-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50% !important;
  padding: 0 !important;
  font-size: 24px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 767px) {
  .btn-fab { width: 48px; height: 48px; font-size: 20px; bottom: 16px; right: 16px; }
}

/* --- ANIMACIONES SUAVES --- */
.fade-in { animation: fadeIn 0.3s ease; }

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

/* --- SCROLL PERSONALIZADO --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }

/* --- NAVBAR DEFAULT OVERRIDE (desde navbar.php inline) --- */
.navbar-default .navbar-nav > li > a {
  font-size: 13px;
  letter-spacing: 0.3px;
}

@media (max-width: 767px) {
  .navbar-default .navbar-nav > li > a {
    font-size: 14px;
    padding: 12px 16px !important;
  }
}

/* --- HEADER2 (login) --- */
header2 {
  display: block;
  background: url(../img/logotienda.jpeg) no-repeat center;
  width: 100%;
  height: 180px;
  background-size: 100% 100%;
}

@media (min-width: 1200px) {
  header2 { height: 220px; }
}

@media (max-width: 768px) {
  header2 { height: 120px; background-size: cover; }
}

/* --- PRIMERO/SEGUNDO (nueva_factura.php) --- */
#primero {
  width: 100%;
  height: auto;
  max-height: 700px;
  padding: 2px;
  font-size: 10px;
  border: none;
  overflow-y: auto;
}

#segundo {
  width: 100%;
  height: auto;
  max-height: 700px;
  padding: 2px;
  overflow-y: auto;
  border: none;
}

@media (min-width: 992px) {
  #primero, #segundo {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
  }
}

/* --- INPUT NUMBER sin flechas --- */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }
