/* AI Summary Reels - Premium UX Styles */

#ai-summary-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85); /* Darker overlay */
    backdrop-filter: blur(15px); /* Premium background blur */
    -webkit-backdrop-filter: blur(15px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    overflow-x: hidden;
    touch-action: none; /* Prevents unwanted browser gestures */
}

#ai-summary-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.reels-swiper {
    width: 100%;
    max-width: 480px; /* Mobile width card on Desktop */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    box-shadow: 0 0 100px rgba(0,0,0,0.8);
    position: relative;
    background: #000;
}

.reel-slide {
    position: relative;
    width: 100% !important; /* Ensure it doesn't overflow */
    height: 100% !important;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.reel-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.95) 100%);
    z-index: 1;
}

.reel-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2.5rem 1.5rem 4rem; /* Safe area for mobile */
    z-index: 2;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 40%;
    pointer-events: none;
}

.reel-content > * {
    pointer-events: auto;
}

.reel-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(79, 70, 229, 0.8);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    backdrop-filter: blur(4px);
}

.reel-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.reel-summary {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.65;
    color: rgba(255,255,255,0.95);
    margin-bottom: 2.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 10;
    line-clamp: 10;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.reel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    color: #000;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
}

.reel-btn:active {
    transform: scale(0.95);
}

.reel-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.3s ease;
}

.reel-btn:hover svg {
    transform: translateX(4px);
}

.reels-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reels-close-btn:hover {
    background: rgba(255,255,255,0.4);
}

/* AI Toggle Button styles */
.ai-summary-btn-container {
    display: flex;
    justify-content: center;
    transform: translateY(-50%);
    margin-bottom: -1rem; /* Adjusting so it doesn't push down the main section too much */
    z-index: 50;
    position: relative;
}

.ai-summary-trigger-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 30px -5px rgba(79, 70, 229, 0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.2);
}

.ai-summary-trigger-btn:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.6);
}

.ai-icon-sparkle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-icon-sparkle::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    filter: blur(8px);
    opacity: 0;
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Mobile Specific Optimizations */
@media (max-width: 640px) {
    #ai-summary-overlay {
        background: #000;
        backdrop-filter: none;
    }
    .reels-swiper {
        max-width: 100%;
        box-shadow: none;
    }
    .reel-content { 
        padding-top: 5rem;
        min-height: 65%; /* Covers more than half screen */
    }
    /* Even more space for blogs as requested */
    .reels-type-blog .reel-content {
        min-height: 75%;
    }
    .reel-title { font-size: 1.75rem; font-weight: 900; margin-bottom: 1.25rem; }
    .reel-summary { 
        font-size: 1.05rem; 
        line-height: 1.7;
        -webkit-line-clamp: 15; 
        line-clamp: 15; 
        margin-bottom: 3rem;
    }
    .reels-type-blog .reel-summary {
        -webkit-line-clamp: 22;
        line-clamp: 22;
    }
    .ai-summary-trigger-btn { padding: 0.6rem 1.25rem; font-size: 0.9rem; }
    .reels-close-btn { 
        top: 1rem; 
        right: 1rem; 
        width: 2.5rem; 
        height: 2.5rem; 
        background: rgba(0,0,0,0.4); 
    }
}

/* Landscape Mobile Fix */
@media (max-height: 500px) {
    .reel-content { padding-top: 1rem; }
    .reel-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
    .reel-summary { -webkit-line-clamp: 3; line-clamp: 3; margin-bottom: 1rem; }
}
