/* Download Popup Styles - Enhanced Responsive Version */

/* ============================================
   DOWNLOAD SECTION
   ============================================ */
.download-section {
    margin: 30px 0;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.download-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.download-section h3 {
    color: #fff;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.download-section p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    font-size: clamp(0.85rem, 3vw, 1rem);
}

/* ============================================
   DOWNLOAD BUTTON
   ============================================ */
.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 30px;
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    font-weight: 700;
    color: #1a1a2e;
    background: linear-gradient(135deg, #00d9ff 0%, #00ff88 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 30px rgba(0, 217, 255, 0.4);
    position: relative;
    z-index: 1;
    overflow: hidden;
    width: auto;
    max-width: 100%;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 217, 255, 0.5);
}

.download-btn:active {
    transform: translateY(-1px) scale(1.01);
}

.download-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

/* ============================================
   POPUP OVERLAY
   ============================================ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 15px;
    box-sizing: border-box;
    overflow-y: auto;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   POPUP CONTENT
   ============================================ */
.popup-content {
    background: linear-gradient(145deg, #1e1e2f 0%, #2d2d44 100%);
    border-radius: 20px;
    padding: 0;
    max-width: 480px;
    width: 100%;
    position: relative;
    transform: scale(0.8) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: calc(100vh - 30px);
    overflow-y: auto;
}

.popup-overlay.active .popup-content {
    transform: scale(1) translateY(0);
}

/* ============================================
   POPUP HEADER
   ============================================ */
.popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 15px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.popup-title {
    font-size: clamp(1rem, 4vw, 1.3rem);
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.4;
    padding: 0 30px;
    word-break: break-word;
}

.popup-desc {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.8rem, 3vw, 0.95rem);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   POPUP BODY
   ============================================ */
.popup-body {
    padding: 20px 15px;
}

/* ============================================
   CLOSE BUTTON
   ============================================ */
.close-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.3rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ============================================
   COUNTDOWN
   ============================================ */
.countdown-wrapper {
    text-align: center;
    padding: 10px 0;
}

.countdown-text {
    font-size: clamp(0.85rem, 3vw, 1rem);
    color: #aaa;
    margin-bottom: 15px;
}

.countdown-circle {
    position: relative;
    width: clamp(80px, 25vw, 120px);
    height: clamp(80px, 25vw, 120px);
    margin: 0 auto 20px;
}

.countdown-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-circle .bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.countdown-circle .progress {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.countdown-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    font-weight: 700;
    color: #fff;
    transition: transform 0.1s;
}

.countdown-label {
    text-align: center;
    color: #888;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    margin-top: -10px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2, #00d9ff);
    background-size: 200% 100%;
    border-radius: 8px;
    transition: width 1s linear;
    animation: progressGlow 2s infinite;
}

@keyframes progressGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ============================================
   DOWNLOAD LINKS
   ============================================ */
.download-links-wrapper {
    display: none;
}

.download-links-wrapper.show {
    display: block;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   POPUP AD SLOT
   ============================================ */
.popup-ad-slot {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-ad-slot.before-countdown {
    margin-bottom: 20px;
}

.popup-ad-slot.after-countdown {
    margin-top: 20px;
}

.popup-ad-slot.before-links {
    margin-bottom: 15px;
}

.popup-ad-slot.after-links {
    margin-top: 15px;
}

.popup-ad-slot img,
.popup-ad-slot iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.popup-ad-slot ins {
    display: block !important;
}

.download-links-title {
    text-align: center;
    color: #fff;
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    margin-bottom: 15px;
}

.download-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.download-link:hover,
.download-link:active {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.15), rgba(0, 255, 136, 0.15));
    border-color: rgba(0, 217, 255, 0.3);
}

.download-link .link-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2;
}

.download-link .link-icon svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.download-link .link-text {
    flex: 1;
    min-width: 0;
    order: 1;
}

.download-link .link-text>span:first-child {
    display: block;
    font-size: clamp(0.85rem, 3vw, 0.95rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-link .link-host {
    display: block;
    font-size: clamp(0.7rem, 2.5vw, 0.8rem);
    color: #888;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   ARTICLE IMAGES
   ============================================ */
.article-hero {
    margin: 0 0 25px;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.article-hero img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.article-gallery {
    margin: 30px 0;
    text-align: center;
}

.article-gallery img {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.article-gallery figcaption {
    margin-top: 12px;
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
}

/* ============================================
   RTL SUPPORT (Arabic)
   ============================================ */
[dir="rtl"] .close-btn,
html[lang="ar"] .close-btn,
body.rtl .close-btn {
    left: auto;
    right: 12px;
}

[dir="rtl"] .popup-title,
html[lang="ar"] .popup-title,
body.rtl .popup-title {
    padding: 0 30px;
}

[dir="rtl"] .download-link,
html[lang="ar"] .download-link,
body.rtl .download-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .download-link .link-text,
html[lang="ar"] .download-link .link-text,
body.rtl .download-link .link-text {
    text-align: right;
}

[dir="rtl"] .download-link .link-icon,
html[lang="ar"] .download-link .link-icon,
body.rtl .download-link .link-icon {
    order: 1;
}

[dir="rtl"] .download-link .link-text,
html[lang="ar"] .download-link .link-text,
body.rtl .download-link .link-text {
    order: 2;
}

/* ============================================
   TABLET SCREENS
   ============================================ */
@media (min-width: 577px) and (max-width: 991px) {
    .download-section {
        padding: 35px 25px;
        margin: 35px 0;
    }

    .download-btn {
        padding: 16px 40px;
    }

    .popup-content {
        max-width: 500px;
    }

    .popup-header {
        padding: 25px 20px;
    }

    .popup-body {
        padding: 25px 20px;
    }
}

/* ============================================
   DESKTOP SCREENS
   ============================================ */
@media (min-width: 992px) {
    .download-section {
        padding: 40px 30px;
        margin: 40px 0;
        border-radius: 24px;
    }

    .download-btn {
        padding: 18px 50px;
    }

    .download-btn:hover {
        transform: translateY(-5px) scale(1.05);
    }

    .popup-content {
        max-width: 520px;
        border-radius: 28px;
    }

    .popup-header {
        padding: 30px;
    }

    .popup-body {
        padding: 35px;
    }

    .download-link {
        padding: 15px 20px;
    }

    .download-link:hover {
        transform: translateX(-5px);
    }

    [dir="rtl"] .download-link:hover,
    html[lang="ar"] .download-link:hover {
        transform: translateX(5px);
    }

    .article-hero {
        border-radius: 20px;
        margin: 0 0 30px;
    }

    .article-gallery {
        margin: 40px 0;
    }

    .article-gallery img {
        border-radius: 20px;
        border-width: 5px;
    }
}

/* ============================================
   SMALL MOBILE (< 360px)
   ============================================ */
@media (max-width: 359px) {
    .download-section {
        padding: 20px 15px;
        margin: 20px 0;
        border-radius: 15px;
    }

    .download-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
        gap: 8px;
        width: 100%;
    }

    .download-btn svg {
        width: 18px;
        height: 18px;
    }

    .popup-overlay {
        padding: 10px;
    }

    .popup-content {
        border-radius: 15px;
    }

    .popup-header {
        padding: 15px 12px;
    }

    .popup-body {
        padding: 15px 12px;
    }

    .close-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 1.1rem;
        top: 10px;
        left: 10px;
    }

    [dir="rtl"] .close-btn,
    html[lang="ar"] .close-btn {
        left: auto;
        right: 10px;
    }

    .countdown-circle {
        width: 70px;
        height: 70px;
    }

    .download-link {
        padding: 10px 12px;
        gap: 10px;
    }

    .download-link .link-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .download-link .link-icon svg {
        width: 16px;
        height: 16px;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .popup-overlay {
        align-items: flex-start;
        padding: 10px;
    }

    .popup-content {
        max-height: none;
    }

    .countdown-circle {
        width: 60px;
        height: 60px;
    }

    .countdown-wrapper {
        padding: 5px 0;
    }

    .popup-header {
        padding: 15px;
    }

    .popup-body {
        padding: 15px;
    }
}

/* ============================================
   SAFE AREA (NOTCH PHONES)
   ============================================ */
@supports (padding: max(0px)) {
    .popup-overlay {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   TOUCH IMPROVEMENTS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    .download-btn:hover {
        transform: none;
        box-shadow: 0 8px 30px rgba(0, 217, 255, 0.4);
    }

    .download-link:hover {
        transform: none;
    }

    .close-btn:hover {
        transform: none;
    }

    .download-btn:active {
        transform: scale(0.98);
    }

    .download-link:active {
        background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(0, 255, 136, 0.2));
    }
}