/* ================================
   Variables de BK - Whopper Dog
   ================================ */
:root {
    --bk-red: #d72300;
    --bk-red-dark: #b51e00;
    --bk-cream: #F5F0E1;
    --bk-white: #FFFFFF;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    height: -webkit-fill-available;
    width: 100%;
    overflow: hidden;
}

body {
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    width: 100%;
    width: 100vw;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bk-red);
    color: var(--bk-cream);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* ================================
   Imágenes - Reglas globales
   ================================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ================================
   Loader Inicial
   ================================ */
.initial-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bk-red);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.initial-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(245, 240, 225, 0.3);
    border-top-color: var(--bk-cream);
    border-radius: 50%;
    animation: loaderSpin 0.8s linear infinite;
}

@keyframes loaderSpin {
    to { transform: rotate(360deg); }
}

/* ================================
   Ocultar ambas vistas por defecto
   ================================ */
.portrait-view,
.landscape-view {
    display: none;
    width: 100%;
    width: 100vw;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

/* ================================
   Modo Desktop: Ocultar vistas móviles
   ================================ */
body.is-desktop-mode .portrait-view,
body.is-desktop-mode .landscape-view {
    display: none !important;
}

body.is-desktop-mode .desktop-view {
    display: flex !important;
}

/* ================================
   Media Query: Portrait (Vertical)
   ================================ */
@media (orientation: portrait) {
    body:not(.is-desktop-mode) .portrait-view {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: var(--bk-red);
    }
    
    body:not(.is-desktop-mode) .landscape-view {
        display: none !important;
    }
    
    body:not(.is-desktop-mode) {
        background: var(--bk-red);
    }
}

/* ================================
   Media Query: Landscape (Horizontal)
   ================================ */
@media (orientation: landscape) {
    body:not(.is-desktop-mode) .landscape-view {
        display: flex !important;
        justify-content: center;
        align-items: center;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: var(--bk-red);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }
    
    body:not(.is-desktop-mode) .portrait-view {
        display: none !important;
    }
    
    body:not(.is-desktop-mode) {
        background: var(--bk-red);
    }
}

/* ================================
   Vista Portrait - Fondo y contenido
   ================================ */
.portrait-view {
    position: relative;
}

.portrait-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.portrait-background .background-pattern {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
}

.portrait-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding: 3vw;
    padding-top: 3vh;
    padding-bottom: 10vh; /* Espacio para el patron cuadriculado */
}

/* Hamburguesa Portrait - rotada 90 grados, grande y centrada arriba */
.portrait-burger {
    width: clamp(200px, 65vw, 400px);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 55vh;
}

.portrait-burger .burger-image {
    width: 100%;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
    transform: rotate(90deg);
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    animation: burgerFloat 3s ease-in-out infinite;
}

@keyframes burgerFloat {
    0%, 100% {
        transform: rotate(90deg) translateX(0);
    }
    50% {
        transform: rotate(90deg) translateX(-10px);
    }
}

/* Texto Portrait - debajo de la hamburguesa, con más espacio */
.portrait-content .text-container {
    width: 100%;
    max-width: 90vw;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    margin-top: 8vh;
    padding-bottom: 2vh;
}

.portrait-content .text-image {
    width: clamp(240px, 85vw, 420px);
    max-height: 16vh;
    height: auto;
    object-fit: contain;
}

/* ================================
   Vista Landscape - Fondo y contenido
   ================================ */
.landscape-view {
    position: relative;
}

.landscape-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: var(--bk-red);
    overflow: hidden;
}

/* Patrón cuadriculado a la izquierda en landscape */
.checker-pattern {
    position: absolute;
    left: 0;
    top: 0;
    width: clamp(40px, 10vw, 80px);
    height: 100%;
    background-color: var(--bk-cream);
    background-image: 
        linear-gradient(45deg, var(--bk-red) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bk-red) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bk-red) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bk-red) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

/* Contenido Landscape */
.landscape-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding: 3vh 3vw;
    padding-left: clamp(60px, 14vw, 120px);
    gap: clamp(15px, 4vw, 40px);
}

/* Lado izquierdo - Texto (rotado para leerse en landscape) */
.landscape-left {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: auto;
    height: 100%;
}

.landscape-text-image {
    height: clamp(100px, 28vw, 280px);
    width: auto;
    max-width: 90vh;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
    transform: rotate(90deg);
}

.landscape-text-image:active {
    transform: rotate(90deg) scale(0.98);
}

/* Lado derecho - Hamburguesa */
.landscape-right {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0; /* Permite que flexbox reduzca */
}

/* Hamburguesa Landscape - más grande como referencia */
.landscape-burger {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.landscape-burger .burger-image {
    width: clamp(220px, 55vw, 550px);
    height: auto;
    max-height: 90vh;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    animation: burgerPulse 3s ease-in-out infinite;
}

@keyframes burgerPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}


/* ================================
   Overlay de Transicion
   ================================ */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(228, 0, 43, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.transition-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.transition-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--bk-cream);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================
   Clase utility para ocultar elementos
   ================================ */
.hidden {
    display: none !important;
}

/* ================================
   Vista Desktop/Tablet - Como Portrait + QR
   ================================ */
.desktop-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bk-red);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

/* Franja de checker pequeña en la parte inferior del desktop */
.desktop-background {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 0;
    background-color: var(--bk-cream);
    background-image: 
        linear-gradient(45deg, var(--bk-red) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bk-red) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bk-red) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bk-red) 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.desktop-background .background-pattern {
    display: none; /* No usar la imagen en desktop */
}

.desktop-view .desktop-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: 60px; /* Espacio para el cuadriculado inferior */
    max-width: 550px;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    animation: fadeInUp 0.5s ease-out;
    position: relative;
    z-index: 1;
    gap: 70px; /* Más espacio entre elementos */
}

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

/* Hamburguesa Desktop - rotada como en portrait */
.desktop-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 0 0 auto;
}

.desktop-burger-image {
    width: 250px;
    height: auto;
    max-height: 26vh;
    object-fit: contain;
    transform: rotate(90deg);
    filter: drop-shadow(0 8px 25px rgba(0, 0, 0, 0.3));
    animation: desktopBurgerFloat 3s ease-in-out infinite;
}

@keyframes desktopBurgerFloat {
    0%, 100% {
        transform: rotate(90deg) translateX(0);
    }
    50% {
        transform: rotate(90deg) translateX(-8px);
    }
}

/* Texto Desktop - como en portrait */
.desktop-text {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.desktop-text-image {
    width: 100%;
    max-width: 420px;
    height: auto;
    max-height: 15vh;
    object-fit: contain;
}

/* Sección QR Desktop */
.desktop-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.desktop-scan-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bk-cream);
    margin-top: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* QR Code Desktop */
.desktop-view .qr-wrapper {
    margin: 0;
}

.desktop-view .qr-container {
    display: inline-block;
    padding: 12px;
    background: var(--bk-cream);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* Borde simple alrededor del QR */
.desktop-view .qr-container::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: var(--bk-red);
    border-radius: 14px;
    z-index: -1;
}

/* QRCode.js genera img Y canvas - ocultar el canvas, mostrar solo img */
.desktop-view .qr-container img {
    display: block !important;
    width: 120px !important;
    height: 120px !important;
}

.desktop-view .qr-container canvas {
    display: none !important;
}

/* ================================
   Responsive: Móviles muy pequeños (< 350px)
   ================================ */
@media (max-width: 350px) and (orientation: portrait) {
    .portrait-burger {
        width: 55vw;
        max-height: 45vh;
    }
    
    .portrait-burger .burger-image {
        max-height: 42vh;
    }
    
    .portrait-content .text-image {
        width: 80vw;
        max-height: 18vh;
    }
}

/* ================================
   Responsive: Altura muy pequeña Portrait (< 600px)
   ================================ */
@media (max-height: 600px) and (orientation: portrait) {
    .portrait-content {
        padding: 2vw;
        padding-top: 2vh;
        padding-bottom: 8vh;
    }
    
    .portrait-burger {
        width: 55vw;
        max-height: 45vh;
    }
    
    .portrait-burger .burger-image {
        max-height: 42vh;
    }
    
    .portrait-content .text-image {
        width: 80vw;
        max-height: 16vh;
    }
}

/* ================================
   Responsive: Altura pequeña Portrait (600-700px)
   ================================ */
@media (min-height: 600px) and (max-height: 700px) and (orientation: portrait) {
    .portrait-burger {
        width: 60vw;
        max-height: 48vh;
    }
    
    .portrait-burger .burger-image {
        max-height: 45vh;
    }
    
    .portrait-content .text-image {
        width: 82vw;
        max-height: 18vh;
    }
}

/* ================================
   Responsive: Altura grande Portrait (> 800px)
   ================================ */
@media (min-height: 800px) and (orientation: portrait) {
    .portrait-burger {
        width: 65vw;
        max-height: 52vh;
    }
    
    .portrait-burger .burger-image {
        max-height: 50vh;
    }
    
    .portrait-content .text-image {
        width: 85vw;
        max-width: 420px;
        max-height: 20vh;
    }
}

/* ================================
   Responsive: Landscape altura muy pequeña (< 350px)
   ================================ */
@media (orientation: landscape) and (max-height: 350px) {
    .landscape-content {
        padding: 2vh 2vw;
        padding-left: clamp(50px, 12vw, 100px);
        gap: clamp(8px, 2vw, 20px);
    }
    
    .checker-pattern {
        width: clamp(35px, 9vw, 70px);
    }
    
    .landscape-text-image {
        height: clamp(80px, 22vw, 180px);
        max-width: 80vh;
    }
    
    .landscape-burger .burger-image {
        width: clamp(180px, 48vw, 350px);
        max-height: 85vh;
    }
}

/* ================================
   Responsive: Landscape altura pequeña (350-450px)
   ================================ */
@media (orientation: landscape) and (min-height: 350px) and (max-height: 450px) {
    .landscape-content {
        padding-left: clamp(40px, 9vw, 75px);
        gap: clamp(10px, 3vw, 25px);
    }
    
    .landscape-text-image {
        height: clamp(90px, 25vw, 220px);
        max-width: 85vh;
    }
    
    .landscape-burger .burger-image {
        width: clamp(220px, 52vw, 450px);
        max-height: 88vh;
    }
}

/* ================================
   Responsive: Landscape altura media-grande (> 450px)
   ================================ */
@media (orientation: landscape) and (min-height: 450px) {
    .landscape-text-image {
        height: clamp(120px, 30vw, 300px);
    }
    
    .landscape-burger .burger-image {
        width: clamp(280px, 58vw, 580px);
        max-height: 92vh;
    }
}

/* ================================
   Safe Areas para notch/Dynamic Island
   ================================ */
@supports (padding: env(safe-area-inset-top)) {
    .portrait-view {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .landscape-view {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .landscape-content {
        padding-left: calc(clamp(40px, 10vw, 100px) + env(safe-area-inset-left));
    }
    
    @media (orientation: landscape) and (max-height: 350px) {
        .landscape-content {
            padding-left: calc(clamp(35px, 8vw, 60px) + env(safe-area-inset-left));
        }
    }
}

/* ================================
   Animación de entrada
   ================================ */
.portrait-view .portrait-content,
.landscape-view .landscape-content {
    animation: contentReveal 0.6s ease-out;
}

@keyframes contentReveal {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ================================
   Efecto de copia del código
   ================================ */
.landscape-text-image.copied {
    animation: copyPulse 0.3s ease-out;
}

@keyframes copyPulse {
    0% {
        transform: rotate(90deg) scale(1);
    }
    50% {
        transform: rotate(90deg) scale(1.05);
    }
    100% {
        transform: rotate(90deg) scale(1);
    }
}

/* Toast de notificación */
.copy-toast {
    position: fixed;
    bottom: clamp(15px, 5vh, 30px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bk-cream);
    color: var(--bk-red);
    padding: clamp(8px, 2vh, 12px) clamp(16px, 4vw, 24px);
    border-radius: 30px;
    font-weight: 600;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.copy-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}
