/* Convert buttons (top row) */
.convert-btn {
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.2);
}

.convert-btn {
    display: none !important;
} 

:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --light: #f8f9fa;
    --dark: #212529;
    --text: #2d3436;
    --text-light: #636e72;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
    background-color: #f5f7fa;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header {
    padding: 15px 0;
}

.navbar {
    display: flex;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark);
}

.logo {
    width: 32px;
    height: 32px;
    margin-right: 8px;
    border-radius: 6px;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 40px 0;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--dark);
    line-height: 1.3;
}

.highlight {
    color: var(--primary);
}

.subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Download Form */
.download-form {
    max-width: 550px;
    margin: 0 auto;
}

.input-group {
    position: relative;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 0.95rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.btn-primary {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Loading Indicator */
.loading-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 30px 0;
}

.spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: var(--primary);
    border-radius: 50%;
    margin: 0 5px;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

@keyframes bounce {
    0%, 80%, 100% { 
        transform: translateY(0);
    }
    40% {
        transform: translateY(-12px);
    }
}

.loading-container p {
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
}

/* Results Container - Fixed Size */
.result-container {
    display: none;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    margin: 20px auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 700px;
}

.video-container {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    border-radius: 6px;
    background-color: #000;
}

.video-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
}

.video-description {
    margin-bottom: 15px;
    color: var(--text-light);
    line-height: 1.5;
    font-size: 0.95rem;
}

.video-meta {
    color: var(--primary);
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Download Options */
.download-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.download-option {
    position: relative;
    min-height: 40px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

/* Iframe specific styles */
.download-option {
    position: relative;
    margin-bottom: 10px;
}

.download-iframe {
    width: 100%;
    height: 45px;
    border: none;
    border-radius: 5px;
    box-shadow: 4px -3px 6px rgba(255, 0, 0, 0.3);
    margin-top: 5px;
    background: transparent;
    outline: none;
    overflow: hidden;
}

/* Fallback button styling */
.download-btn.convert-btn {
    display: none;
    width: 100%;
    padding: 12px;
    margin-top: 5px;
}

/* Show fallback button if iframe fails */
.download-option:hover .download-btn.convert-btn,
.download-option:focus-within .download-btn.convert-btn {
    display: block;
}

.download-option:hover .download-iframe,
.download-option:focus-within .download-iframe {
    opacity: 0.3;
}

/* Download button styling for new format */
.download-btn.format-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* No downloads fallback styling */
.no-downloads {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

.no-downloads i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #ff9f43;
}

.fallback-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.fallback-link:hover {
    background-color: var(--primary-dark);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Ad Layout Styles */
.ad-container {
    width: 100%;
    text-align: center;
}

.ad-placeholder {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    padding: 20px;
    border-radius: 6px;
    border: 2px dashed var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 auto;
}

/* Error toast styling */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff4757;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

.error-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Modal Styles */
.options-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

.modal-content p {
    margin-bottom: 20px;
    color: var(--text-light);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background-color: var(--primary);
    color: white;
}

.modal-btn.primary:hover {
    background-color: var(--primary-dark);
}

.modal-btn.secondary {
    background-color: #e9ecef;
    color: var(--text);
}

.modal-btn.secondary:hover {
    background-color: #dee2e6;
}

/* Fallback Section Styles */
.fallback-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.fallback-message {
    color: var(--text-light);
    margin-bottom: 10px;
}

.download-btn.fallback-btn {
    background: linear-gradient(135deg, #ff9ff3, #f368e0) !important;
}

/* Iframe loading indicator */
.download-option {
    position: relative;
}

.download-option::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-light);
    font-size: 12px;
    z-index: -1;
}

.download-iframe {
    transition: opacity 0.3s ease;
}

/* Desktop Layout */
@media (min-width: 992px) {
    .main-content {
        display: flex;
        gap: 20px;
        max-width: 1200px;
        margin: 0 auto;
    }

    .ad-sidebar {
        width: 160px;
        position: sticky;
        top: 20px;
        height: fit-content;
    }

    .ad-sidebar .ad-placeholder {
        height: 600px;
    }

    .content-wrapper {
        flex: 1;
        min-width: 0;
        width: calc(100% - 320px);
    }

    .top-ad .ad-placeholder,
    .bottom-ad .ad-placeholder {
        width: 100%;
        max-width: 700px;
        height: 90px;
        margin: 20px auto;
    }

    .bottom-ad .ad-placeholder {
        height: 250px;
    }
}

/* Tablet Layout */
@media (min-width: 768px) and (max-width: 991px) {
    .ad-sidebar {
        display: none;
    }

    .content-wrapper {
        width: 100%;
    }

    .top-ad .ad-placeholder,
    .bottom-ad .ad-placeholder {
        width: 100%;
        max-width: 700px;
        margin: 20px auto;
    }

    .top-ad .ad-placeholder {
        height: 90px;
    }

    .bottom-ad .ad-placeholder {
        height: 250px;
    }
}

/* Mobile Layout */
@media (max-width: 767px) {
    .ad-sidebar {
        display: none;
    }

    .content-wrapper {
        width: 100%;
    }

    .top-ad .ad-placeholder,
    .bottom-ad .ad-placeholder {
        width: 100%;
        max-width: 700px;
        margin: 20px auto;
    }

    .top-ad .ad-placeholder {
        height: 70px;
    }

    .bottom-ad .ad-placeholder {
        height: 200px;
    }
    
    /* Responsive adjustments for modal */
    .modal-content {
        width: 90%;
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}

/* Small Mobile Optimization */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .top-ad .ad-placeholder {
        height: 50px;
        font-size: 0.8rem;
    }

    .bottom-ad .ad-placeholder {
        height: 180px;
    }
    
    .download-options {
        grid-template-columns: 1fr;
    }
    
    .download-btn {
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .error-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}


.video-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    padding: 0;
    margin: 0 auto;
}

.video-thumbnail {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain; /* Ensures image fits without distortion */
    display: block;
}
