/* ===== CSS RESET & BASE STYLES ===== */
:root {
    /* Light Theme Variables */
    --bg-color: #f8f9fa;
    --text-color: #333333;
    --card-color: #ffffff;
    --primary-color: #1a73e8;
    --secondary-color: #6c5ce7;
    --success-color: #27ae60;
    --warning-color: #e67e22;
    --error-color: #e74c3c;
    --spellcheck-color: #dc3545;
    --border-color: #e0e0e0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --transition: all 0.3s ease;
    --guide-bg: #eef2f7;
    --nav-bg: #ffffff;
    --footer-bg: #f1f3f4;
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --card-color: #1e1e1e;
    --primary-color: #4285f4;
    --secondary-color: #7b68ee;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --spellcheck-color: #ff6b6b;
    --border-color: #444444;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    --guide-bg: #252a33;
    --nav-bg: #1a1a1a;
    --footer-bg: #0d0d0d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== NAVIGATION ===== */
.navbar {
    background-color: var(--nav-bg);
    padding: 15px 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 22px;
    gap: 12px;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.9;
}

#tool-logo {
    height: 42px;
    width: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 25px;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(66, 133, 244, 0.1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* Theme Toggle Button */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    height: 40px;
}

.theme-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ===== MAIN CONTENT ===== */
.main-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    flex: 1;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.hero-title {
    font-size: 2.8rem;
    margin-bottom: 15px;
    color: var(--primary-color);
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

/* Tool Card */
.tool-card {
    background-color: var(--card-color);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h2 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.tool-header p {
    color: var(--text-color);
    opacity: 0.8;
}

/* Red Underline for Spellcheck - Enhanced for ALL Browsers */
.red-underline {
    color: var(--spellcheck-color);
    font-weight: bold;
    position: relative;
    display: inline-block;
}

.red-underline::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background-color: var(--spellcheck-color);
    animation: underline-pulse 2s infinite;
}

@keyframes underline-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Text Area with Enhanced Spellcheck */
.textarea-wrapper {
    width: 100%;
    position: relative;
    margin: 25px 0;
}

#mainInput {
    width: 100%;
    min-height: 300px;
    padding: 25px;
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--card-color);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    resize: vertical;
    transition: var(--transition);
    font-family: 'Consolas', 'Monaco', monospace;
    
    /* Enhanced spellcheck styling */
    spellcheck: true;
    -webkit-spellcheck: true;
    -moz-spellcheck: true;
    -ms-spellcheck: true;
}

/* Force red underline for spell errors in all browsers */
#mainInput[spellcheck="true"] {
    text-decoration-color: var(--spellcheck-color) !important;
}

#mainInput:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.spellcheck-info {
    font-size: 13px;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 8px;
    text-align: center;
    padding: 8px;
    background-color: var(--guide-bg);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.preview-label {
    display: none;
    background-color: var(--warning-color);
    color: white;
    padding: 8px 15px;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin: 25px 0;
    padding: 20px;
    background-color: var(--guide-bg);
    border-radius: var(--radius);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.7;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Button Group */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 30px 0;
}

button {
    padding: 14px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 18px;
}

.btn-action {
    background-color: var(--primary-color);
    color: white;
}

.btn-action:hover {
    background-color: var(--secondary-color);
}

.btn-copy {
    background-color: var(--success-color);
    color: white;
}

.btn-copy:hover {
    background-color: #229954;
}

.btn-preview {
    background-color: var(--warning-color);
    color: white;
}

.btn-preview:hover {
    background-color: #d68910;
}

.btn-clear {
    background-color: var(--error-color);
    color: white;
}

.btn-clear:hover {
    background-color: #c0392b;
}

/* Quick Tips */
.quick-tips {
    background-color: var(--guide-bg);
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 30px;
}

.quick-tips h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.quick-tips ul {
    list-style: none;
    padding-left: 0;
}

.quick-tips li {
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-tips li::before {
    content: "✓";
    color: var(--success-color);
    font-weight: bold;
}

/* Features Section */
.features-section {
    margin: 60px 0;
}

.features-section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.2rem;
    color: var(--primary-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-card {
    background-color: var(--card-color);
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.feature-card p {
    color: var(--text-color);
    opacity: 0.8;
}

/* SEO Content */
.seo-content {
    margin: 60px 0;
    padding: 40px;
    background-color: var(--card-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.seo-content h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.seo-content h2 {
    color: var(--primary-color);
    margin: 30px 0 15px;
    font-size: 1.8rem;
}

.seo-content h3 {
    color: var(--secondary-color);
    margin: 20px 0 10px;
    font-size: 1.4rem;
}

.seo-content p {
    margin-bottom: 15px;
    line-height: 1.7;
}

.seo-content ul {
    margin: 20px 0;
    padding-left: 20px;
}

.seo-content li {
    margin-bottom: 10px;
    padding-left: 10px;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--radius);
    margin: 60px 0;
}

.cta-section h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.cta-section p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    padding: 18px 40px;
    background-color: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 18px;
    transition: var(--transition);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: var(--secondary-color);
}

/* Disclaimer */
.disclaimer {
    text-align: center;
    padding: 20px;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* ===== FOOTER ===== */
.footer {
    background-color: var(--footer-bg);
    padding: 50px 20px 30px;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.footer-section p {
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-color);
    opacity: 0.8;
    transition: var(--transition);
    padding: 5px 0;
}

.footer-links a:hover {
    color: var(--primary-color);
    opacity: 1;
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 10px;
}

.footer-note {
    font-size: 14px;
    color: var(--primary-color) !important;
    opacity: 0.9 !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .tool-card {
        padding: 25px;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 100%;
        max-width: 300px;
    }
    
    .stats {
        gap: 20px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .seo-content {
        padding: 25px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    #mainInput {
        padding: 15px;
        font-size: 15px;
    }
    
    .stat-item {
        min-width: 120px;
    }
    
    .cta-section {
        padding: 40px 20px;
    }
    
    .cta-button {
        padding: 15px 30px;
        font-size: 16px;
    }
}