:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4cc9f0;
    --success-color: #4CAF50;
    --background-color: #f8f9ff;
    --text-color: #2b2d42;
    --light-gray: #edf2fb;
    --card-gradient: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    --hero-gradient: linear-gradient(135deg, #4361ee 0%, #4cc9f0 100%);
    --benefit-gradient: linear-gradient(135deg, #4361ee 0%, #3f37c9 100%);
}

/* Dark theme variables and system color hints */
:root {
    --dark-bg: #0a0a0a;
    --dark-surface: #1a1a1a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #2d2d2d;
    --primary-hover: #2563eb;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    color-scheme: light dark;
}

/* Theme overrides when [data-theme="dark"] is set on <html> */
html[data-theme="dark"] {
    --background-color: var(--dark-bg);
    --text-color: var(--text-primary);
    --primary-color: #3b82f6;
    --secondary-color: #94a3b8;
    --accent-color: #1d4ed8;
    --light-gray: #121212;
    --card-gradient: linear-gradient(135deg, #1a1a1a 0%, #151515 100%);
    --hero-gradient: linear-gradient(135deg, #0b1221 0%, #0a0f1e 100%);
    --benefit-gradient: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar Styles */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(67, 97, 238, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

html[data-theme="dark"] .navbar {
    background: rgba(10, 10, 10, 0.85);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.6);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.navbar h1 {
    font-size: 1.5rem;
    background: var(--hero-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
}

/* Improve brand contrast in dark theme */
html[data-theme="dark"] .navbar h1 {
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    color: var(--text-primary);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
}

.navbar ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.navbar a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.navbar a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: var(--hero-gradient);
    transition: width 0.3s ease;
}

.navbar a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero-section {
    padding: 8rem 0 4rem;
    text-align: center;
    background: var(--hero-gradient);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><circle cx="20" cy="30" r="1" fill="rgba(255,255,255,0.25)"/><circle cx="80" cy="60" r="1.2" fill="rgba(255,255,255,0.2)"/><circle cx="140" cy="20" r="1" fill="rgba(255,255,255,0.2)"/><circle cx="180" cy="90" r="1.4" fill="rgba(255,255,255,0.2)"/><circle cx="50" cy="120" r="1" fill="rgba(255,255,255,0.2)"/><circle cx="120" cy="140" r="1.2" fill="rgba(255,255,255,0.2)"/><circle cx="30" cy="180" r="1" fill="rgba(255,255,255,0.2)"/><circle cx="160" cy="170" r="1" fill="rgba(255,255,255,0.2)"/></svg>') repeat;
    opacity: 0.5;
    background-size: 400px 400px;
    background-position: 0 0;
    animation: starScroll 30s linear infinite, twinkle 7s ease-in-out infinite alternate;
    animation-delay: 0s, 1.2s;
    will-change: background-position;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="220" height="220" viewBox="0 0 220 220"><circle cx="40" cy="40" r="1.6" fill="rgba(255,255,255,0.15)"/><circle cx="110" cy="30" r="1.8" fill="rgba(255,255,255,0.12)"/><circle cx="200" cy="60" r="1.5" fill="rgba(255,255,255,0.12)"/><circle cx="60" cy="160" r="1.7" fill="rgba(255,255,255,0.12)"/><circle cx="150" cy="190" r="1.6" fill="rgba(255,255,255,0.12)"/></svg>') repeat;
    opacity: 0.4;
    background-size: 600px 600px;
    background-position: 0 0;
    animation: starScrollSlow 60s linear infinite, twinkle 9s ease-in-out infinite alternate;
    animation-delay: 0s, 0.6s;
    will-change: background-position;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
}

/* Upload Container */
.upload-container {
    max-width: 600px;
    margin: 2rem auto;
    position: relative;
}

.drop-zone {
    background: rgba(255, 255, 255, 0.9);
    border: 2px dashed var(--accent-color);
    border-radius: 15px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    position: relative;
}

.format-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
}

.format-controls .form-select {
    max-width: 260px;
    width: 100%;
    background-color: #ffffff;
    color: #1f2937;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

html[data-theme="dark"] .format-controls .form-select {
    background-color: #111827;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.format-label {
    font-size: 0.95rem;
    color: #374151;
}

html[data-theme="dark"] .format-label {
    color: var(--text-secondary);
}

.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

.drop-zone:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Improve visibility of drop zone text */
.drop-zone p {
    color: #1f2937; /* Dark slate for light background */
    font-weight: 600;
}

/* Hide native file input while keeping it accessible and clickable */
.drop-zone input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Dark theme drop zone for better contrast */
html[data-theme="dark"] .drop-zone {
    background: rgba(17, 24, 39, 0.9); /* slate-900 with opacity */
    border-color: var(--primary-color);
}

html[data-theme="dark"] .drop-zone p {
    color: var(--text-primary);
}

/* Benefits Section */
.benefits-section {
    padding: 4rem 0;
    background: linear-gradient(to bottom right, #ffffff, #f8f9ff);
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .benefits-section {
    background: linear-gradient(to bottom right, #0f0f0f, #121212);
}

.benefits-section::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(67,97,238,0.05)"/></svg>') repeat;
}

.benefits-section h2 {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 2rem;
    font-size: 2.2rem;
    position: relative;
}

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

.benefit-card {
    background: var(--card-gradient);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(67, 97, 238, 0.1);
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .benefit-card {
    box-shadow: var(--shadow);
    border-color: var(--border-color);
}

.benefit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--benefit-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.benefit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.15);
}

.benefit-card:hover::before {
    opacity: 1;
}

.benefit-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.benefit-card p {
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* FAQ Section */
.faq-section {
    padding: 4rem 0;
    background: white;
    position: relative;
}

html[data-theme="dark"] .faq-section {
    background: var(--dark-surface);
}

.faq-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(67,97,238,0.05)"/></svg>') repeat;
    opacity: 0.5;
}

.faq-grid {
    max-width: 800px;
    margin: 2rem auto;
    position: relative;
}

details {
    background: var(--card-gradient);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(67, 97, 238, 0.1);
    transition: all 0.3s ease;
}

details:hover {
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.1);
}

html[data-theme="dark"] details {
    box-shadow: var(--shadow);
    border-color: var(--border-color);
}

summary {
    font-weight: 600;
    margin: -1rem;
    padding: 1rem;
    color: var(--primary-color);
    position: relative;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    position: absolute;
    right: 1rem;
    transition: transform 0.3s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details[open] {
    background: white;
}

html[data-theme="dark"] details[open] {
    background: #1c1c1c;
}

details[open] summary {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(67, 97, 238, 0.1);
}

/* Features Section */
.features-section {
    padding: 4rem 0;
    background: linear-gradient(to bottom right, #f8f9ff, #ffffff);
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .features-section {
    background: linear-gradient(to bottom right, #0f0f0f, #121212);
}

.features-section::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(67,97,238,0.05)"/></svg>') repeat;
}

.features-section h2 {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 2rem;
    font-size: 2.2rem;
    position: relative;
}

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

.feature-card {
    background: var(--card-gradient);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(67, 97, 238, 0.1);
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .step,
html[data-theme="dark"] .comparison-item,
html[data-theme="dark"] .tips-grid article {
    box-shadow: var(--shadow);
    border-color: var(--border-color);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--benefit-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.15);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.feature-card p {
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Comparison Section */
.comparison-section {
    padding: 4rem 0;
    background: white;
    position: relative;
}

html[data-theme="dark"] .comparison-section {
    background: var(--dark-surface);
}

.comparison-section::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(67,97,238,0.05)"/></svg>') repeat;
    opacity: 0.5;
}

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

.comparison-item {
    background: var(--card-gradient);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.1);
    border: 1px solid rgba(67, 97, 238, 0.1);
}

.comparison-item h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.comparison-item ul {
    list-style: none;
    padding: 0;
}

.comparison-item li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.comparison-item li::before {
    content: '•';
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-size: 1.2rem;
}

/* How It Works Section */
.how-it-works-section {
    padding: 4rem 0;
    background: linear-gradient(to bottom right, #ffffff, #f8f9ff);
    position: relative;
    overflow: hidden;
}

html[data-theme="dark"] .how-it-works-section {
    background: linear-gradient(to bottom right, #0f0f0f, #121212);
}

.how-it-works-section::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(67,97,238,0.05)"/></svg>') repeat;
}

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

.step {
    text-align: center;
    padding: 2rem;
    background: var(--card-gradient);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.1);
    border: 1px solid rgba(67, 97, 238, 0.1);
    transition: transform 0.3s ease;
}

.step:hover {
    transform: translateY(-5px);
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: var(--hero-gradient);
    color: white;
    border-radius: 50%;
    line-height: 40px;
    margin-bottom: 1rem;
    font-weight: bold;
}

.step h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.step p {
    color: var(--text-color);
    font-size: 1.1rem;
}

/* Tips Section */
.tips-section {
    padding: 4rem 0;
    background: white;
}

html[data-theme="dark"] .tips-section {
    background: var(--dark-surface);
}

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

.tips-grid article {
    background: var(--light-gray);
    padding: 2rem;
    border-radius: 10px;
}

.tips-grid ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.tips-grid li {
    padding: 0.5rem 0;
    position: relative;
    padding-left: 1.5rem;
}

.tips-grid li:before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
}

/* Footer Styles */
footer {
    background: linear-gradient(to bottom, #2b2d42, #1a1b2e);
    color: #ffffff;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(255,255,255,0.03)"/></svg>') repeat;
}

.footer-content {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

footer h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

footer p, footer li {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

footer ul {
    list-style: none;
    padding: 0;
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Responsive Footer */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-section h2 {
        font-size: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .benefits-grid,
    .comparison-grid,
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

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

.feature-card, .step, .hero-section {
    animation: fadeIn 0.5s ease-in;
}

.benefit-card,
.comparison-item,
.tips-grid article {
    animation: fadeInUp 0.5s ease-out;
}

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

/* Starfield animations (background-position scrolling) */
@keyframes starScroll {
    from { background-position: 0 0; }
    to { background-position: 0 -1000px; }
}

@keyframes starScrollSlow {
    from { background-position: 0 0; }
    to { background-position: 0 -700px; }
}

/* Subtle opacity pulsing for star twinkle */
@keyframes twinkle {
    0% { opacity: 0.35; }
    50% { opacity: 0.55; }
    100% { opacity: 0.4; }
}

/* GPU-friendly rendering hints */
.benefit-card,
.feature-card,
.step,
.comparison-item,
.tips-grid article {
    will-change: transform, opacity;
}

/* SEO Enhancement Classes */
.supported-formats {
    color: var(--secondary-color);
    margin-top: 1rem;
    font-size: 0.9rem;
}

html[data-theme="dark"] .supported-formats {
    color: var(--text-secondary);
}

h1, h2, h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* Drop zone highlight state */
.drop-zone.highlight {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    color: var(--text-color);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

html[data-theme="dark"] .theme-toggle {
    border-color: var(--border-color);
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

html[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Toast message for actions */
.message {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 2000;
    pointer-events: none;
    animation: fadeIn 0.25s ease-out;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
