/* Ajuste video QR para Html5Qrcode */
#qr_reader_earn video, #qr_reader_redeem video, #qr_reader_debt video, [id^="qr_reader_inner_"] video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  background: #222 !important;
  display: block !important;
}
[id^="qr_reader_inner_"] {
  background: #222 !important;
  min-height: 300px;
  position: relative;
}
.input-group {
  gap: 8px;
}
.input-group .select-auto {
  width: auto !important;
  min-width: max-content !important;
  max-width: none !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
}
/* Selector compacto para scan QR/BARRAS */
.select-auto {
  width: auto !important;
  min-width: unset !important;
  max-width: unset !important;
  display: inline-block !important;
  vertical-align: middle;
  padding-right: 0.2em;
}
/* Decero Rewards - Tema Light con Bootstrap 5 */
:root{
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a202c;
  --muted: #64748b;
  --primary: #0ea5e9;
  --primary-2: #0284c7;
  --danger: #ef4444;
  --success: #10b981;
  /* Degradados configurables */
  --accent-start: #0ea5e9;
  --accent-end: #8b5cf6;
  --success-start: #10b981;
  --success-end: #14b8a6;
  --danger-start: #ef4444;
  --danger-end: #f97316;
}

/* Tema light base */
html,body{
  margin:0;
  padding:0;
  font-family:'Inter',system-ui,Segoe UI,Arial;
  /* Fondo aplicado dinámicamente desde header.php */
  color:var(--text);
  font-size:13px;
  min-height:100vh;
}

body{
  display:flex;
  flex-direction:column;
}

main{
  flex:1;
}

/* Bootstrap overrides para tema light */
.card{
  background:var(--card) !important;
  border:1px solid #e2e8f0 !important;
  box-shadow:0 4px 12px rgba(0,0,0,.08) !important;
  padding:10px !important;
  border-radius:10px !important;
}

.card-body{
  padding:10px !important;
}

.form-control, .form-select{
  background:#ffffff !important;
  border:1px solid #cbd5e1 !important;
  color:var(--text) !important;
  border-radius:5px !important;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select{
  border-radius:5px !important;
}

.form-control:focus, .form-select:focus{
  background:#ffffff !important;
  border-color:var(--primary-2) !important;
  box-shadow:0 0 0 3px rgba(14,165,233,.15) !important;
  color:var(--text) !important;
}

.form-control::placeholder{
  color:var(--muted) !important;
  opacity:0.6;
}

.btn-primary{
  background:linear-gradient(135deg, var(--accent-start), var(--accent-end)) !important;
  border:none !important;
  color:#ffffff !important;
  font-weight:700;
}

.btn-primary:hover, .btn-primary:active, .btn-primary:focus{
  filter:brightness(1.08);
  color:#ffffff !important;
}

.btn-danger{
  background:linear-gradient(135deg, var(--danger-start), var(--danger-end)) !important;
  border:none !important;
  color:#fff !important;
  font-weight:700;
}

.btn-danger:hover, .btn-danger:active, .btn-danger:focus{
  filter:brightness(1.08);
  color:#fff !important;
}

.btn-success{
  background:linear-gradient(135deg, var(--success-start), var(--success-end)) !important;
  border:none !important;
  color:#ffffff !important;
  font-weight:700;
}

.btn-success:hover, .btn-success:active, .btn-success:focus{
  filter:brightness(1.08);
  color:#ffffff !important;
}

.btn-outline-primary{
  border-color:var(--primary) !important;
  color:var(--primary) !important;
}

.btn-outline-primary:hover, .btn-outline-primary:active{
  background:var(--primary) !important;
  color:#ffffff !important;
}

.btn-outline-secondary{
  border-color:var(--muted) !important;
  color:var(--muted) !important;
}

.btn-outline-secondary:hover, .btn-outline-secondary:active{
  background:var(--muted) !important;
  color:#ffffff !important;
}

.table{
  color:var(--text) !important;
  border-color:#e2e8f0 !important;
}

.table-dark{
  background:#f1f5f9 !important;
  color:var(--text) !important;
  border-color:#cbd5e1 !important;
}

.table-striped tbody tr:nth-of-type(odd){
  background:#f8fafc !important;
}

.table-hover tbody tr:hover{
  background:#e0f2fe !important;
}

.table-light{
  background:#f8fafc !important;
  color:var(--text) !important;
}

.alert-success{
  background:#d1fae5 !important;
  color:#065f46 !important;
  border:1px solid #34d399 !important;
}

.alert-danger{
  background:#fee2e2 !important;
  color:#991b1b !important;
  border:1px solid #f87171 !important;
}

.text-muted{
  color:var(--muted) !important;
}

.badge.bg-secondary{
  background:#e2e8f0 !important;
  color:var(--text) !important;
}

.accordion-button{
  background:var(--card) !important;
  color:var(--text) !important;
  border:1px solid #e2e8f0 !important;
}

.accordion-button:not(.collapsed){
  background:#e0f2fe !important;
  color:var(--primary) !important;
}

.accordion-button:focus{
  box-shadow:0 0 0 3px rgba(14,165,233,.15) !important;
}

.accordion-item{
  background:var(--card) !important;
  border:1px solid #e2e8f0 !important;
}

.accordion-body{
  background:var(--card) !important;
}

/* Header personalizado */
.site-header{
  position:sticky;
  top:0;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(8px);
  border-bottom:1px solid #e2e8f0;
  box-shadow:0 4px 20px rgba(0,0,0,.25);
  z-index:999;
}

.site-header .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  padding:10px 18px;
}

.site-header .brand{
  font-weight:700;
  color:var(--text);
  text-decoration:none;
}

.nav{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.nav a{
  color:var(--muted);
  text-decoration:none;
  padding:8px 10px;
  border-radius:8px;
  white-space:nowrap;
}

.nav a:hover{
  color:var(--text);
  background:#f1f5f9;
}

/* Footer */
.site-footer{
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(8px);
  border-top:1px solid #e2e8f0;
  margin-top:auto;
  padding:20px 0;
  color:var(--muted);
  text-align:center;
  box-shadow:0 -4px 20px rgba(0,0,0,.15);
}

/* Tarjeta estilo crédito personalizada */
.credit-card{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  background:linear-gradient(135deg, #1e40af 0%, #4f46e5 60%, #7c3aed 100%);
  background-size:cover;
  background-position:center;
  border:1px solid rgba(0,0,0,.08);
  padding:10px; /* Ajuste solicitado: padding interno fijo de 10px */
  color:#ffffff;
  box-shadow:0 12px 30px rgba(0,0,0,.15);
  aspect-ratio: 17 / 11;
  width: 100%;
}

.credit-card .row{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.credit-card .brand{
  font-weight:700;
  letter-spacing:.4px;
}
.brand-logo{
  display:block;
  height:clamp(32px, 4vw, 48px);
  width:auto;
}

.credit-card .brand .brand-logo{
  height:clamp(48px, 8vw, 84px);
  margin:10px; /* Espaciado solicitado alrededor del logo */
}

.credit-card .chip{
  width:clamp(36px, 4vw, 46px);
  height:clamp(26px, 3vw, 34px);
  border-radius:6px;
  background:linear-gradient(135deg,#c8c8c8,#f1f1f1);
  border:1px solid rgba(0,0,0,.15);
  padding-left:10px; /* Espacio interno a la izquierda */
  position:relative; /* Permite desplazar sin afectar layout flex */
  left:10px; /* Desplaza el chip 10px más a la derecha visualmente */
}

.credit-card .number{
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size:clamp(16px, 2.2vw, 20px);
  letter-spacing:2px;
  margin:14px 0;
}

.credit-card .meta{
  display:flex;
  gap:18px;
}

.credit-card .label{
  color:#ffffff;
  font-size:12px;
}

.credit-card .value{
  font-weight:600;
}

.credit-card .tier{
  position:absolute;
  right:10px;
  top:10px;
  background:rgba(255,255,255,.2);
  backdrop-filter:blur(4px);
  padding:6px 10px;
  border-radius:10px;
  font-size:11px;
  font-weight:600;
}

.credit-card .tier i{
  font-size:14px;
  margin-right:6px;
  vertical-align:middle;
}

/* QR Code */
.qr{
  background:#fff;
  border-radius:12px;
  padding:12px;
  display:inline-block;
  border:1px solid rgba(0,0,0,.1);
  max-width:100%;
}

.qr canvas, .qr img{
  max-width:100%;
  height:auto;
}

/* Estados para canjear.php - toggle entre modo puntos/recompensa */
.redeem-reward{
  display:none;
}

/* Admin: Menú modal */
.btn-admin-menu{
  background:var(--accent);
  color:#0b0e13;
  padding:10px 18px;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
  border:0;
  margin-left:8px;
}

.btn-admin-menu:hover{
  filter:brightness(1.08);
}

.admin-menu-card{
  width:min(92vw, 340px);
  padding:0 0 16px 0;
}

.admin-menu-card .modal-header{
  border-bottom:1px solid #e2e8f0;
  margin-bottom:0;
  padding:16px 16px 8px 16px;
}

.admin-menu-card .modal-body{
  padding:16px;
}

.admin-nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.admin-nav a{
  color:var(--primary);
  font-weight:600;
  text-decoration:none;
  padding:8px 10px;
  border-radius:6px;
}

.admin-nav a:hover{
  background:#e0f2fe;
  color:var(--primary-2);
}

/* Modal básico custom (para header admin si no usa Bootstrap modal) */
.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
  min-height:100vh;
}

.modal.show{
  display:flex !important;
}

.modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.6);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  cursor:pointer;
}

.modal-card{
  position:relative;
  z-index:10000;
  background:var(--card);
  border:1px solid #cbd5e1;
  border-radius:14px;
  padding:24px;
  width:min(92vw, 500px);
  max-height:85vh;
  overflow-y:auto;
  box-shadow:0 25px 50px rgba(0,0,0,.25);
}

.modal.show .modal-card{
  margin:auto;
  animation:modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn{
  from{
    opacity:0;
    transform:translateY(-20px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:16px;
  padding-bottom:12px;
  border-bottom:1px solid #e2e8f0;
}

.modal-header h3{
  margin:0;
  font-size:18px;
  font-weight:700;
}

.modal-body{
  display:block;
}

.tiers-list{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:8px;
}

.tiers-list .btn{
  flex:1 1 calc(50% - 5px);
  min-width:140px;
  text-align:center;
}

/* Bot\u00f3n peque\u00f1o */
.btn.small{
  padding:8px 16px;
  font-size:13px;
  font-weight:600;
  background:var(--muted);
  color:#ffffff;
  border-radius:8px;
  border:none;
  cursor:pointer;
}

.btn.small:hover{
  filter:brightness(1.1);
}

/* Estilos para lector QR */
#qr_reader_earn,
#qr_reader_redeem{
  margin-top:12px;
  border:2px solid var(--primary);
  border-radius:10px;
  overflow:hidden;
}

#qr_reader_earn video,
#qr_reader_redeem video{
  width:100%;
  height:auto;
  display:block;
}

/* Responsive */
@media (max-width:768px){
  html,body{
    font-size:12px;
  }
  
  .credit-card .number{
    font-size:18px;
  }
}
