/* ===================================
   DiffText. - Text Comparison Tool
   Styles
   =================================== */

/* ===================================
   CSS Variables / Themes
   =================================== */

/* Light theme (default) */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fc;
    --bg-tertiary: #f1f3f8;
    --bg-hover: #e8ebf2;
    --border: #e2e5ed;
    --border-focus: #c9cdd8;
    --text-primary: #1a1a2e;
    --text-secondary: #5c5c7a;
    --text-muted: #8989a3;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.12);
    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.1);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.1);
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --bg-gradient-1: rgba(99, 102, 241, 0.08);
    --bg-gradient-2: rgba(139, 92, 246, 0.05);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-tertiary: #18181b;
    --bg-hover: #27272a;
    --border: #27272a;
    --border-focus: #3f3f46;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --bg-gradient-1: rgba(99, 102, 241, 0.15);
    --bg-gradient-2: rgba(139, 92, 246, 0.1);
}

/* ===================================
   Base Styles
   =================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme change */
.editor-panel,
.stat-card,
.diff-panel,
.options,
.btn-secondary,
.icon-btn,
.editor-header {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ===================================
   Background Gradient
   =================================== */

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, var(--bg-gradient-1), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, var(--bg-gradient-2), transparent);
    pointer-events: none;
    z-index: 0;
    transition: background 0.3s ease;
}

/* ===================================
   Theme Toggle
   =================================== */

.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-toggle .icon {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.theme-toggle .sun-icon {
    position: absolute;
    transform: translateY(30px);
    opacity: 0;
}

.theme-toggle .moon-icon {
    transform: translateY(0);
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    transform: translateY(0);
    opacity: 1;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    transform: translateY(-30px);
    opacity: 0;
}

/* ===================================
   Layout
   =================================== */

.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
}

/* ===================================
   Header
   =================================== */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 48px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 30px var(--accent-glow);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 span {
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-focus);
    color: var(--text-primary);
}

/* ===================================
   Hero Section
   =================================== */

.hero {
    text-align: center;
    margin-bottom: 48px;
}

.hero h2 {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero h2 .gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===================================
   Editor Section
   =================================== */

.editor-section {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 0;
    margin-bottom: 32px;
}

.editor-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.editor-panel:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.editor-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.editor-panel:first-child .editor-dot {
    background: var(--danger);
}

.editor-panel:last-child .editor-dot {
    background: var(--success);
}

.editor-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-hover);
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.upload-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.upload-btn:active {
    transform: translateY(0);
}

.editor-badge {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-hover);
    border-radius: 20px;
    color: var(--text-muted);
    font-weight: 500;
}

.editor-textarea {
    width: 100%;
    min-height: 280px;
    padding: 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
}

.editor-textarea::placeholder {
    color: var(--text-muted);
}

.editor-textarea:focus {
    outline: none;
}

/* ===================================
   Divider
   =================================== */

.divider-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
}

.divider-line {
    width: 1px;
    flex: 1;
    background: linear-gradient(to bottom, transparent, var(--border), transparent);
}

.compare-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    box-shadow: 0 0 30px var(--accent-glow);
    animation: pulse 2s ease-in-out infinite;
}

/* ===================================
   Controls
   =================================== */

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-focus);
}

/* ===================================
   Options Pills
   =================================== */

.options {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 14px;
    border: 1px solid var(--border);
}

.option-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.option-pill:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.option-pill.active {
    background: var(--accent);
    color: white;
}

.option-pill input {
    display: none;
}

.option-check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid var(--border-focus);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.option-pill.active .option-check {
    background: white;
    border-color: white;
}

.option-pill.active .option-check svg {
    opacity: 1;
}

.option-check svg {
    width: 10px;
    height: 10px;
    stroke: var(--accent);
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ===================================
   Stats Cards
   =================================== */

.stats {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    animation: slideUp 0.4s ease;
}

.stats.active {
    display: grid;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-focus);
}

.stat-card.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(to bottom, rgba(34, 197, 94, 0.05), transparent);
}

.stat-card.danger {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(to bottom, rgba(239, 68, 68, 0.05), transparent);
}

.stat-card.accent {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.05), transparent);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card.success .stat-icon {
    background: var(--success-bg);
    color: var(--success);
}

.stat-card.danger .stat-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-card.accent .stat-icon {
    background: var(--accent-glow);
    color: var(--accent);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.accent .stat-value { color: var(--accent); }

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ===================================
   Results Section
   =================================== */

.results {
    display: none;
    animation: slideUp 0.5s ease;
}

.results.active {
    display: block;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.results-title {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient);
    border-radius: 2px;
}

.legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.legend-dot.added { background: var(--success); }
.legend-dot.removed { background: var(--danger); }
.legend-dot.unchanged { 
    background: transparent;
    border: 2px solid var(--border-focus);
}

/* ===================================
   Diff View
   =================================== */

.diff-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.diff-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.diff-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.diff-panel-header .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.diff-panel:first-child .diff-panel-header .dot {
    background: var(--danger);
}

.diff-panel:last-child .diff-panel-header .dot {
    background: var(--success);
}

.diff-panel-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diff-content {
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    min-height: 100px;
    color: var(--text-primary);
}

.diff-content::-webkit-scrollbar {
    width: 8px;
}

.diff-content::-webkit-scrollbar-track {
    background: transparent;
}

.diff-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Diff highlighting */
.diff-line {
    min-height: 1.5em;
    padding: 1px 6px;
    border-left: 2px solid transparent;
}

.diff-line.added,
.diff-line.removed {
    background: var(--accent-glow);
    border-left-color: var(--accent);
}

.diff-line.placeholder {
    background: var(--bg-tertiary);
    border-left-color: var(--border);
    opacity: 0.5;
}

/* Character-level highlighting within lines */
.diff-line .added,
.diff-line .removed {
    background: rgba(99, 102, 241, 0.25);
    border-radius: 2px;
}

/* ===================================
   Footer
   =================================== */

.footer {
    text-align: center;
    padding: 48px 0 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ===================================
   Animations
   =================================== */

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 900px) {
    .editor-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .divider-section {
        flex-direction: row;
        padding: 16px 0;
    }

    .divider-line {
        width: auto;
        height: 1px;
        flex: 1;
        background: linear-gradient(to right, transparent, var(--border), transparent);
    }

    .diff-view {
        grid-template-columns: 1fr;
    }

    .hero h2 {
        font-size: 32px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
    }

    .options {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .legend {
        flex-wrap: wrap;
        justify-content: center;
    }

    .results-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .seo-content {
        padding: 24px 16px;
    }

    .seo-content h2 {
        font-size: 24px;
    }

    .seo-content h3 {
        font-size: 18px;
    }
}

/* ===================================
   SEO Content Section
   =================================== */

.seo-content {
    max-width: 1000px;
    margin: 80px auto 0;
    padding: 0 24px;
}

/* Hero */
.seo-hero {
    text-align: center;
    margin-bottom: 64px;
}

.seo-hero h2 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.seo-hero p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

/* Steps */
.seo-steps {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 64px;
}

.step-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.step-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.step-num {
    width: 28px;
    height: 28px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.step-card p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 64px;
}

.feature-card {
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.feature-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Use Cases */
.usecases-section {
    text-align: center;
    margin-bottom: 64px;
}

.usecases-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.usecases-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.usecase-tag {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.usecase-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* FAQ Section */
.faq-section {
    max-width: 700px;
    margin: 0 auto;
}

.faq-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.faq-section details {
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.faq-section details:hover {
    border-color: var(--border-focus);
}

.faq-section details[open] {
    border-color: var(--accent);
}

.faq-section summary {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    user-select: none;
}

.faq-section summary::-webkit-details-marker {
    display: none;
}

.faq-section summary::after {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

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

.faq-section summary h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.faq-section details p {
    padding: 0 20px 16px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
}

/* Footer improvements */
.footer {
    text-align: center;
    padding: 48px 0 24px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

.footer p {
    margin-bottom: 8px;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer small {
    font-size: 11px;
    opacity: 0.7;
}

/* Responsive for SEO section */
@media (max-width: 900px) {
    .seo-steps {
        flex-direction: column;
        align-items: center;
    }
    
    .step-card {
        width: 100%;
        max-width: 300px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .seo-hero h2 {
        font-size: 28px;
    }
}
