/* ==========================================================================
   Base Variables & Theming
   ========================================================================== */
:root {
    /* Light Mode */
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --nav-bg: #ffffff;
    --primary-color: #4361ee;
    --primary-hover: #3a53d0;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --error-bg: #fdf0ef;
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-color: #121212;
    --text-color: #f8f9fa;
    --nav-bg: #1e1e1e;
    --primary-color: #4cc9f0;
    --primary-hover: #3ab0d3;
    --card-bg: #242424;
    --border-color: #333333;
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
    --error-bg: #4a1915;
}

.articles-section, .faq-section {
    padding: clamp(2rem, 5vw, 4rem) 5%;
    max-width: 1000px;
    margin: 0 auto;
}

h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1.5rem; text-align: center; }
.section-subtitle { text-align: center; margin-bottom: 3rem; opacity: 0.8; font-size: 1.1rem; }

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

.article-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}
.article-card h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.article-card p { opacity: 0.8; font-size: 0.95rem; margin-bottom: 1.5rem; flex-grow: 1; }
.read-more { color: var(--primary-color); font-weight: 600; font-size: 0.9rem; margin-top: auto; }
.view-all-container { text-align: center; margin-top: 3rem; }

/* Base Reset & Global Styles */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { background-color: var(--bg-color); color: var(--text-color); transition: var(--transition); line-height: 1.6; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; }

/* Utility Classes */
.hidden { display: none !important; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.w-100 { width: 100%; }
.font-bold { font-weight: bold; }
.trust-badge { font-size: 0.85rem; opacity: 0.8; color: var(--success-color); }
.justify-center { justify-content: center !important; }

/* Navigation */
header { background-color: var(--nav-bg); box-shadow: var(--shadow); position: relative; z-index: 100; transition: var(--transition); }
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 5%; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.logo { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: bold; text-decoration: none; color: var(--text-color); white-space: nowrap; }
.logo span { color: var(--primary-color); }
.nav-links { list-style: none; display: flex; align-items: center; gap: clamp(1rem, 2vw, 2rem); }
.nav-links a { text-decoration: none; color: var(--text-color); font-weight: 500; font-size: 1rem; transition: var(--transition); }
.nav-links a:hover { color: var(--primary-color); }
.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); background-color: var(--card-bg); min-width: 180px; box-shadow: var(--shadow); border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); z-index: 10; }
.dropdown-content a { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border-color); text-align: center; }
.dropdown-content a:last-child { border-bottom: none; }
.dropdown-content a:hover { background-color: var(--bg-color); }
.dropdown:hover .dropdown-content, .dropdown:focus-within .dropdown-content { display: block; animation: fadeIn 0.2s ease; }
#theme-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 8px; border-radius: 50%; transition: var(--transition); color: var(--text-color); }
#theme-toggle:hover { background-color: var(--border-color); }

/* Buttons */
.btn { padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: bold; display: inline-flex; align-items: center; justify-content: center; transition: var(--transition); width: auto; cursor: pointer; border: none; font-size: 1rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.primary-btn { background-color: var(--primary-color); color: #fff; }
.primary-btn:hover:not(:disabled) { background-color: var(--primary-hover); transform: translateY(-2px); }
.secondary-btn { background-color: transparent; color: var(--text-color); border: 2px solid var(--border-color); }
.secondary-btn:hover:not(:disabled) { border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-2px); }

/* Layouts */
.hero { text-align: center; padding: clamp(2rem, 8vw, 4rem) 5% 1rem; max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 1rem; }
.hero p { font-size: clamp(1rem, 2.5vw, 1.2rem); opacity: 0.8; margin-bottom: 2rem; }
.about-section, .tools-section, .faq-section { padding: clamp(2rem, 5vw, 4rem) 5%; max-width: 1000px; margin: 0 auto; }

/* ==========================================================================
   Tool Specific Styles
   ========================================================================== */
.tool-interface { padding: 0 5% 3rem; max-width: 900px; margin: 0 auto; }
.tool-container { background-color: var(--card-bg); padding: clamp(1.5rem, 4vw, 3rem); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }

/* Upload Area */
.upload-area { border: 2px dashed var(--primary-color); border-radius: 12px; padding: 3rem 1rem; text-align: center; cursor: pointer; transition: var(--transition); background-color: rgba(67, 97, 238, 0.03); outline: none; }
.upload-area:hover, .upload-area:focus { background-color: rgba(67, 97, 238, 0.08); border-color: var(--primary-hover); }
.upload-area.drag-over { background-color: rgba(67, 97, 238, 0.15); transform: scale(1.02); }
.upload-icon { font-size: 4rem; margin-bottom: 1rem; }
.hidden-input { display: none; }

/* Settings Area */
.settings-area, .output-area { animation: fadeIn 0.4s ease; }
.file-info { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background-color: var(--bg-color); border-radius: 8px; margin-bottom: 2rem; border: 1px solid var(--border-color); }
.badge { background-color: var(--primary-color); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; }

.settings-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2rem; }
@media (min-width: 768px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.setting-group { display: flex; flex-direction: column; gap: 0.5rem; }
.setting-group label { font-weight: 600; display: flex; justify-content: space-between; }

.setting-group input[type="text"], 
.setting-group select { padding: 10px 15px; border: 1px solid var(--border-color); border-radius: 6px; background-color: var(--bg-color); color: var(--text-color); font-size: 1rem; }
.setting-group input[type="text"]:focus,
.setting-group select:focus { border-color: var(--primary-color); outline: none; }
.setting-group small { font-size: 0.85rem; opacity: 0.7; }
.setting-group input[type="range"] { width: 100%; cursor: pointer; accent-color: var(--primary-color); }

/* Errors & Progress */
.error-message { background-color: var(--error-bg); color: var(--error-color); padding: 1rem; border-radius: 8px; border: 1px solid var(--error-color); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 10px; }
.error-message::before { content: "⚠️"; font-size: 1.2rem; }
.progress-container { margin-top: 1.5rem; text-align: center; }
.progress-bar-bg { width: 100%; height: 12px; background-color: var(--border-color); border-radius: 6px; overflow: hidden; margin-top: 0.5rem; }
.progress-bar-fill { height: 100%; width: 0%; background-color: var(--primary-color); transition: width 0.3s ease; }
.action-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Steps Section & Grids */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-top: 2rem; }
.step-card { background-color: var(--card-bg); padding: 2rem; border-radius: 12px; border: 1px solid var(--border-color); text-align: center; box-shadow: var(--shadow); }
.step-number { width: 40px; height: 40px; background-color: var(--primary-color); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: bold; margin: 0 auto 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.tool-card { background-color: var(--card-bg); padding: 2rem; border-radius: 12px; color: var(--text-color); box-shadow: var(--shadow); border: 1px solid var(--border-color); display: flex; flex-direction: column; text-align: center; }
.card-icon { font-size: 3rem; margin-bottom: 1rem; }

/* FAQ Section */
.faq-container { display: flex; flex-direction: column; gap: 1rem; }
.faq-item { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.faq-question { width: 100%; text-align: left; padding: 1.5rem; background: none; border: none; color: var(--text-color); font-size: clamp(1rem, 2.5vw, 1.1rem); font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.faq-question::after { content: '+'; font-size: 1.5rem; transition: transform 0.3s ease; flex-shrink: 0; margin-left: 1rem; }
.faq-item.active .faq-question::after { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding: 0 1.5rem; opacity: 0; }
.faq-item.active .faq-answer { max-height: 500px; padding-bottom: 1.5rem; opacity: 1; transition: max-height 0.4s ease-in, opacity 0.4s ease-in; }

/* Footer */
.trust-footer { text-align: center; padding: 3rem 5% 2rem; margin-top: 4rem; border-top: 1px solid var(--border-color); background-color: var(--card-bg); }
.footer-links { display: flex; justify-content: center; gap: clamp(1rem, 3vw, 2rem); margin-bottom: 1.5rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-color); text-decoration: none; font-weight: 500; opacity: 0.8; transition: var(--transition); }
.footer-links a:hover { opacity: 1; color: var(--primary-color); }
.footer-copy { opacity: 0.6; font-size: 0.9rem; }

/* ==========================================================================
   Ad Banner Containers (Mobile Optimized)
   ========================================================================== */
.ad-container {
    width: 100%;
    max-width: 1000px; 
    margin: 2rem auto; /* The 'auto' keeps it perfectly centered */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.ad-container img, 
.ad-container video {
    max-width: 100%;
    max-height: 200px; /* Prevents the ad from getting too tall and covering the screen */
    height: auto;
    border-radius: 8px;
    display: block;
    object-fit: contain; /* Ensures the image doesn't stretch weirdly */
}

/* Media Queries */
@media (max-width: 768px) {
    .navbar { padding: 1rem 5%; }
    .nav-links { order: 3; width: 100%; margin-top: 1rem; justify-content: center; flex-wrap: wrap; }
    #theme-toggle { margin-left: auto; }
    .dropdown-content { left: 0; transform: none; }
    .action-buttons { flex-direction: column; }
    .action-buttons .btn { width: 100%; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.8s ease forwards; }