/* IA Download Popup Styles */

/* 1. SCROLLBAR CONTROL: Hide track visuals but keep functionality */
.ia-footer-content-wrapper::-webkit-scrollbar,
.ia-download-popup-content-wrapper::-webkit-scrollbar {
    display: none;
}

.ia-footer-content-wrapper,
.ia-download-popup-content-wrapper {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 2. BUTTON STYLES (Trigger Button) */
.ia-download-button-wrapper {
    display: block;
    width: 100%;
    margin: 10px 0;
    text-align: center;
}

.ia-download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background-color: #12d349;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    width: 100%;
    max-width: 100%;
    transition: opacity 0.2s ease;
}

.ia-download-button:hover { opacity: 0.8; }
.ia-download-button:active { opacity: 0.7; }

.ia-download-icon {
    display: inline-flex;
    align-items: center;
    width: 20px;
    height: 20px;
    filter: invert(1);
}

.ia-download-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ia-download-text { font-weight: 600; }
.ia-download-size { font-size: 14px; opacity: 0.9; font-weight: normal; }

/* 3. POPUP OVERLAY & CONTAINER */
.ia-download-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ia-download-popup-overlay.active { display: block; }
.ia-download-popup-overlay.show { opacity: 1; }

.ia-download-popup-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: pointer;
}

.ia-download-popup-container {
    position: absolute;
    top: 0;
    left: 25%;
    width: 50%;
    height: 100%;
    background-color: #ffffff;
    overflow: hidden; 
    transform: translateY(50px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.ia-download-popup-overlay.show .ia-download-popup-container {
    transform: translateY(0);
    opacity: 1;
}

/* 4. CLOSE BUTTON */
.ia-download-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.3s ease;
}

.ia-download-popup-close:hover { transform: rotate(90deg); }

.close-icon-line {
    position: absolute;
    width: 24px;
    height: 2px;
    background-color: #333333;
    transition: all 0.3s ease;
}

.close-icon-line-1 { transform: rotate(45deg); }
.close-icon-line-2 { transform: rotate(-45deg); }

/* 5. CONTENT WRAPPER */
.ia-download-popup-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    flex: 1;
}

.ia-download-popup-content {
    padding: 20px 40px 40px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    transition: filter 0.7s cubic-bezier(0.32, 0.72, 0, 1), transform 0.7s cubic-bezier(0.32, 0.72, 0, 1);
}

.ia-download-popup-content.ia-content-blurred {
    filter: blur(4px);
    transform: scale(0.98);
}

/* 6. FOOTER & ALIGNMENT FIX */
.ia-download-popup-footer {
    position: sticky;
    bottom: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    z-index: 5;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
    height: 64px;
    flex-shrink: 0;
    transition: height 0.7s cubic-bezier(0.32, 0.72, 0, 1), border-radius 0.7s cubic-bezier(0.32, 0.72, 0, 1);
}

.ia-download-popup-footer.expanded { border-radius: 32px 32px 0 0; }

.ia-footer-handle {
    height: 64px;
    display: flex;
    align-items: center; /* FIXED: Vertical alignment */
    justify-content: space-between;
    padding: 0 24px;
    cursor: pointer;
    user-select: none;
}

.ia-footer-handle-content {
    display: flex;
    align-items: center; /* FIXED: Align icon and text horizontally */
    gap: 12px;
}

.ia-footer-toggle-icon-wrapper {
    width: 40px;
    height: 40px;
    background-color: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ia-footer-handle-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ia-footer-handle-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1; /* FIXED: Remove text baseline offset */
    margin: 0;
}

.ia-footer-toggle-icon {
    color: #4b5563;
    transition: transform 0.7s cubic-bezier(0.32, 0.72, 0, 1);
}

.ia-download-popup-footer.expanded .ia-footer-toggle-icon { transform: rotate(180deg); }

.ia-footer-content-wrapper {
    padding: 0px 32px;
    overflow-y: auto;
    height: calc(90% - 64px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease 0.1s, visibility 0.5s ease 0.1s;
}

.ia-download-popup-footer.expanded .ia-footer-content-wrapper { opacity: 1; visibility: visible; }

/* MODERIZED ELASTIC ANIMATIONS */
@keyframes ia-footer-slide-peek {
    0% { transform: translateY(0); }
    15% { transform: translateY(4px); }
    45% { transform: translateY(-65%); }
    55% { transform: translateY(-60%); }
    85% { transform: translateY(-60%); }
    100% { transform: translateY(0); }
}

@keyframes ia-peek-content {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    40%, 80% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(10px) scale(0.98); }
}

.ia-download-popup-footer.ia-peek {
    animation: ia-footer-slide-peek 2.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    overflow: visible !important; 
}

.ia-download-popup-footer.ia-peek .ia-footer-content-wrapper {
    animation: ia-peek-content 2.2s ease-in-out forwards;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    position: relative;
    z-index: 10;
    overflow: visible !important; 
}

/* Adblock gate: blur popup content and show message when ad blocker is detected */
.ia-download-popup-overlay.ia-adblock-gate-active .ia-download-popup-content-wrapper {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.ia-download-popup-overlay.ia-adblock-gate-active .ia-download-popup-close {
    filter: blur(8px);
    pointer-events: none;
}

.ia-adblock-gate-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 0;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
    font-size: 15px;
    line-height: 1.5;
    color: #1f2937;
    overflow: hidden;
}

.ia-adblock-gate-logo {
    padding: 28px 32px 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #f1f5f9;
}
.ia-adblock-gate-logo img {
    max-width: 180px;
    max-height: 64px;
    height: auto;
    width: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.ia-adblock-gate-default {
    padding: 20px 32px 24px;
}
.ia-adblock-gate-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.ia-adblock-gate-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
    line-height: 1.45;
}
.ia-adblock-gate-features {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}
.ia-adblock-gate-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}
.ia-adblock-gate-features li:last-child {
    border-bottom: none;
}
.ia-adblock-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background-size: 16px;
    background-repeat: no-repeat;
    background-position: center;
}
.ia-adblock-icon-ads {
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234285F4' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%2334A853' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23FBBC05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23EA4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E");
    background-size: 20px;
}
.ia-adblock-icon-shield {
    background-color: #d1fae5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2310b981' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z'/%3E%3C/svg%3E");
}
.ia-adblock-icon-heart {
    background-color: #fce7f3;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ec4899' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z'/%3E%3C/svg%3E");
}

.ia-adblock-gate-custom {
    padding: 16px 32px 28px;
    font-size: 14px;
    color: #4b5563;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 7. RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .ia-download-popup-container { left: 10%; width: 80%; }
}

@media (max-width: 480px) {
    .ia-download-popup-container { left: 5%; width: 90%; }
    .ia-download-popup-content { padding: 50px 20px 20px; }
    .ia-footer-handle { padding: 0 16px; height: 56px; }
    .ia-footer-toggle-icon-wrapper { width: 36px; height: 36px; }
    .ia-footer-handle-title { font-size: 13px; }
    .ia-footer-content-wrapper { padding: 0px 16px; }
    .ia-download-popup-footer.expanded { border-radius: 24px 24px 0 0; }
}