/* --- Variables --- */
:root {
    --primary: #4f46e5;       /* Professional Indigo */
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary: #ec4899;     /* Accent Pink/Rose */
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-sub: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --radius: 20px;
    --shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
    --font-main: 'Inter', sans-serif;
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-glow: rgba(129, 140, 248, 0.3);
    --secondary: #f472b6;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f3f4f6;
    --text-sub: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}

/* --- Global Reset --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }
body { font-family: var(--font-main); background: var(--bg); color: var(--text-main); line-height: 1.6; transition: background 0.3s, color 0.3s; overflow-x: hidden; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
.hidden { display: none !important; }
.container { max-width: 700px; margin: 0 auto; padding: 0 20px; }

/* --- Navbar --- */
header { padding: 25px 0; background: transparent; }
.navbar { display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 1.6rem; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.badge { font-size: 0.65rem; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; padding: 3px 8px; border-radius: 6px; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 20px; }
.header-stats { display: flex; gap: 15px; font-size: 0.85rem; color: var(--text-sub); background: var(--card-bg); padding: 5px 15px; border-radius: 50px; border: 1px solid var(--border); }
.stat-item i { color: var(--primary); margin-right: 5px; }
#theme-toggle { background: var(--card-bg); border: 1px solid var(--border); color: var(--text-main); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
#theme-toggle:hover { transform: rotate(15deg); border-color: var(--primary); }

/* --- Cards & Layout --- */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow); margin-bottom: 30px; border: 1px solid var(--border); position: relative; overflow: hidden; }

/* --- Hero Section --- */
.hero-card { text-align: center; }
.hero-card h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 10px; background: linear-gradient(to right, var(--primary), var(--secondary)); -webkit-background-clip: text; color: transparent; }
.subtitle { color: var(--text-sub); margin-bottom: 30px; font-size: 1.05rem; }

/* --- Drop Zone --- */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 50px 20px; cursor: pointer; transition: 0.3s; background: rgba(0,0,0,0.01); position: relative; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: rgba(79, 70, 229, 0.04); transform: scale(1.01); }
.icon-container { font-size: 3.5rem; color: var(--primary); margin-bottom: 15px; }
.supported-formats { display: flex; justify-content: center; gap: 10px; margin-top: 15px; }
.supported-formats span { font-size: 0.75rem; font-weight: 700; background: var(--border); color: var(--text-sub); padding: 4px 10px; border-radius: 4px; }

/* --- File Info --- */
.file-info { display: flex; align-items: center; background: var(--bg); padding: 12px; border-radius: 12px; margin-top: 25px; border: 1px solid var(--border); }
.preview-wrapper img { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; }
.info-text { flex-grow: 1; padding: 0 15px; text-align: left; display: flex; flex-direction: column; }
#file-name { font-weight: 600; font-size: 0.95rem; }
.badge-gray { font-size: 0.75rem; color: var(--text-sub); text-transform: uppercase; }
.icon-btn { background: transparent; border: none; color: #ef4444; cursor: pointer; font-size: 1.1rem; padding: 8px; border-radius: 8px; transition: 0.2s; }
.icon-btn:hover { background: rgba(239, 68, 68, 0.1); }

/* --- Controls --- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; }
@media(max-width: 600px) { .settings-grid { grid-template-columns: 1fr; } }
.control-group label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 0.9rem; color: var(--text-sub); }
.control-group label i { color: var(--primary); margin-right: 5px; }
.select-wrapper select { width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text-main); font-size: 0.95rem; cursor: pointer; }

/* Range Slider */
input[type=range] { width: 100%; height: 6px; background: var(--border); border-radius: 5px; outline: none; -webkit-appearance: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--primary); border-radius: 50%; cursor: pointer; box-shadow: 0 0 10px var(--primary-glow); transition: 0.2s; }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.highlight-text { color: var(--primary); font-weight: 800; float: right; }

/* Intent Message */
.intent-msg { background: rgba(16, 185, 129, 0.1); color: var(--success); padding: 12px; border-radius: 10px; font-size: 0.9rem; margin-bottom: 20px; text-align: center; border: 1px solid rgba(16, 185, 129, 0.2); }

/* Buttons */
.btn-primary { width: 100%; padding: 16px; background: linear-gradient(135deg, var(--primary), #4338ca); color: white; border: none; border-radius: 14px; font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: 0.3s; display: flex; justify-content: center; align-items: center; gap: 10px; box-shadow: 0 10px 20px -5px var(--primary-glow); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 15px 25px -5px var(--primary-glow); }

/* --- Result Section --- */
.success-header { text-align: center; margin-bottom: 20px; }
.checkmark-circle { width: 60px; height: 60px; background: var(--success); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; margin: 0 auto 15px auto; box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4); animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.comparison-box { display: flex; justify-content: center; align-items: center; gap: 30px; background: var(--bg); padding: 20px; border-radius: 15px; margin-bottom: 25px; }
.comp-col { display: flex; flex-direction: column; text-align: center; }
.comp-col .lbl { font-size: 0.8rem; color: var(--text-sub); text-transform: uppercase; letter-spacing: 1px; }
.comp-col .val { font-weight: 800; font-size: 1.2rem; }
.val-green { color: var(--success); }
.comp-arrow { color: var(--text-sub); font-size: 1.2rem; }
.final-preview-box img { max-width: 100%; max-height: 250px; border-radius: 10px; margin-bottom: 25px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.btn-download { display: flex; justify-content: center; align-items: center; width: 100%; padding: 16px; background: var(--success); color: white; border-radius: 14px; font-weight: 700; margin-bottom: 15px; gap: 10px; box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.3); }
.btn-download:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-secondary { background: none; border: none; color: var(--text-sub); text-decoration: underline; cursor: pointer; font-size: 0.9rem; }

/* --- Timeline Section --- */
.info-section { margin: 50px 0; }
.section-title { text-align: center; margin-bottom: 40px; font-size: 1.8rem; font-weight: 700; }
.timeline { display: flex; justify-content: space-between; position: relative; gap: 20px; }
@media(max-width: 600px) { .timeline { flex-direction: column; padding-left: 20px; border-left: 2px solid var(--border); } }
.timeline-item { flex: 1; text-align: center; position: relative; padding: 10px; }
@media(max-width: 600px) { .timeline-item { text-align: left; padding-left: 30px; } }
.timeline-icon { width: 50px; height: 50px; background: var(--card-bg); border: 2px solid var(--primary); color: var(--primary); border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; margin: 0 auto 15px auto; z-index: 2; position: relative; }
@media(max-width: 600px) { .timeline-icon { position: absolute; left: -27px; top: 0; } }
.timeline-content h3 { font-size: 1.1rem; margin-bottom: 8px; }
.timeline-content p { font-size: 0.9rem; color: var(--text-sub); }

/* --- FAQ Section --- */
.faq-section { margin-bottom: 60px; }
.faq-container { max-width: 100%; }
.faq-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 15px; overflow: hidden; transition: 0.3s; }
.faq-question { padding: 20px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 600; font-size: 1rem; }
.faq-question i { color: var(--primary); transition: 0.3s; }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding: 0 20px; background: var(--bg); }
.faq-answer p { padding: 15px 0; color: var(--text-sub); font-size: 0.95rem; }

/* FAQ Active State */
.faq-item.active { border-color: var(--primary); box-shadow: var(--shadow); }
.faq-item.active .faq-question i { transform: rotate(45deg); color: var(--secondary); }
.faq-item.active .faq-answer { max-height: 200px; }

/* --- Footer --- */
footer { background: var(--card-bg); padding: 40px 0; border-top: 1px solid var(--border); text-align: center; margin-top: 60px; }
.footer-content p { color: var(--text-sub); font-size: 0.95rem; margin-bottom: 15px; }
.footer-content strong { color: var(--text-main); }
.footer-content a { color: var(--primary); font-weight: 600; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; margin-top: 10px; }
.footer-links a { color: var(--text-sub); font-size: 0.85rem; font-weight: 400; }
.footer-links a:hover { color: var(--primary); }

/* --- Loader --- */
.loader-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 1000; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; }
.spinner-box { width: 60px; height: 60px; display: flex; justify-content: center; align-items: center; position: relative; }
.circle-border { width: 100%; height: 100%; border: 4px solid transparent; border-top: 4px solid #fff; border-right: 4px solid #fff; border-radius: 50%; animation: spin 1s linear infinite; }
.loader-text { margin-top: 20px; font-weight: 600; letter-spacing: 1px; animation: pulse 1.5s infinite; }

/* --- Animations --- */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }
@keyframes popIn { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.slide-up { animation: fadeInUp 0.5s ease-out forwards; }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.pulsate { animation: pulse 2s infinite ease-in-out; }

/* --- New Stats Banner Styles --- */
.stats-banner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), #4338ca);
    padding: 30px 20px;
    border-radius: var(--radius);
    color: white;
    margin-bottom: 60px; /* Space before "How it Works" */
    box-shadow: 0 15px 30px -10px var(--primary-glow);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

/* Add a subtle shine effect behind the numbers */
.stats-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.stat-icon-bg {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
    font-weight: 500;
}

.stat-divider-vertical {
    width: 1px;
    height: 60px;
    background: rgba(255,255,255,0.3);
}

/* Mobile Responsiveness for Stats */
@media (max-width: 600px) {
    .stats-banner {
        flex-direction: column;
        gap: 30px;
        text-align: left;
        align-items: flex-start;
        padding: 30px;
    }
    
    .stat-divider-vertical {
        width: 100%;
        height: 1px;
    }
}


/* --- Enhanced SEO Article Styling --- */
.seo-article {
    margin: 80px 0;
    padding: 40px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.seo-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 50px;
}

.seo-header h2 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 20px;
    line-height: 1.3;
}

.lead-text {
    font-size: 1.1rem;
    color: var(--text-sub);
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.seo-feature h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.seo-feature p {
    font-size: 0.95rem;
    color: var(--text-sub);
    line-height: 1.7;
}

.seo-footer-note {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
    text-align: center;
    color: var(--text-sub);
    font-size: 0.9rem;
}

/* Backlink highlight style */
.seo-article strong {
    color: var(--text-main);
    border-bottom: 2px solid var(--primary-glow);
}

/* --- Timeline Animation & Effects --- */
.timeline {
    display: flex;
    justify-content: space-between;
    position: relative;
    gap: 20px;
    padding: 20px 0;
}

/* The Animated Connecting Line */
.timeline::before {
    content: '';
    position: absolute;
    top: 45px; /* Centers with the icons */
    left: 10%;
    width: 80%;
    height: 2px;
    background: linear-gradient(to right, var(--primary), var(--secondary), var(--success));
    z-index: 1;
    opacity: 0.3;
}

.timeline-item {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 2;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.timeline-item:hover {
    transform: translateY(-10px);
}

/* Icon Pulse Animations */
.timeline-icon {
    width: 60px;
    height: 60px;
    background: var(--card-bg);
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    margin: 0 auto 20px;
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    transition: 0.3s;
}

.pulse-blue { animation: pulse-blue 2s infinite; }
.pulse-purple { border-color: var(--secondary); color: var(--secondary); animation: pulse-purple 2s infinite; }
.pulse-green { border-color: var(--success); color: var(--success); animation: pulse-green 2s infinite; }

@keyframes pulse-blue { 0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(79, 70, 229, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); } }
@keyframes pulse-purple { 0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(236, 72, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); } }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* Staggered Entrance Animation */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    animation: revealIn 0.8s ease forwards;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

@keyframes revealIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Fix */
@media (max-width: 600px) {
    .timeline::before { display: none; }
    .timeline { flex-direction: column; gap: 40px; }
    .timeline-item { text-align: center; }
}

/* Layout for multiple files in the upload section */
.file-info-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Row style for each result */
.result-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.result-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.result-preview-sm {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.batch-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: center;
}

#download-all-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Container for the previews before conversion */
#file-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
}

/* Make sure the file-info rows look clean */
.file-info {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    animation: slideIn 0.3s ease-out;
}

.preview-wrapper img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
}
.remove-file-btn {
    background: rgba(255, 0, 0, 0.1);
    color: #ff4d4d;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    margin-left: auto;
}

.remove-file-btn:hover {
    background: #ff4d4d;
    color: white;
}

/* Ensure the result items have space */
.result-item-row {
    margin-bottom: 15px;
    border-left: 4px solid var(--primary);
}

.limit-exceeded {
    border: 2px solid #ff4d4d !important;
    background: rgba(255, 77, 77, 0.05) !important;
}

.badge-red {
    background: #ff4d4d;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.no-preview {
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-preview::after {
    content: '\f1c5';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #ccc;
}

/* Make the download button big and easy to see */
.action-download-btn {
    display: flex;
    flex-direction: column; /* Icon on top, Text on bottom */
    align-items: center;
    justify-content: center;
    background: var(--primary); /* Use your primary brand color */
    color: white !important;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
    min-width: 100px;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2); /* Soft glow */
}

/* Make the icon specifically larger */
.action-download-btn i {
    font-size: 1.5rem; /* Large icon size */
}

/* Add a small text label below the icon */
.action-download-btn span {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hover effect to make it interactive */
.action-download-btn:hover {
    transform: translateY(-3px);
    background: var(--primary-dark); /* Slightly darker shade on hover */
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

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

/* Responsive fix for smaller screens */
@media (max-width: 480px) {
    .result-item-row {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .result-item-info {
        flex-direction: column;
    }
    .action-download-btn {
        width: 100%;
    }
}

/* Ensure the row handles long names and keeps buttons visible */
.file-info.mobile-optimized {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    gap: 15px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.file-info .info-text {
    flex: 1;
    min-width: 0; /* Critical for text-overflow to work */
}

.file-info .file-name {
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Adds '...' to long filenames */
    margin-bottom: 4px;
}

/* BIG DELETE BUTTON FOR MOBILE */
.remove-file-btn {
    width: 44px; /* Large touch area */
    height: 44px;
    flex-shrink: 0; /* Prevents button from squishing */
    background: rgba(255, 77, 77, 0.1);
    color: #ff4d4d;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.remove-file-btn:hover {
    background: #ff4d4d;
    color: white;
}

.remove-file-btn:active {
    transform: scale(0.9); /* Feedback on touch */
}

/* Adjustments for narrow mobile screens */
@media (max-width: 400px) {
    .file-info.mobile-optimized {
        padding: 8px;
        gap: 10px;
    }
    .preview-wrapper {
        width: 40px;
        height: 40px;
    }
}