/* ========================================
   INSTAGRAM DOWNLOADER CUSTOM STYLES
   Matching Home Page & Beautiful Results
   ======================================== */

/* === PROCESSING STATUS (Loading) === */
.download-processing {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 30px auto;
}

.processing-loader {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.loader-dot {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #833ab4, #fd1d1d);
    border-radius: 50%;
    animation: loader-bounce 1.4s infinite ease-in-out both;
}

.loader-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loader-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.processing-text {
    color: #333;
    font-weight: 500;
    font-size: 16px;
    margin: 0;
}

/* === RESULTS CONTAINER === */
.search-results {
    margin-top: 40px;
}

.download-results {
    width: 100%;
}

/* === RESULTS GRID === */
.results-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
    margin: 0 auto;
    max-width: 900px;
}

/* === RESULT CARD === */
.result-card {
    background: #fff !important;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex !important;
    flex-direction: column;
    min-height: 300px;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* === RESULT MEDIA === */
.result-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.result-media img,
.result-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.result-media:hover img,
.result-media:hover video {
    transform: scale(1.05);
}

/* Play icon for videos */
.result-media .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.result-media:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
}

/* === DOWNLOAD BUTTON === */
.result-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    color: #fff !important;
    text-decoration: none;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-download-btn:hover {
    transform: scale(1.02);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.result-download-btn .material-icons {
    font-size: 20px;
}

/* === ERROR MESSAGE === */
.download-error {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: 30px auto;
}

.download-error .material-icons {
    font-size: 48px;
    color: #fd1d1d;
    margin-bottom: 15px;
}

.download-error p {
    color: #333;
    font-size: 16px;
    margin: 0 0 20px;
}

.download-error button {
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.download-error button:hover {
    transform: scale(1.05);
}

/* === LIGHTBOX === */
#media-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    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;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-media {
    max-width: 90vw;
    max-height: 75vh;
}

.lightbox-media img,
.lightbox-media video {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 8px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

.lightbox-download {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
    color: #fff !important;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    margin-top: 20px;
    transition: transform 0.2s ease;
}

.lightbox-download:hover {
    transform: scale(1.05);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }
}