:root {
    /* Bright Theme Variables */
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --card-bg: #ffffff;
    --primary-color: #3b82f6;
    --secondary-color: #1e40af;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ad-bg: #e2e8f0;
    --ad-text: #64748b;
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: #1e293b;
    --primary-color: #60a5fa;
    --secondary-color: #93c5fd;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --ad-bg: #334155;
    --ad-text: #94a3b8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Navbar */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-color);
}

.logo img {
    height: 40px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
}

.logo span {
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

#theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

#theme-toggle:hover {
    color: var(--primary-color);
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero */
.hero {
    padding: 5rem 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-bottom: 1px solid var(--border-color);
}

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

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: -webkit-linear-gradient(45deg, var(--primary-color), #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}

.search-bar {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    border-radius: 8px;
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.search-bar button {
    padding: 0 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-bar button:hover {
    background-color: var(--secondary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem 0;
}

.section-title {
    margin-bottom: 2rem;
    font-size: 2rem;
    text-align: center;
}

/* Ad Placeholders */
.ad-placeholder {
    background-color: var(--ad-bg);
    color: var(--ad-text);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem auto;
    border-radius: 4px;
    font-size: 0.9rem;
    border: 1px dashed var(--border-color);
}

.adsense-leaderboard, #ad-top-banner, #ad-bottom-banner {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 2rem auto;
}

#ad-sidebar {
    width: 300px;
    height: 250px;
    margin: 1rem auto;
}

.ad-video-manager {
    width: 100%;
    max-width: 640px;
    height: 360px;
    background-color: #000;
    color: #fff;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.tool-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.tool-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tool-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1rem;
    margin-top: auto;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-color);
    opacity: 0.8;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-weight: 600;
}

.footer-bottom p {
    color: #ef4444; /* Heart color context */
}

/* Tool Page Specific */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-interface {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto 3rem;
    box-shadow: var(--shadow);
}

.file-input-wrapper {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 1.5rem;
    position: relative;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-input-wrapper:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.tool-options {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tool-options label {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-options input[type="number"], .tool-options input[type="range"] {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
    width: 100%;
    display: block;
    text-align: center;
    text-decoration: none;
}

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

.btn-primary:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.seo-content {
    max-width: 800px;
    margin: 0 auto;
}

.seo-content h2, .seo-content h3 {
    margin: 1.5rem 0 1rem;
    color: var(--primary-color);
}

.seo-content p {
    margin-bottom: 1rem;
}

.seo-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

/* Overlay & Delay Loader */
.delay-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 2000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.delay-overlay.active {
    display: flex;
}

.loader {
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.delay-overlay h2 {
    margin-bottom: 1rem;
}

.delay-overlay p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Static Pages */
.static-page-content {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--card-bg);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.static-page-content h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.static-page-content h2 {
    margin: 1.5rem 0 1rem;
}

.static-page-content p {
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        padding: 1rem 0;
        box-shadow: var(--shadow);
    }
    .nav-links.active {
        display: flex;
    }
    .hamburger {
        display: block;
    }
    .hero h1 {
        font-size: 2rem;
    }
}

/* New styles for Batch Processing and Previews */
.drop-zone {
    width: 100%;
    min-height: 200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--primary-color);
    border-radius: 12px;
    background: rgba(var(--primary-color-rgb), 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    margin-bottom: 1.5rem;
}

.drop-zone:hover, .drop-zone.drag-over {
    background: rgba(var(--primary-color-rgb), 0.1);
    border-color: var(--secondary-color);
    transform: scale(1.01);
}

.drop-zone i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.file-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    width: 100%;
}

.file-preview-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.3s ease forwards;
}

.file-preview-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.file-preview-card .file-info {
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-card .remove-file {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* Lazy Loading Animation */
.tool-card {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Media Queries --- */

/* Tablets and small desktops */
@media (max-width: 1024px) {
    .container {
        width: 92%;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        padding: 1.5rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        border-bottom: 1px solid var(--border-color);
        gap: 1.5rem;
        z-index: 1001;
    }

    .nav-links.active {
        display: flex;
    }

    .hamburger {
        display: block;
        padding: 0.5rem;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 1.8rem;
        padding: 0 1rem;
    }

    .hero p {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .search-bar {
        width: 95%;
        max-width: 100%;
    }

    .search-bar input {
        padding: 0.8rem 1rem;
    }

    .category-filters {
        padding: 0 0.5rem;
        overflow-x: auto;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Hide scrollbar for Firefox */
    }

    .category-filters::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome/Safari */
    }

    .filter-btn {
        flex: 0 0 auto;
    }

    .main-content {
        padding: 2rem 0;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 1rem;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .tool-icon {
        font-size: 2.5rem;
    }

    .tool-interface {
        padding: 1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .static-page-content {
        padding: 1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-links ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .adsense-leaderboard {
        height: auto;
        min-height: 50px;
    }

    .ad-video-manager {
        height: 200px;
    }

    /* Batch Processing */
    .file-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    /* Tool Specific */
    .tool-options {
        gap: 0.8rem;
    }
    
    .reader-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .reader-controls button {
        width: 100%;
    }

    /* Specific Section Improvements */
    .developer-section {
        padding: 1.5rem !important;
        margin-top: 2rem !important;
    }

    .developer-section img {
        width: 150px !important;
        height: 150px !important;
    }

    .social-links, .footer-social div {
        flex-wrap: wrap;
        gap: 1rem !important;
    }

    form {
        gap: 0.8rem !important;
    }

    form button {
        max-width: 100% !important;
    }

    /* Handle 2-column grids on mobile for tool options */
    .tool-interface div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .tool-options input, .tool-options select, .tool-options textarea {
        width: 100% !important;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo img {
        height: 32px;
    }
}

/* Accessibility and Smoothness */
html {
    scroll-behavior: smooth;
}

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

/* SEO Content Enhancements */
.seo-section {
    padding: 4rem 0;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid var(--border-color);
}

.seo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
    margin-top: 2rem;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.3);
}

.input-tabs {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    opacity: 1;
    box-shadow: 0 4px 10px rgba(var(--primary-color-rgb), 0.2);
}

.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

.file-icon-placeholder {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loader-mini {
    border: 3px solid rgba(0,0,0,0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
