/* ═══════════════════════════════════════════════
   UniDown.live — Main Stylesheet
   Inspired by fdown.net layout & visual style
═══════════════════════════════════════════════ */

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --success: #06c270;
    --danger: #e53e3e;
    --bg-light: #f5f7fa;
    --border: #e0e4ea;
    --text-dark: #1a202c;
    --text-muted: #718096;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.12);
    --radius: 10px;
}

/* ── Base ─────────────────────────────────── */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
body {
    background: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-dark);
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
}

/* ── Navbar ───────────────────────────────── */
.navbar {
    z-index: 100;
}
.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #1a73e8, #06c270);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}
.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.5px;
}
.brand-dot {
    color: var(--primary);
}
.navbar-nav .nav-link {
    font-size: 0.9rem;
    color: #4a5568;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.navbar-nav .nav-link:hover {
    background: #eef2ff;
    color: var(--primary);
}

/* ── Jumbotron / Hero ────────────────────── */
.jumbotron-section {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2.5rem;
}
.hero-icon {
    font-size: 3.5rem;
    color: var(--primary);
    line-height: 1;
}
.hero-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.5px;
    margin-bottom: .4rem;
}
.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 1.4rem;
}

/* ── Platform Badges ─────────────────────── */
.platform-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
}
.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 600;
    padding: .3rem .75rem;
    border-radius: 50px;
    color: #fff;
    letter-spacing: .2px;
}
.platform-badge.fb  { background: #1877f2; }
.platform-badge.ig  { background: linear-gradient(135deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); }
.platform-badge.tt  { background: #010101; }
.platform-badge.rd  { background: #ff4500; }
.platform-badge.tw  { background: #000; }
.platform-badge.yt  { background: #ff0000; }

/* ── URL Input Group ─────────────────────── */
.url-input-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: border-color .2s, box-shadow .2s;
}
.url-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}
.paste-btn {
    background: transparent;
    border: none;
    padding: 0 .9rem;
    font-size: 1.3rem;
    color: #a0aec0;
    cursor: pointer;
    transition: color .15s;
    flex-shrink: 0;
}
.paste-btn:hover { color: var(--primary); }
.url-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: .97rem;
    padding: .85rem .5rem;
    color: var(--text-dark);
    background: transparent;
    min-width: 0;
}
.url-input::placeholder { color: #b0bec5; }
.download-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: .85rem 1.5rem;
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s;
    flex-shrink: 0;
}
.download-btn:hover { background: var(--primary-dark); }
.download-btn:disabled { background: #9cb8e8; cursor: default; }

/* ── Thin Progress Bar (fdown style) ────── */
.thin-progress-wrap {
    height: 6px;
    background: #e0e4ea;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.thin-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #06e09c 0%, #008ec8 100%);
    border-radius: 3px;
    transition: width 0.3s linear;
    animation: indeterminate 1.5s infinite;
}
@keyframes indeterminate {
    0%   { width: 0%;   margin-left: 0; }
    50%  { width: 60%;  margin-left: 20%; }
    100% { width: 0%;   margin-left: 100%; }
}

/* ── Result Card ─────────────────────────── */
.result-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.result-thumbnail {
    width: 100%;
    height: 100%;
    min-height: 160px;
    object-fit: cover;
    display: block;
    background: #eef2ff;
}
.result-body {
    padding: 1.2rem 1.4rem;
}
.result-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.platform-tag {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--primary);
    color: #fff;
}

/* ── Quality Buttons ─────────────────────── */
.quality-row {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.quality-btn {
    border: 1.5px solid var(--border);
    background: #fff;
    color: #4a5568;
    border-radius: 6px;
    padding: .32rem .8rem;
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}
.quality-btn:hover {
    background: #eef2ff;
    border-color: var(--primary);
    color: var(--primary);
}
.quality-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Download Button (Result Card) ──────── */
.btn-download-main {
    display: block;
    width: 100%;
    padding: .7rem 1rem;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .97rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    text-align: center;
}
.btn-download-main:hover  { background: #04aa60; }
.btn-download-main:disabled { opacity: .55; cursor: default; }

/* ── How-to Steps ────────────────────────── */
.howto-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Info Panels (Updates + FAQ) ─────────── */
.info-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    height: 100%;
}
.info-panel-header {
    background: #1a73e8;
    color: #fff;
    padding: .75rem 1.1rem;
    font-size: .95rem;
}
.info-panel-header-info {
    background: #0891b2;
}
.info-panel-body {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}
.info-panel-body::-webkit-scrollbar { width: 5px; }
.info-panel-body::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 10px; }

.update-item {
    font-size: .875rem;
    padding: .7rem .9rem;
    border-radius: 6px;
    margin-bottom: .6rem;
    line-height: 1.5;
}
.update-success { background: #f0fdf4; border-left: 3px solid #22c55e; color: #15803d; }
.update-info    { background: #eff6ff; border-left: 3px solid #3b82f6; color: #1d4ed8; }
.update-warning { background: #fffbeb; border-left: 3px solid #f59e0b; color: #b45309; }
.update-danger  { background: #fef2f2; border-left: 3px solid #ef4444; color: #b91c1c; }

/* FAQ Accordion tweaks */
.accordion-button {
    font-size: .9rem;
    padding: .75rem 1rem;
    background: #fff;
    color: var(--text-dark);
}
.accordion-button:not(.collapsed) {
    background: #eef2ff;
    color: var(--primary);
    box-shadow: none;
}
.accordion-button::after { background-size: 14px; }
.accordion-body { font-size: .875rem; padding: .6rem 1rem; }
.accordion-item { border: none; border-bottom: 1px solid var(--border) !important; }
.accordion-item:last-child { border-bottom: none !important; }

/* ── Footer ──────────────────────────────── */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 1.8rem 0;
    margin-top: 1rem;
    font-size: .875rem;
    color: #4a5568;
}
.footer-links a {
    color: #4a5568;
    text-decoration: none;
    margin: 0 .2rem;
}
.footer-links a:hover { color: var(--primary); text-decoration: underline; }
.footer-disclaimer {
    color: var(--text-muted);
    font-size: .8rem;
    max-width: 680px;
    margin: .5rem auto 0;
}
.footer-disclaimer a { color: var(--primary); }

/* ── Responsive Mobile Optimizations ──────────────────────────── */
@media (max-width: 991.98px) {
    #auth-buttons {
        width: 100%;
    }
    #auth-buttons .btn,
    #auth-buttons .dropdown,
    #auth-buttons .dropdown > button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hero-title { font-size: 1.6rem; }
    .hero-subtitle { font-size: 0.95rem; margin-bottom: 1.2rem; }
    .download-btn { padding: .85rem 1.2rem; font-size: .92rem; }
    .url-input { font-size: 16px; } /* Prevents auto-zoom on iOS */
    .result-thumbnail { min-height: 140px; }
}

@media (max-width: 576px) {
    .jumbotron-section { padding: 1.8rem 0; }
    .hero-icon { font-size: 2.8rem; margin-bottom: 0.5rem; }
    .hero-title { font-size: 1.4rem; }
    .hero-subtitle { font-size: 0.88rem; margin-bottom: 1rem; }
    
    .platform-badges {
        gap: 0.35rem;
        margin-bottom: 1.2rem !important;
    }
    .platform-badge {
        font-size: 0.72rem;
        padding: 0.28rem 0.6rem;
    }
    
    /* Mobile URL Input Bar */
    .url-input-group {
        border-radius: 10px;
        min-height: 48px; /* Comfortable touch target */
    }
    .paste-btn {
        padding: 0 0.75rem;
        font-size: 1.15rem;
        min-width: 44px;
        height: 48px;
    }
    .url-input {
        font-size: 16px; /* Must be 16px to prevent iOS Safari auto-zoom */
        padding: 0.75rem 0.35rem;
    }
    .download-btn {
        padding: 0.75rem 1.1rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
    .download-btn span {
        display: inline !important; /* Keep Download text visible */
    }

    /* Result Screen on Mobile */
    #result-screen {
        padding-top: 1.2rem !important;
        padding-bottom: 2rem !important;
    }
    .dl-main-action-btn {
        display: block !important;
        width: 100% !important;
        margin: 10px 0 !important;
        padding: 14px 16px !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
    }
    .dl-secondary-action-btn {
        display: block !important;
        width: 100% !important;
        margin: 8px 0 !important;
        padding: 10px 14px !important;
        font-size: 0.88rem !important;
    }
    
    .info-panel-body {
        max-height: 320px;
        -webkit-overflow-scrolling: touch;
    }
    
    .footer-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem 0.8rem;
    }
}
