/* Basic Root Variables and Reset */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary: #ec4899;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --radius: 12px;
    --transition: all 0.3s ease;
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--dark-bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul,
ol {
    list-style: none;
}

/* Header */
.main-header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

/* Hero */
.hero-section {
    padding: 4rem 0 2rem;
    text-align: center;
}

h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.highlight {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

.intro-text p {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2rem;
}

/* Tool Interface */
.tool-wrapper {
    margin-top: 3rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    transition: var(--transition);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.icon-upload {
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-muted);
}

/* Editor Layout */
.tool-editor {
    display: flex;
    flex-direction: column;
    width: 100%;
    animation: fadeIn 0.4s ease;
}

.editor-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.editor-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.action-text {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    background: none;
}

.action-text:hover {
    text-decoration: underline;
}

.divider {
    color: var(--border);
}

.editor-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Preview */
.preview-container {
    background: #000;
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.img-container {
    max-width: 100%;
    max-height: 500px;
    display: flex;
}

.img-container canvas,
.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.compare-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* Controls */
.controls-panel {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Histogram */
.histogram-wrapper {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px;
    height: 70px;
    width: 100%;
}

#histogramCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.control-group h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-container {
    position: relative;
    padding: 10px 0;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -8px;
    box-shadow: 0 0 10px var(--primary-glow);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--border);
    border-radius: 2px;
}

.range-values {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.value-display {
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Suggestions */
.suggestions-row {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.suggestion-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.magic-btn {
    border-color: var(--secondary);
    color: var(--secondary);
    background: rgba(236, 72, 153, 0.1);
}

.magic-btn:hover {
    background: var(--secondary);
    color: white;
}

/* Toggles and Selects */
.toggles {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .slider-toggle {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 20px;
    position: relative;
    transition: var(--transition);
}

.toggle-switch .slider-toggle::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked+.slider-toggle {
    background: var(--primary);
}

.toggle-switch input:checked+.slider-toggle::before {
    transform: translateX(18px);
}

.select-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.mini-select {
    background: var(--dark-bg);
    color: white;
    border: 1px solid var(--border);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    outline: none;
    font-size: 0.85rem;
}

/* Primary Button */
.primary-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 20px var(--primary-glow);
}

.pulse-btn:active {
    transform: scale(0.98);
}

/* Result View */
.result-view {
    text-align: center;
    animation: fadeIn 0.4s ease;
    padding-top: 2rem;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.success-sub {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.result-display img {
    max-height: 400px;
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

.download-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.secondary-btn {
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Loader */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: var(--radius);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* === NEW ENGAGING SEO SECTION STYLES === */
.seo-content {
    background: #0f172a;
    padding: 5rem 0;
    border-top: 1px solid var(--border);
    margin-top: 6rem;
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 3rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* 1. Feature/Step Cards */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.step-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    position: relative;
    transition: var(--transition);
}

.step-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.step-num {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 15px var(--primary-glow);
}

.step-card h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.step-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* 2. Text Blocks */
.text-block-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    margin-bottom: 2rem;
}

.text-block-row.reversed {
    direction: rtl;
}

.text-block-row.reversed .text-col {
    direction: ltr;
}

.text-col h3 {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.text-col p {
    margin-bottom: 1.2rem;
    color: var(--text-muted);
    text-align: justify;
}

.keyword-highlight {
    color: var(--secondary);
    font-weight: 500;
}

.visual-col {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-box {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    color: #fff;
    font-weight: 600;
}

/* 3. Comparison Table (Enhanced) */
.comparison-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    padding: 2rem;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    text-align: left;
    padding: 1.2rem;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-table td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: middle;
}

.check-icon {
    color: var(--success);
    font-weight: bold;
}

.cross-icon {
    color: var(--secondary);
    font-weight: bold;
}

/* 4. Advanced Accordion FAQs */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

details.faq-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

details.faq-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

details.faq-card[open] {
    border-color: var(--primary);
}

details.faq-card summary {
    padding: 1.2rem;
    cursor: pointer;
    color: #fff;
    font-weight: 500;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

details.faq-card summary::-webkit-details-marker {
    display: none;
}

details.faq-card summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary);
    transition: transform 0.2s;
}

details.faq-card[open] summary::after {
    transform: rotate(45deg);
}

.faq-content {
    padding: 0 1.2rem 1.2rem;
    color: var(--text-muted);
    line-height: 1.6;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.5rem;
    padding-top: 1rem;
}

/* 5. Keyword Cloud */
.keyword-block {
    text-align: center;
    max-width: 900px;
    margin: 2rem auto 0;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.tag {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tag:hover {
    border-color: var(--secondary);
    color: #fff;
}

/* Internal Links Grid */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.tool-link-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tool-link-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

/* Footer */
.main-footer {
    background: #020617;
    padding: 4rem 0 2rem;
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-brand-col p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 1rem 0;
    max-width: 300px;
}

.social-links {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-col h4 {
    color: #fff;
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col a {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-legal-links .sep {
    margin: 0 0.5rem;
    opacity: 0.5;
}

/* Utilities */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .editor-main {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }

    .text-block-row,
    .text-block-row.reversed {
        grid-template-columns: 1fr;
        direction: ltr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        justify-content: center;
    }
}