/* =========================================
   1. RESET & GLOBAL STYLES
   ========================================= */
:root {
    --primary-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --primary-color: #bc1888;
    --secondary-color: #405de6;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #f9f9f9;
    --white: #ffffff;
    --border-radius: 12px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul, ol {
    list-style: none;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================
   2. LAYOUT & CONTAINER
   ========================================= */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
}

/* =========================================
   3. HEADER & NAVIGATION
   ========================================= */
.header {
    text-align: center;
    padding: 40px 0 20px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.header-desc {
    color: var(--text-light);
    font-size: 1.1rem;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.main-nav a {
    font-weight: 500;
    color: var(--text-dark);
    padding: 8px 16px;
    border-radius: 20px;
}

.main-nav a:hover, .main-nav a.active-link {
    background: rgba(188, 24, 136, 0.1);
    color: var(--primary-color);
}

/* =========================================
   4. DOWNLOADER TOOL (THE CORE)
   ========================================= */
.downloader-tool {
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 40px;
}

/* Tabs */
.downloader-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.nav-item {
    background: none;
    border: 2px solid #eee;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.nav-item.active {
    background: var(--primary-gradient);
    color: var(--white);
    border-color: transparent;
}

.tool-title {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.tool-subtitle {
    margin-bottom: 25px;
    color: var(--text-light);
}

/* Form */
.input-form {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.input-field {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #ddd;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-field:focus {
    border-color: var(--primary-color);
}

.paste-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 5px;
}

.download-btn {
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    width: 100%;
}

.download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.download-btn:hover:not(:disabled) {
    background: #2d46b9;
    transform: translateY(-2px);
}

/* =========================================
   5. RESULTS AREA & DYNAMIC CONTENT
   ========================================= */

#results-container {
    margin-top: 40px;
    /* Container layout handling is done in JS, but base style here */
    display: none; /* Hidden by default */
}

/* --- AD / LOADER AREA --- */
.ad-placeholder-content {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    border: 1px dashed #ccc;
    margin-bottom: 20px;
}

.ad-placeholder-content h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
}

.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- ERROR MESSAGES --- */
.error-message {
    color: #dc3545;
    background: #ffe6e6;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ffcccc;
}

/* --- USER HEADER (Avatar + Name) --- */
.post-user-header {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    text-align: left;
    border: 1px solid #eee;
}

.post-user-header img {
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    border: 2px solid var(--bg-light);
}

.post-user-header .username {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.post-user-header .caption {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- MEDIA CARDS (Results) --- */
.media-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.media-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-width: 450px;
    width: 100%;
}

.media-card .preview,
.slideshow-media-preview,
.profile-picture {
    width: 100%;
    height: auto;
    display: block;
    background: #000; /* Black bg for videos */
}

.media-info, .slideshow-info {
    padding: 15px;
    text-align: center;
}

.media-type {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #999;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

/* --- SLIDESHOW / CAROUSEL --- */
.slideshow-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-width: 450px;
    width: 100%;
    margin: 0 auto;
}

.slideshow-content {
    position: relative;
}

.slideshow-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none; /* Let clicks pass through if not on buttons */
}

.slideshow-prev-btn, .slideshow-next-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    pointer-events: auto; /* Re-enable clicks */
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slideshow-prev-btn:hover, .slideshow-next-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slideshow-prev-btn:disabled, .slideshow-next-btn:disabled {
    opacity: 0;
    pointer-events: none;
}

/* --- RESULT BUTTONS --- */
.download-btn-small {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    display: inline-block;
    text-decoration: none;
}

.download-btn-small:hover {
    background: #a01573;
}

.ml-2 {
    margin-left: 10px;
}

/* --- PROFILE PICTURE RESULT --- */
.profile-picture-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.profile-picture-result img {
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
    margin-bottom: 15px;
    object-fit: cover;
}

.profile-picture-result h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
}

/* =========================================
   6. FEATURES & FAQ CONTENT
   ========================================= */
.content-section {
    max-width: 900px;
    margin: 0 auto 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px;
    margin: 40px 0;
}

.feature-box {
    background: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s;
}

.feature-box:hover {
    transform: translateY(-5px);
}

.feature-box h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* FAQ */
.faq-section {
    margin-top: 50px;
}

details {
    background: var(--white);
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid #eee;
    overflow: hidden;
}

summary {
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    position: relative;
    background: #fff;
}

summary::-webkit-details-marker { display: none; }

summary::after {
    content: '+';
    position: absolute;
    right: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

details[open] summary::after { content: '-'; }

details p {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    color: var(--text-light);
}

/* =========================================
   7. FOOTER
   ========================================= */
.footer {
    background: var(--white);
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-social {
    margin-bottom: 20px;
}

.footer-social a {
    margin: 0 10px;
    color: var(--text-dark);
}

.footer-social a:hover {
    color: var(--primary-color);
}

.disclaimer-text {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Support Box */
.support-us-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 300px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 5px solid var(--primary-color);
}
.support-us-notice .close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* =========================================
   8. MOBILE RESPONSIVE MEDIA QUERIES
   ========================================= */

@media (min-width: 768px) {
    .input-form {
        flex-direction: row;
        background: #fff;
        border: 2px solid #ddd;
        border-radius: 50px;
        padding: 5px;
    }

    .input-wrapper {
        flex: 1;
    }

    .input-field {
        border: none;
        padding-left: 20px;
    }

    .download-btn {
        width: auto;
        margin-left: 10px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .downloader-tool {
        padding: 25px 15px;
    }

    .tool-title {
        font-size: 1.4rem;
    }

    .features-grid {
        grid-template-columns: 1fr; 
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
    }

    /* Stack User Header items on very small screens */
    .post-user-header {
        flex-direction: column;
        text-align: center;
    }
    
    .post-user-header img {
        margin-right: 0;
        margin-bottom: 10px;
    }

    /* Ensure carousel buttons are tappable */
    .slideshow-prev-btn, .slideshow-next-btn {
        width: 45px;
        height: 45px;
    }
}