/* Ad Layout CSS - Speedtest.net Style */

/* Main ad layout container */
.ad-layout {
    display: grid;
    grid-template-columns: 160px 1fr 160px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "left top right"
        "left main right"
        "left bottom right";
    gap: 8px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    min-height: 600px;
}

/* Large desktop - wider sidebars */
@media (min-width: 1400px) {
    .ad-layout {
        grid-template-columns: 300px 1fr 300px;
        gap: 10px;
        padding: 15px;
    }

    .ad-unit-sidebar {
        width: 300px;
    }
}

/* Left sidebar ad */
.ad-sidebar-left {
    grid-area: left;
    position: sticky;
    top: 80px;
    height: fit-content;
    align-self: start;
    display: flex;
    justify-content: flex-end; /* Align ad towards main content */
}

/* Right sidebar ad */
.ad-sidebar-right {
    grid-area: right;
    position: sticky;
    top: 80px;
    height: fit-content;
    align-self: start;
    display: flex;
    justify-content: flex-start; /* Align ad towards main content */
}

/* Top banner ad */
.ad-top-banner {
    grid-area: top;
    text-align: center;
    min-height: 90px;
}

/* Bottom banner ad */
.ad-bottom-banner {
    grid-area: bottom;
    text-align: center;
    min-height: 90px;
}

/* Main content area */
.ad-main-content {
    grid-area: main;
    min-height: 400px;
}

/* Ad unit container */
.ad-unit {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-unit-sidebar {
    width: 160px;
    min-height: 600px;
}

.ad-unit-banner {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 0 auto;
}

.ad-unit-mobile {
    width: 100%;
    max-width: 320px;
    min-height: 100px;
    margin: 0 auto;
}

/* Mobile top/middle/bottom ads - hidden on desktop */
.ad-mobile-top,
.ad-mobile-bottom {
    display: none;
    text-align: center;
    margin: 10px 0;
    padding: 10px 15px;
}

.ad-mobile-middle {
    display: none;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
}

/* Mobile breakpoint - hide sidebars, show mobile ads */
@media (max-width: 768px) {
    .ad-layout {
        display: block;
        padding: 10px;
    }

    .ad-sidebar-left,
    .ad-sidebar-right {
        display: none;
    }

    .ad-top-banner,
    .ad-bottom-banner {
        display: none;
    }

    .ad-mobile-top,
    .ad-mobile-middle,
    .ad-mobile-bottom {
        display: block;
    }

    .ad-main-content {
        margin: 0;
    }
}

/* Results page specific styles */
.results-container {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 300px;
}

.results-processing {
    text-align: center;
    padding: 40px 20px;
}

.results-processing h2 {
    margin-bottom: 20px;
    color: #333;
}

.results-processing .queue-info {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 20px;
}

.results-success {
    text-align: center;
    padding: 40px 20px;
}

.results-success h2 {
    color: #28a745;
    margin-bottom: 30px;
}

.results-success .download-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.results-success .download-btn {
    display: inline-block;
    padding: 15px 40px;
    background: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.1em;
    transition: background 0.3s;
}

.results-success .download-btn:hover {
    background: #0056b3;
    color: #fff;
    text-decoration: none;
}

.results-error {
    text-align: center;
    padding: 40px 20px;
}

.results-error h2 {
    color: #dc3545;
    margin-bottom: 20px;
}

.results-error p {
    color: #666;
    margin-bottom: 20px;
}

/* Progress bar */
.progress-container {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 20px;
    background: linear-gradient(90deg, #007bff, #00bfff);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* Spinner - keep existing spinner styles but add new one */
.spinner-modern {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* File preview in results */
.file-preview {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.file-preview img,
.file-preview video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 5px;
}

/* Share buttons */
.share-buttons {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.share-buttons a {
    display: inline-block;
    margin: 0 5px;
    padding: 8px 15px;
    border-radius: 5px;
    color: #fff;
    text-decoration: none;
}

/* Paid user - no ads */
.no-ads .ad-sidebar-left,
.no-ads .ad-sidebar-right,
.no-ads .ad-top-banner,
.no-ads .ad-bottom-banner,
.no-ads .ad-mobile-top,
.no-ads .ad-mobile-bottom {
    display: none;
}

.no-ads .ad-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
}

/* Wide layout variant - sidebars only on very wide screens (1500px+) */
.ad-layout-wide {
    grid-template-columns: 1fr;
    grid-template-areas:
        "top"
        "main"
        "bottom";
    max-width: none;
}

.ad-layout-wide .ad-sidebar-left,
.ad-layout-wide .ad-sidebar-right {
    display: none;
}

.ad-layout-wide .ad-top-banner,
.ad-layout-wide .ad-bottom-banner {
    display: block;
}

.ad-layout-wide .ad-mobile-top,
.ad-layout-wide .ad-mobile-bottom {
    display: none;
}

/* Show sidebars only on very wide screens (1500px+) */
@media (min-width: 1500px) {
    .ad-layout-wide {
        grid-template-columns: 160px 1fr 160px;
        grid-template-areas:
            "left top right"
            "left main right"
            "left bottom right";
        max-width: 1600px;
    }

    .ad-layout-wide .ad-sidebar-left,
    .ad-layout-wide .ad-sidebar-right {
        display: block;
    }
}

/* Wide layout on ultra-wide screens */
@media (min-width: 1800px) {
    .ad-layout-wide {
        grid-template-columns: 300px 1fr 300px;
        max-width: 2000px;
    }

    .ad-layout-wide .ad-unit-sidebar {
        width: 300px;
    }
}

/* Wide layout mobile - same as regular mobile */
@media (max-width: 768px) {
    .ad-layout-wide .ad-top-banner,
    .ad-layout-wide .ad-bottom-banner {
        display: none;
    }

    .ad-layout-wide .ad-mobile-top,
    .ad-layout-wide .ad-mobile-middle,
    .ad-layout-wide .ad-mobile-bottom {
        display: block;
    }
}
