/* =========================================
   1. VARIABLES & RESET
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    
    /* Brand Colors */
    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    
    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    
    --accent-primary: #60a5fa;
    --accent-secondary: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
}

html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; font-weight: 600; line-height: 1.2; }
.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* =========================================
   2. HEADER & NAVIGATION
   ========================================= */
.main-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: transform var(--transition-smooth);
}

.main-header.hidden { transform: translateY(-100%); }

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Logo */
.logo-link { text-decoration: none; display: flex; align-items: center; }
.logo-wrapper { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
    width: 36px; height: 36px;
    background: var(--accent-gradient);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    margin: 0;
}

.header-controls { display: flex; align-items: center; gap: 1rem; }

/* Theme Toggle */
.theme-toggle {
    width: 44px; height: 24px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: pointer; position: relative;
    transition: all var(--transition-fast);
}
.theme-toggle-inner {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    position: absolute; top: 2px; left: 2px;
    transition: transform var(--transition-base);
}
[data-theme="dark"] .theme-toggle-inner { transform: translateX(20px); background: var(--accent-primary); }

/* Hamburger */
.hamburger-menu {
    background: none; border: none; cursor: pointer; padding: 4px;
    display: none;
}
@media (max-width: 768px) { .hamburger-menu { display: block; } }

.hamburger-line {
    display: block; width: 24px; height: 2px;
    background-color: var(--text-primary);
    margin: 5px 0; transition: all 0.3s ease;
}

/* Nav */
.main-nav { display: block; }
.nav-list { display: flex; list-style: none; gap: 0.5rem; margin: 0; padding: 0; }
.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}
.nav-link:hover, .nav-link.active {
    color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

@media (max-width: 768px) {
    .main-nav {
        position: absolute; top: 100%; left: 0; right: 0;
        background-color: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        max-height: 0; overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .main-nav.active { max-height: 400px; }
    .nav-list { flex-direction: column; padding: 1rem; }
    .nav-link { display: block; padding: 0.75rem 1rem; }
}

/* =========================================
   3. HERO SECTION (Updated Animation)
   ========================================= */
.hero-section {
    padding: 8rem 1rem 5rem;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent 40%),
                radial-gradient(circle at bottom left, rgba(168, 85, 247, 0.1), transparent 40%);
    display: flex; flex-direction: column; align-items: center;
    text-align: center;
    min-height: 85vh;
    justify-content: center;
}

.hero-content { max-width: 800px; margin-bottom: 3rem; z-index: 2; }
.hero-title { font-size: 2.75rem; margin-bottom: 1.5rem; letter-spacing: -0.02em; }
.hero-subtitle {
    font-size: 1.125rem; color: var(--text-secondary);
    margin-bottom: 2.5rem; max-width: 600px; margin-left: auto; margin-right: auto;
}

.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.875rem 1.75rem;
    font-weight: 600; font-size: 1rem;
    border-radius: var(--radius-md); border: none;
    cursor: pointer; text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-primary {
    background: var(--accent-gradient); color: white;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.3);
}
.btn-secondary {
    background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn:hover { transform: translateY(-2px); }

/* Demand 2 Fix: Straight, Floating Animation */
.modern-scanner {
    width: 240px; height: 240px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center;
    /* REMOVED: transform: perspective(...) */
    animation: gentleFloat 3s ease-in-out infinite;
}

@keyframes gentleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.scanner-frame {
    width: 200px; height: 200px;
    border: 2px solid var(--accent-primary);
    border-radius: 16px; position: relative; overflow: hidden;
    background: var(--bg-secondary);
}
.scanner-qr { width: 100%; height: 100%; padding: 12px; color: var(--text-primary); }
.scanner-line {
    position: absolute; width: 100%; height: 3px;
    background: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-primary);
    top: 0; animation: scan 2.5s ease-in-out infinite;
}
@keyframes scan { 0% { top: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

/* =========================================
   4. TOOLS SECTION
   ========================================= */
.tools-section { padding: 5rem 1rem; background-color: var(--bg-secondary); }
.section-title { font-size: 2.25rem; margin-bottom: 1rem; text-align: center; }
.section-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 3rem; }

.tools-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem; max-width: 1200px; margin: 0 auto;
}

.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition-base);
    opacity: 0; transform: translateY(30px);
}
.tool-card.fade-in { animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

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

.tool-icon {
    width: 60px; height: 60px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1.5rem; color: var(--accent-primary);
    transition: all var(--transition-base);
}
.tool-card:hover .tool-icon {
    background: var(--accent-gradient);
    color: white; transform: scale(1.1);
}
.tool-icon svg { width: 32px; height: 32px; } /* Slightly larger for new icons */
.tool-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
.tool-description { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.95rem; }
.tool-link {
    color: var(--accent-primary); font-weight: 600; text-decoration: none;
    display: inline-flex; align-items: center; gap: 0.25rem;
}
.tool-link:hover { gap: 0.5rem; }

/* =========================================
   5. FAQ SECTION (Demand 3 Fix: Reverted to Simple)
   ========================================= */
.faq-section { padding: 5rem 1rem; background: var(--bg-primary); }
.faq-container { max-width: 800px; margin: 0 auto; }

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
    background-color: var(--bg-primary); /* Simple white background */
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background-color: var(--bg-primary); /* Keep it simple */
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    transition: background-color var(--transition-fast);
}

.faq-question:hover {
    background-color: var(--bg-secondary);
}

.faq-arrow {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    color: var(--text-tertiary);
}

.faq-item.active .faq-arrow {
    transform: rotate(180deg);
    color: var(--accent-primary);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background-color: var(--bg-primary); /* Same as question */
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-item.active .faq-answer {
    padding: 0 1.5rem 1.5rem 1.5rem;
    max-height: 500px;
    border-top: 1px solid transparent; /* No internal border needed */
}

/* =========================================
   6. FOOTER
   ========================================= */
.main-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 4rem 1rem 2rem;
}
.footer-middle {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 2rem; max-width: 1200px; margin: 0 auto 3rem;
    padding-bottom: 2rem; border-bottom: 1px solid var(--border-color);
}
.footer-info { max-width: 400px; }
.footer-email, .footer-address { color: var(--text-secondary); margin-bottom: 0.5rem; }
.footer-email a { color: var(--accent-primary); text-decoration: none; }

.footer-social { display: flex; gap: 1rem; }
.footer-social a {
    width: 42px; height: 42px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.footer-social a:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.footer-social svg { width: 22px; height: 22px; }

.footer-bottom { text-align: center; }
.footer-links-bottom {
    display: flex; flex-direction: row;
    justify-content: center; flex-wrap: wrap;
    gap: 1.5rem; margin-bottom: 1.5rem;
}
.footer-links-bottom a {
    color: var(--text-secondary); text-decoration: none;
    font-size: 0.9rem; font-weight: 500;
}
.footer-links-bottom a:hover { color: var(--accent-primary); }
.footer-copyright { color: var(--text-tertiary); font-size: 0.85rem; }

/* =========================================
   7. INNER PAGES
   ========================================= */
.page-hero {
    padding: 8rem 1rem 4rem;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    text-align: center;
}
.page-title { font-size: 2.5rem; margin-bottom: 1rem; }
.page-subtitle { color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

/* Tools Layout */
.tool-main { padding-top: 0; }
.tool-container { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; }
.tool-wrapper {
    display: grid; grid-template-columns: 1fr 350px;
    gap: 2rem; margin-top: 2rem;
}
@media (max-width: 900px) { .tool-wrapper { grid-template-columns: 1fr; } }

.tool-controls-section {
    background: var(--bg-primary); padding: 1.5rem;
    border-radius: var(--radius-lg); border: 1px solid var(--border-color);
}
.control-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.control-label { font-weight: 500; font-size: 0.9rem; color: var(--text-primary); }

.control-input, .control-select, .control-textarea {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit; font-size: 0.95rem;
    transition: border-color 0.2s;
}
.control-input:focus, .control-select:focus, .control-textarea:focus {
    outline: none; border-color: var(--accent-primary);
}

.tool-preview-section { position: sticky; top: 100px; }
.preview-card {
    background: var(--bg-secondary); padding: 2rem;
    border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    text-align: center;
}
.qr-preview, .barcode-preview {
    background: white; padding: 1rem; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); margin-bottom: 1.5rem;
    min-height: 200px; display: flex; align-items: center; justify-content: center;
}
.preview-controls { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* Contact Page Grid */
.contact-section { padding: 4rem 1rem; max-width: 1200px; margin: 0 auto; }
.contact-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4rem;
}
@media (max-width: 768px) { .contact-grid { grid-template-columns: 1fr; gap: 2rem; } }

.contact-item { margin-bottom: 1.5rem; }
.contact-item h3 { color: var(--accent-primary); font-size: 1.1rem; margin-bottom: 0.5rem; }
.social-links { display: flex; flex-direction: column; gap: 0.75rem; }
.social-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem; background: var(--bg-secondary);
    border-radius: var(--radius-md); text-decoration: none; color: var(--text-primary);
    transition: background 0.2s;
}
.social-link:hover { background: var(--border-color); }
.social-link svg { width: 20px; height: 20px; }

/* Contact Form Specifics */
.contact-form-container {
    background: var(--bg-primary); padding: 2rem;
    border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}
.control-textarea { min-height: 120px; resize: vertical; }

/* About & Legal Pages */
.about-content, .legal-content { max-width: 800px; margin: 0 auto; padding: 4rem 1rem; }
.about-section h2, .policy-section h2 { margin-bottom: 1rem; color: var(--accent-primary); }
.about-section p, .policy-section p { margin-bottom: 1.5rem; color: var(--text-secondary); }
.features-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem; margin-top: 2rem;
}
.feature-card {
    background: var(--bg-secondary); padding: 1.5rem;
    border-radius: var(--radius-md); border: 1px solid var(--border-color);
}
.tech-list li {
    margin-bottom: 0.5rem; padding-left: 1.5rem; position: relative;
}
.tech-list li::before {
    content: '→'; position: absolute; left: 0; color: var(--accent-primary);
}

/* Color Picker & Sliders */
.color-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.color-picker { width: 100%; height: 40px; border: none; cursor: pointer; background: none; }
.control-range { width: 100%; margin: 1rem 0; cursor: pointer; }

/* Responsive General */
@media (max-width: 600px) {
    .hero-title { font-size: 2rem; }
    .header-container { padding: 0.75rem; }
    .tools-grid { grid-template-columns: 1fr; }
    .footer-middle { flex-direction: column; text-align: center; }
}