/* ═══════════════════════════════════════════════════════════════════════════
   CASHGRAVITY GLOBAL · TEMAS DE TARJETAS SOBERANAS VIRTUALES Y FÍSICAS (SSOT)
   Fuente Única de Estilos para index.html, web_pos.html y pay_merchant.html
   ═══════════════════════════════════════════════════════════════════════════ */

.card-perspective {
  perspective: 1000px;
}

.card-inner {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card-flipped {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-back {
  transform: rotateY(180deg);
}

/* TEXTURAS METÁLICAS CEPILLADAS (BRUSHED METAL TEXTURE V2) */
.platinum-brushed-card {
  background: 
    repeating-linear-gradient(0deg, rgba(255,255,255,0.12) 0px, rgba(0,0,0,0.04) 1px, rgba(255,255,255,0.12) 2px),
    linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 50%, #94a3b8 100%);
  box-shadow: 0 0 30px rgba(163, 230, 53, 0.45), 0 0 0 2px #a3e635;
  border: 2px solid #a3e635;
}

.neon-obsidian-card {
  background: 
    repeating-linear-gradient(0deg, rgba(255,255,255,0.03) 0px, rgba(0,0,0,0.4) 1px, rgba(255,255,255,0.03) 2px),
    linear-gradient(135deg, #111827 0%, #030712 100%);
  box-shadow: 0 0 30px rgba(163, 230, 53, 0.35), 0 0 0 2px #a3e635;
  border: 2px solid #a3e635;
}

.royal-cobalt-card {
  background: 
    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0px, rgba(0,0,0,0.2) 1px, rgba(255,255,255,0.04) 2px),
    linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.4), 0 0 0 2px #38bdf8;
  border: 2px solid #38bdf8;
}

.titanium-black-card {
  background: 
    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0px, rgba(0,0,0,0.3) 1px, rgba(255,255,255,0.04) 2px),
    linear-gradient(135deg, #27272a 0%, #09090b 100%);
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.35), 0 0 0 2px #eab308;
  border: 2px solid #eab308;
}

.gold-emboss {
  background: linear-gradient(135deg, #FFF7D6 0%, #D4AF37 50%, #AA771C 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  letter-spacing: 0.04em;
}

.frozen-overlay {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


/* ═══════════════════════════════════════════════════════════════════════════
   CONTRATO DE ADAPTABILIDAD RESPONSIVE MÓVIL & CHASIS DESKTOP COMPACTO (SSOT)
   Leyes: #80 (SSOT), #132 (Mínimos Pasos), #246 (Modales), #255 (Viewport)
   ═══════════════════════════════════════════════════════════════════════════ */

/* REGLAS MAESTRAS DE PROPORCIÓN ID-1 PARA TARJETAS BANCARIAS SOBERANAS */
#card-flipper-container {
  width: 100%;
  aspect-ratio: 1.586;
  min-height: 185px;
  max-height: 235px;
}

@media (max-width: 390px) {
  #card-front-face, .card-back {
    padding: 12px 14px !important;
  }
  #card-brand-title {
    font-size: 11px !important;
  }
  #card-brand-slogan {
    font-size: 8px !important;
  }
  #card-type-label {
    padding: 2px 6px !important;
    font-size: 8.5px !important;
    max-width: calc(100% - 75px) !important;
  }
  #card-type-label span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #card-number-text {
    font-size: 11px !important;
    letter-spacing: 0.1em !important;
  }
  #card-holder-text {
    font-size: 9.5px !important;
  }
}

/* NORMALIZACIÓN SOBERANA DEL ELEMENTO RAÍZ (ROOT ELEMENT NORMALIZATION) */
html {
  width: 100% !important;
  height: 100% !important;
  overflow-x: hidden !important;
  display: block !important;
  box-sizing: border-box !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  background-color: #030712 !important;
}

*, *::before, *::after {
  box-sizing: inherit !important;
}

/* EN SMARTPHONES (< 640px): 100% FLUIDO Y SIN DESBORDAMIENTOS */
@media (max-width: 640px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  body {
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  main, .cg-main-container, [role="main"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .fixed.inset-0:not(.hidden) > .glass-card,
  .fixed.inset-0:not(.hidden) > .glass-panel,
  .fixed.inset-0:not(.hidden) > [class*="max-w-"],
  .fixed.inset-0:not(.hidden) > div[class*="rounded"] {
    max-width: calc(100vw - 20px) !important;
    width: 100% !important;
    margin: auto !important;
    max-height: 94dvh !important;
  }
}

/* EN DESKTOP (>= 641px): CHASIS MÓVIL COMPACTO CENTRADO (METÁFORA CELULAR PREMIUM) */
@media (min-width: 641px) {
  html:not(.cg-wide-layout) {
    background-color: #030712 !important;
  }
  body:not(.cg-wide-layout):not([data-cg-layout="wide"]) {
    max-width: 450px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    min-height: 100vh !important;
    position: relative !important;
    background-color: #07090e !important;
    box-shadow: 
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 25px 60px -15px rgba(0, 0, 0, 0.95),
      0 0 50px -10px rgba(163, 230, 53, 0.06) !important;
    overflow-x: hidden !important;
  }
  body.cg-wide-layout, body[data-cg-layout="wide"] {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  #cg-sovereign-navbar {
    max-width: 450px !important;
    width: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    border-left: 1px solid rgba(148, 163, 184, 0.25) !important;
    border-right: 1px solid rgba(148, 163, 184, 0.25) !important;
  }
  body.cg-wide-layout #cg-sovereign-navbar {
    max-width: 100% !important;
    border: none !important;
  }
  header.sticky, .sovereign-header, body > header {
    max-width: 450px !important;
    width: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    border-left: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
  }
  #cg-quick-actions-hud {
    max-width: 430px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  .fixed.inset-0:not(.hidden) > .glass-card,
  .fixed.inset-0:not(.hidden) > .glass-panel,
  .fixed.inset-0:not(.hidden) > [class*="max-w-"],
  .fixed.inset-0:not(.hidden) > div[class*="rounded"] {
    max-width: 430px !important;
    width: 100% !important;
    margin: auto !important;
    max-height: 90vh !important;
    border-radius: 28px !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.95), 0 0 30px rgba(163, 230, 53, 0.12) !important;
  }
  .cg-panel-fullscreen {
    max-width: 450px !important;
    width: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    height: 94vh !important;
    top: 3vh !important;
    bottom: 3vh !important;
    border-radius: 28px !important;
    border: 1px solid rgba(163, 230, 53, 0.35) !important;
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.98), 0 0 40px rgba(163, 230, 53, 0.2) !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   CENTRO SOBERANO NOTIFICATION DRAWER (Leyes #134, #246, #255 - Cero Scroll de Ventana)
   ═══════════════════════════════════════════════════════════════════════════ */
#cg-notification-center-drawer {
  position: fixed !important;
  inset: auto 0 0 0 !important;
  top: auto !important;
  bottom: 0 !important;
  width: 100% !important;
  max-height: calc(100dvh - 80px) !important;
  max-height: calc(100vh - 80px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  background-color: #09090b !important;
  border-top-left-radius: 24px !important;
  border-top-right-radius: 24px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8) !important;
  z-index: 99999 !important;
}

#cg-notification-center-drawer > * {
  max-width: 100% !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

#cg-notification-center-drawer > .flex.items-center.justify-between.border-b,
#cg-notification-center-drawer > .p-2\.5.rounded-2xl,
#cg-notification-center-drawer > .p-3.rounded-2xl,
#cg-notification-center-drawer > .flex.items-center.gap-1.p-1,
#cg-notification-center-drawer > .mt-3.pt-2\.5.border-t,
#cg-notification-center-drawer > footer,
#cg-notification-center-drawer > header {
  flex-shrink: 0 !important;
}

#cg-notification-center-drawer .space-y-2\.5,
#cg-notification-center-drawer [class*="space-y"] {
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}

@media (min-width: 641px) {
  #cg-notification-center-drawer {
    left: 50% !important;
    transform: translateX(-50%) !important;
    right: auto !important;
    max-width: 450px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9) !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   AUTO-AJUSTE Y SCROLL-SNAP AL TOPE DEL VISOR (PRIMER DIBUJO) EN WEB POS (Ley #134 & Directiva Viper)
   ═══════════════════════════════════════════════════════════════════════════ */
html:has(#view-pos),
body:has(#view-pos) {
  scroll-snap-type: y proximity;
  scroll-padding-top: 8px;
}

#pos-amount-screen,
#pos-numpad-container > .glass-panel,
.glass-panel[data-cg-fs-bound="1"] {
  scroll-snap-align: start;
  scroll-margin-top: 8px;
}

html.cg-has-sov-nav:has(#cg-sovereign-navbar.cg-nav-hidden) {
  padding-top: 0px !important;
}
html.cg-has-sov-nav {
  transition: padding-top 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

body:has(#view-pos) {
  transition: padding-top 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
body:has(#view-pos):has(header.cg-nav-hidden) {
  padding-top: 8px !important;
}
body:has(#view-pos) #view-pos {
  transition: padding-top 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
body:has(#view-pos):has(header.cg-nav-hidden) #view-pos {
  padding-top: 0px !important;
}

body:has(#view-pos) > header {
  transition: max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease,
              padding 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              margin 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  max-height: 220px;
}

body:has(#view-pos) > header.cg-nav-hidden,
header.cg-nav-hidden,
body > header.cg-nav-hidden {
  opacity: 0 !important;
  max-height: 0px !important;
  height: 0px !important;
  min-height: 0px !important;
  margin: 0px !important;
  padding-top: 0px !important;
  padding-bottom: 0px !important;
  overflow: hidden !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

header,
body > header {
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
