/* Reset de estilos básicos */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

:root {
    --bg-color: #08080c;
    --card-bg: rgba(18, 18, 26, 0.65);
    --card-border: rgba(255, 255, 255, 0.07);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-color: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #7c3aed, #a78bfa);
    --success-gradient: linear-gradient(135deg, #10b981, #34d399);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   Fondo Dinámico
   ========================================================================== */
.blur-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    mix-blend-mode: screen;
}

.orb-1 {
    width: 50vw;
    height: 50vw;
    background: #7c3aed;
    top: -10vw;
    left: -10vw;
    animation: pulse-orb 15s infinite alternate ease-in-out;
}

.orb-2 {
    width: 60vw;
    height: 60vw;
    background: #ec4899;
    bottom: -15vw;
    right: -15vw;
    animation: pulse-orb 20s infinite alternate-reverse ease-in-out;
}

@keyframes pulse-orb {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(5vw, 5vw); }
}

/* ==========================================================================
   Contenedor Principal
   ========================================================================== */
.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

/* Título Flotante Superior */
.header-overlay {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 10, 15, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.main-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #d8b4fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tag-badge {
    background: linear-gradient(135deg, #f59e0b, #fbbf24); /* Amarillo oro premium */
    color: #08080c; /* Texto oscuro para máxima legibilidad */
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Visor de PDF Interactivo (Pan & Zoom)
   ========================================================================== */
.viewer-container {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
}

.viewer-container:active {
    cursor: grabbing;
}

.panzoom-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0; /* Cambio importante para paneo preciso */
    display: flex;
    justify-content: center;
    align-items: center;
    will-change: transform;
    transition: transform 0.05s linear;
}

#pdf-canvas, #cartelera-img {
    display: block;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    max-width: none;
    max-height: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    will-change: transform;
}

/* Indicación de Interacción */
.interaction-hint {
    position: absolute;
    bottom: 96px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    animation: fade-in-up 1s ease-out 2s both;
}

.hint-icon {
    animation: rotate-hint 3s infinite linear;
}

@keyframes rotate-hint {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Barra de Herramientas Inferior (Glassmorphic)
   ========================================================================== */
.toolbar-container {
    position: absolute;
    bottom: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: slide-up-toolbar 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
    transition: var(--transition-smooth);
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.tool-btn:active {
    transform: scale(0.95) translateY(0);
}

.highlight-btn {
    background: var(--accent-gradient);
    border: none;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.highlight-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #c084fc);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
}

.zoom-text {
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.divider {
    width: 1px;
    height: 28px;
    background-color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Spinner de Carga (Overlay)
   ========================================================================== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.spinner-container {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.loading-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Alerta de Orientación de Pantalla
   ========================================================================== */
.orientation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(6, 6, 8, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 900;
    display: none; /* Controlado dinámicamente por JS */
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.alert-card {
    background: rgba(20, 20, 30, 0.8);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px 24px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    animation: scale-up-alert 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.phone-icon-wrapper {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.phone-icon {
    width: 64px;
    height: 64px;
    color: var(--accent-color);
    animation: rotate-phone 2.5s infinite ease-in-out;
}

.alert-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.alert-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.alert-btn-close {
    background: var(--accent-gradient);
    border: none;
    color: var(--text-primary);
    padding: 12px 28px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.alert-btn-close:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

@keyframes rotate-phone {
    0%, 10% { transform: rotate(0deg); }
    40%, 60% { transform: rotate(90deg); }
    90%, 100% { transform: rotate(0deg); }
}

/* ==========================================================================
   Animaciones Especiales
   ========================================================================== */
@keyframes slide-up-toolbar {
    0% { transform: translateY(100px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in-up {
    0% { transform: translateY(15px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes scale-up-alert {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 600px) {
    .header-overlay {
        top: 16px;
        left: 16px;
        padding: 6px 12px;
    }
    
    .main-title {
        font-size: 0.9rem;
    }
    
    .tag-badge {
        font-size: 0.65rem;
        padding: 1px 6px;
    }

    .toolbar-container {
        bottom: 16px;
        padding: 8px 14px;
        gap: 12px;
        border-radius: 16px;
    }

    .tool-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .tool-btn svg {
        width: 15px;
        height: 15px;
    }

    .zoom-text {
        font-size: 0.8rem;
        min-width: 40px;
    }

    .interaction-hint {
        bottom: 76px;
        padding: 4px 10px;
        font-size: 0.65rem;
    }
}
