/* =========================================
   VCARD - Empresa JAB
   Responsive + Flip (sin dark mode)
   Incluye botón QR con ícono (mask) en currentColor
   Reglas especiales solicitadas:
   - .flip-icon 26x26
   - .details-list padding: 0
   ========================================= */

/* ---------- Variables ---------- */
:root{
  --card-max: 400px;

  /* Paleta JAB (basada en tu CSS anterior) */
  --page-bg: #ffffff;
  --header-bg: #ffffff;
  --brand: #1a3f7a;        /* azul principal */
  --brand-hover: #6298d2;  /* hover botones */
  --card-bg: #f2f2f2;

  --text: var(--brand);
  --text-on-brand: #ffffff;

  --radius: 10px;

  --shadow-header: 5px 0px 5px rgba(0, 0, 0, 0.2),
                   -5px 0px 5px rgba(0, 0, 0, 0.2),
                   0px -5px 5px rgba(0, 0, 0, 0.2);

  --shadow-name: 5px 0px 7px rgba(0, 0, 0, 0.2),
                 -5px 0px 7px rgba(0, 0, 0, 0.2);

  --shadow-body: 5px 0px 7px rgba(0, 0, 0, 0.2),
                 -5px 0px 7px rgba(0, 0, 0, 0.2),
                 0px 5px 7px rgba(0, 0, 0, 0.2);

  --page-pad: 12px;
  --inset: 18px;
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after{
  box-sizing: border-box;
}

html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body{
  margin: 0;
  padding: 0;
  background-color: var(--page-bg);
  color: var(--text);
  font-family: "DM Sans", "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

body{
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--page-pad) 16px;
  filter: none;
}

img{
  max-width: 100%;
  height: auto;
  display: block;
}

a{
  -webkit-tap-highlight-color: transparent;
}

:focus-visible{
  outline: 3px solid rgba(98, 152, 210, 0.65);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Respeta reducción de movimiento */
@media (prefers-reduced-motion: reduce){
  *{
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================
   FLIP
   ========================================= */

/* Wrapper del flip (limita el ancho) */
.flip-card{
  width: min(var(--card-max), 100%);
  margin: 0 auto;
  position: relative;
  perspective: 1200px;
}

/* Botón QR */
.flip-trigger{
  position: absolute;
  top: 14px;
  right: 10px;
  z-index: 20;

  width: 44px;
  height: 44px;
  border-radius: 999px;

  border: 2px solid var(--brand);
  background: var(--header-bg);

  /* El ícono toma este color (texto) */
  color: var(--text);

  cursor: pointer;
  display: grid;
  place-items: center;
}

/* Ícono QR: mask + currentColor (mismo color del texto)
   (ajuste solicitado: 26x26) */
.flip-icon{
  width: 26px;
  height: 26px;
  display: block;

  background-color: currentColor;

  /* style.css está en /src, así que el SVG también */
  -webkit-mask: url("qr-icon.svg") no-repeat center / contain;
  mask: url("qr-icon.svg") no-repeat center / contain;
}

/* Contenedor 3D */
.flip-inner{
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 600ms ease;
  display: grid; /* overlay de caras sin altura fija */
  will-change: transform;
}

/* Estado girado */
.flip-card.is-flipped .flip-inner{
  transform: rotateY(180deg);
}

/* Caras */
.flip-face{
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  /* Para poder igualar altura del dorso al frente */
  height: 100%;
  align-self: stretch;
}

.flip-front{
  transform: rotateY(0deg);
}

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

/* Evita interacción con la cara "oculta" */
.flip-card.is-flipped .flip-front{ pointer-events: none; }
.flip-card:not(.is-flipped) .flip-back{ pointer-events: none; }

/* Estirar el body del dorso hasta la altura del frente */
.flip-back .vcard-container{
  height: 100%;
  display: flex;
  flex-direction: column;
}

.flip-back .vcard-body{
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flip-back .qr-panel{
  flex: 1;
}

@media (prefers-reduced-motion: reduce){
  .flip-inner{ transition: none; }
}

/* =========================================
   ESTRUCTURA VCARD
   ========================================= */

/* Si NO hay flip-card, el contenedor limita el ancho */
.vcard-container{
  width: min(var(--card-max), 100%);
  margin: 0 auto;
}

/* Si hay flip-card, el wrapper ya limita, así que el contenedor usa 100% */
.flip-card .vcard-container{
  width: 100%;
  margin: 0;
}

.vcard-header{
  padding-top: 20px;
  width: 100%;
  background-color: var(--header-bg);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* Logo en panel blanco con sombra (como tu CSS original) */
.logo-container{
  width: 100%;
  background-color: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  display: grid;
  box-shadow: var(--shadow-header);
}

/* Mantiene la idea de logo grande, pero responsive */
.logo-container img{
  height: clamp(84px, 20vw, 120px);
  width: auto;
  justify-self: center;
  padding: 5px 0;
}

/* Banda azul con nombre */
.employee-info{
  width: 100%;
  background-color: var(--brand);
  display: flex;
  justify-content: center;
}

.employee-name{
  width: 100%;
  background-color: var(--brand);
  color: var(--text-on-brand);
  padding: 10px 16px;
  display: grid;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-name);
  z-index: 1;
}

.employee-name span{
  font-weight: 800;
  font-size: clamp(18px, 3.8vw, 20px);
  line-height: 1.15;
}

.employee-name p{
  margin: 4px 0 0 0;
  font-size: clamp(13px, 3.2vw, 14px);
  line-height: 1.2;
}

.vcard-body{
  width: 100%;
  background-color: var(--page-bg);
  display: flex;
  justify-content: center;
  padding-bottom: 10px;
}

/* Superficie de tarjeta */
.contact-info,
.qr-panel{
  width: 100%;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-body);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

/* =========================================
   BOTONERA SUPERIOR
   ========================================= */
.buttons{
  display: flex;
}

.buttons a{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;

  text-decoration: none;
  color: var(--brand);

  padding: 10px 0;
  min-height: 64px;

  border-bottom: 2px solid var(--brand);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.message-button{
  border-left: 2px solid var(--brand);
  border-right: 2px solid var(--brand);
}

/* Hover solo en dispositivos con mouse */
@media (hover: hover) and (pointer: fine){
  .buttons a:hover{
    background-color: var(--brand-hover);
    color: var(--text-on-brand);
  }
}

/* Feedback touch */
.buttons a:active{
  background-color: var(--brand-hover);
  color: var(--text-on-brand);
}

.button-icon{
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}

.button-icon img{
  width: 26px;
  height: 26px;
}

.button-label{
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}

/* =========================================
   LISTA DE DATOS
   ========================================= */

/* Ajuste solicitado: padding 0 */
.details-list{
  padding: 0px 0;
}

.contact-item a{
  display: block;
  text-decoration: none;
  color: var(--brand);
}

.item-content{
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px var(--inset);
  min-height: 56px;

  transition: background-color 0.2s ease, color 0.2s ease;
}

.item-content img,
.list-icon{
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
}

.item-content span{
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.contact-item hr{
  margin: 0 var(--inset);
  border: 0;
  border-top: 1px solid var(--brand);
}

/* Hover correcto */
@media (hover: hover) and (pointer: fine){
  .contact-item a:hover .item-content{
    background-color: var(--brand-hover);
    color: var(--text-on-brand);
    border-radius: 50px;
  }
}

/* Touch feedback */
.contact-item a:active .item-content{
  background-color: var(--brand-hover);
  color: var(--text-on-brand);
  border-radius: 50px;
}

/* =========================================
   DORSO - QR
   ========================================= */
.qr-panel{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px var(--inset);
}

.qr-image{
  width: min(240px, 75%);
  aspect-ratio: 1 / 1;
  object-fit: contain;

  background: #ffffff;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(26, 77, 156, 0.25);
}

/* =========================================
   FOOTER
   ========================================= */
.footer{
  margin-top: 20px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.footer-logo{
  width: 130px;
  padding-top: 15px;
}

/* =========================================
   AJUSTES RESPONSIVE
   ========================================= */
@media (max-width: 360px){
  :root{
    --page-pad: 10px;
    --inset: 16px;
  }

  .button-label{
    font-size: 13px;
  }
}

@media (min-width: 768px){
  :root{
    --page-pad: 16px;
  }
}
