/* ═══════════════════════════════════════════════════════
   AutoSpa Stories — Frontend Styles
   Diseño premium alineado con el tema AutoSpa
   ═══════════════════════════════════════════════════════ */

:root {
    --astories-accent: #52ACFA;
    --astories-accent-glow: rgba(82, 172, 250, 0.35);
    --astories-bg: #030303;
    --astories-bubble-size: 100px; /* Agrandado para PC */
    --astories-ring-width: 3px;
}

/* ─── Contenedor Principal ─────────────────────────── */

.astories-container {
    padding: 0 24px;
    max-width: 1200px;
    margin: 0 auto;
    overflow: hidden;
}

.astories-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 16px 8px 24px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.astories-scroll::-webkit-scrollbar {
    display: none;
}

/* ─── Burbujas de Stories ──────────────────────────── */

.astories-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.astories-bubble:hover {
    transform: scale(1.08);
}

.astories-bubble:active {
    transform: scale(0.95);
}

.astories-bubble-ring {
    position: absolute;
    inset: -var(--astories-ring-width);
    border-radius: 50%;
    padding: var(--astories-ring-width);
    background: linear-gradient(135deg, #52ACFA 0%, #a855f7 40%, #ec4899 70%, #f97316 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: astories-ring-rotate 4s linear infinite;
}

@keyframes astories-ring-rotate {
    0%   { background: linear-gradient(0deg, #52ACFA, #a855f7, #ec4899, #f97316); }
    25%  { background: linear-gradient(90deg, #52ACFA, #a855f7, #ec4899, #f97316); }
    50%  { background: linear-gradient(180deg, #52ACFA, #a855f7, #ec4899, #f97316); }
    75%  { background: linear-gradient(270deg, #52ACFA, #a855f7, #ec4899, #f97316); }
    100% { background: linear-gradient(360deg, #52ACFA, #a855f7, #ec4899, #f97316); }
}

.astories-bubble-inner {
    position: relative;
    width: var(--astories-bubble-size);
    height: var(--astories-bubble-size);
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #111 0%, #0a0a0a 100%);
    border: 3px solid transparent;
    background-clip: padding-box;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 3px transparent;
    transition: box-shadow 0.3s ease;
}

.astories-bubble:hover .astories-bubble-inner {
    box-shadow: 0 0 20px var(--astories-accent-glow);
}

/* Borde gradiente simulado */
.astories-bubble-inner::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #52ACFA, #a855f7, #ec4899, #f97316);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: 0;
    animation: astories-gradient-spin 3s linear infinite;
}

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

.astories-bubble-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    border-radius: 50%;
}

.astories-bubble-icon {
    color: rgba(255, 255, 255, 0.6);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.astories-bubble:hover .astories-bubble-icon {
    color: var(--astories-accent);
}

.astories-bubble-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: calc(var(--astories-bubble-size) + 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.02em;
    transition: color 0.3s ease;
}

.astories-bubble:hover .astories-bubble-label {
    color: #fff;
}

/* ─── Visor Fullscreen ─────────────────────────────── */

.astories-viewer {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.astories-viewer.active {
    opacity: 1;
    visibility: visible;
}

.astories-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: blur(40px);
}

.astories-viewer-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 95vh;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 60px rgba(82, 172, 250, 0.08);
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.astories-viewer.active .astories-viewer-content {
    transform: scale(1);
}

/* ─── Barra de Progreso ────────────────────────────── */

.astories-progress-bar-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    gap: 4px;
    padding: 10px 12px 0;
}

.astories-progress-segment {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.astories-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 3px;
    transition: none;
}

.astories-progress-segment.completed .astories-progress-fill {
    width: 100%;
}

.astories-progress-segment.active .astories-progress-fill {
    /* Width will be animated via JS */
}

/* ─── Header del Visor ─────────────────────────────── */

.astories-viewer-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.astories-viewer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.astories-viewer-logo {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.astories-viewer-logo span {
    color: var(--astories-accent);
}

.astories-viewer-title {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.astories-viewer-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
}

.astories-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ─── Video ────────────────────────────────────────── */

.astories-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ─── Call to Action ───────────────────────────────── */

.astories-cta-container {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    pointer-events: none;
}

.astories-cta-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.astories-cta-btn {
    pointer-events: auto;
    font-size: 13px !important;
    padding: 12px 28px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: astories-pulse 2s infinite;
}

@keyframes astories-pulse {
    0% { box-shadow: 0 0 0 0 rgba(82, 172, 250, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(82, 172, 250, 0); }
    100% { box-shadow: 0 0 0 0 rgba(82, 172, 250, 0); }
}

/* ─── Zonas de Tap ─────────────────────────────────── */

.astories-tap-prev,
.astories-tap-next {
    position: absolute;
    top: 60px;
    bottom: 0;
    z-index: 5;
    cursor: pointer;
}

.astories-tap-prev {
    left: 0;
    width: 35%;
}

.astories-tap-next {
    right: 0;
    width: 65%;
}

/* ─── Flechas de Navegación (Desktop) ──────────────── */

.astories-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.astories-nav:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.astories-nav-prev {
    left: -68px;
}

.astories-nav-next {
    right: -68px;
}

/* ─── Indicador de Pausa ───────────────────────────── */

.astories-pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    z-index: 15;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.astories-pause-indicator.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ─── Responsive ───────────────────────────────────── */

@media (max-width: 768px) {
    :root {
        --astories-bubble-size: 85px; /* Agrandado para tablet/móvil grande */
    }

    .astories-container {
        padding: 0 12px;
    }

    .astories-scroll {
        gap: 16px;
        padding: 12px 4px 20px;
    }

    .astories-bubble-label {
        font-size: 11px;
    }

    .astories-viewer-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .astories-nav {
        display: none;
    }
}

@media (max-width: 480px) {
    :root {
        --astories-bubble-size: 75px; /* Agrandado para móvil pequeño */
    }

    .astories-scroll {
        gap: 14px;
    }

    .astories-bubble-label {
        font-size: 10px;
        max-width: calc(var(--astories-bubble-size) + 8px);
    }
}

/* ─── Animaciones de Entrada ───────────────────────── */

.astories-bubble {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
    animation: astories-bubble-in 0.5s ease forwards;
}

.astories-bubble:nth-child(1) { animation-delay: 0.05s; }
.astories-bubble:nth-child(2) { animation-delay: 0.1s; }
.astories-bubble:nth-child(3) { animation-delay: 0.15s; }
.astories-bubble:nth-child(4) { animation-delay: 0.2s; }
.astories-bubble:nth-child(5) { animation-delay: 0.25s; }
.astories-bubble:nth-child(6) { animation-delay: 0.3s; }
.astories-bubble:nth-child(7) { animation-delay: 0.35s; }
.astories-bubble:nth-child(8) { animation-delay: 0.4s; }
.astories-bubble:nth-child(9) { animation-delay: 0.45s; }
.astories-bubble:nth-child(10) { animation-delay: 0.5s; }

@keyframes astories-bubble-in {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === Layout: botones desplegables === */
.astories-services {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.astories-services-toggle {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding-inline: 24px;
    box-shadow: 0 14px 28px rgba(82, 172, 250, 0.12);
}

.astories-services-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 18px;
    line-height: 1;
    transition: transform 0.25s ease;
}

.astories-services.is-open .astories-services-toggle-icon {
    transform: rotate(45deg);
}

.astories-services-panel[hidden] {
    display: none;
}

.astories-services-panel {
    animation: astories-services-in 0.25s ease;
}

@keyframes astories-services-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.astories-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.astories-button {
    width: 100%;
    min-height: 84px;
    padding: 16px 22px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    letter-spacing: normal;
    text-transform: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.astories-button:hover {
    transform: translateY(-2px);
    border-color: #ffffff;
    box-shadow: 0 16px 30px rgba(82, 172, 250, 0.18);
}

.astories-button-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.astories-button-name {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.25;
    text-align: left;
    word-break: break-word;
}

.astories-button-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.78;
    color: #52acfa;
}

.astories-button-play {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #52acfa;
    border: 1px solid #52acfa;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(82, 172, 250, 0.22);
}

.astories-button .astories-bubble-label,
.astories-button .astories-bubble-ring,
.astories-button .astories-bubble-inner {
    display: none;
}

@media (min-width: 768px) {
    .astories-buttons-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .astories-buttons-grid {
        grid-template-columns: 1fr;
    }

    .astories-button {
        min-height: 80px;
        padding: 15px 18px;
    }
}
