/* ========================================
   CSS Variables & Root Styles
   ======================================== */

:root {
    --primary-dark: #0a1628;
    --secondary-dark: #1a2a3a;
    --tertiary-dark: #253447;
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-blue-light: #3b82f6;
    --text-primary: #ffffff;
    --text-secondary: #b0b9c3;
    --text-muted: #8b95a5;
    --border-color: #2a3a4a;
    --border-light: #3a4a5a;
    --success-color: #10b981;
    --success-hover: #059669;
    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--primary-dark);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* ========================================
   Layout Structure
   ======================================== */

.sidebar {
    width: 280px;
    background-color: var(--secondary-dark);
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.left-sidebar {
    order: -1;
    border-right: 1px solid var(--border-color);
}

.right-sidebar {
    border-left: 1px solid var(--border-color);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}

/* ========================================
   Ad Containers
   ======================================== */

.ad-container {
    width: 100%;
    min-height: 250px;
    background: linear-gradient(135deg, var(--tertiary-dark) 0%, var(--secondary-dark) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
}

.banner-ad {
    width: 100%;
    height: 90px;
    background: linear-gradient(135deg, var(--tertiary-dark) 0%, var(--secondary-dark) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    overflow: hidden;
}

.ad-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    padding: 10px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
}

/* ========================================
   Header & Logo
   ======================================== */

.header {
    text-align: center;
    padding: 40px 20px 20px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.1) 0%, transparent 100%);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--accent-blue);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 span {
    color: var(--accent-blue);
    -webkit-text-fill-color: var(--accent-blue);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 10px;
    font-weight: 300;
}

/* ========================================
   Input Section
   ======================================== */

.input-section {
    padding: 0 20px 20px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.url-input {
    flex: 1;
    background-color: var(--secondary-dark);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.url-input:focus {
    border-color: var(--accent-blue);
    background-color: var(--tertiary-dark);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), var(--shadow-md);
}

.url-input::placeholder {
    color: var(--text-muted);
}

.download-btn {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-hover) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    white-space: nowrap;
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.download-btn:active:not(:disabled) {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    color: var(--error-color);
    font-size: 0.9rem;
    padding: 12px 16px;
    background-color: var(--error-bg);
    border-left: 3px solid var(--error-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

.error-message.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Platforms Section
   ======================================== */

.platforms-section {
    padding: 30px 20px;
    text-align: center;
}

.platforms-section h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

.platforms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
}

.platform-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background-color: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.platform-item:hover {
    background-color: rgba(37, 99, 235, 0.1);
    border-color: var(--accent-blue);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.platform-item i {
    font-size: 1.8rem;
    color: var(--accent-blue);
    transition: var(--transition);
}

.platform-item:hover i {
    transform: scale(1.1);
}

.platform-item span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================
   Features Section
   ======================================== */

.features-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px 20px;
}

.feature-card {
    background-color: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.feature-card:hover {
    border-color: var(--accent-blue);
    background-color: rgba(37, 99, 235, 0.05);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
    transform: translateY(-3px);
}

.feature-card i {
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 15px;
    transition: var(--transition);
}

.feature-card:hover i {
    transform: scale(1.1) rotate(5deg);
}

.feature-card h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: auto;
    background: linear-gradient(180deg, transparent 0%, rgba(37, 99, 235, 0.05) 100%);
}

/* ========================================
   Overlays & Modals
   ======================================== */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.overlay.hidden {
    display: none;
}

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

.overlay-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    margin: 0 auto 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.overlay-content h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.overlay-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-weight: 400;
}

.progress-container {
    width: 100%;
    height: 8px;
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 40px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--success-color));
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.interstitial-ad-slot {
    width: 100%;
    min-height: 300px;
    background: linear-gradient(135deg, var(--tertiary-dark) 0%, var(--secondary-dark) 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    overflow: hidden;
}

/* ========================================
   Modal
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-btn:hover {
    color: var(--text-primary);
    background-color: rgba(37, 99, 235, 0.1);
}

.preview-container {
    margin-bottom: 25px;
}

.thumbnail {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
    max-height: 300px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.preview-info h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.preview-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 400;
}

.save-video-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-hover) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.save-video-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.save-video-btn:active {
    transform: translateY(0);
}

/* ========================================
   Pop-Under Ad
   ======================================== */

.pop-under-ad {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 400px;
    background-color: var(--secondary-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.pop-under-ad.hidden {
    display: none;
}

.pop-under-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pop-under-ad .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.pop-under-ad .ad-placeholder {
    width: 100%;
    height: 100%;
}

/* ========================================
   Scrollbar Styling
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }

    .ad-container {
        min-height: 200px;
    }

    .logo h1 {
        font-size: 2rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        max-width: 100%;
        width: 100%;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .logo i {
        font-size: 2rem;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .header {
        padding: 30px 15px 15px;
    }

    .platforms-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .features-section {
        grid-template-columns: 1fr;
        padding: 20px 15px;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }

    .pop-under-ad {
        width: 90%;
        height: 300px;
        bottom: 10px;
        right: 5%;
        left: auto;
    }

    .banner-ad {
        height: 80px;
        margin: 15px 0;
    }

    .input-section {
        padding: 0 15px 15px;
    }

    .platforms-section {
        padding: 20px 15px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .header {
        padding: 20px 12px 12px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .logo i {
        font-size: 1.5rem;
    }

    .logo {
        gap: 8px;
    }

    .tagline {
        font-size: 0.85rem;
    }

    .input-section {
        padding: 0 12px 12px;
    }

    .url-input,
    .download-btn {
        font-size: 0.9rem;
        padding: 12px 12px;
    }

    .platforms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .platform-item {
        padding: 10px;
    }

    .platform-item i {
        font-size: 1.3rem;
    }

    .platform-item span {
        font-size: 0.75rem;
    }

    .feature-card {
        padding: 15px;
    }

    .feature-card i {
        font-size: 1.5rem;
    }

    .feature-card h4 {
        font-size: 0.95rem;
    }

    .feature-card p {
        font-size: 0.8rem;
    }

    .overlay-content {
        width: 95%;
    }

    .modal-content {
        width: 95%;
        padding: 15px;
    }

    .pop-under-ad {
        width: 95%;
        height: 250px;
        right: 2.5%;
    }

    .banner-ad {
        height: 70px;
        margin: 10px 0;
    }

    .footer {
        padding: 20px 12px;
        font-size: 0.8rem;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* Prevent scrolling when overlay is open */
body.no-scroll {
    overflow: hidden;
}
