/* ===================================
   CSS Variables - Easy Theme Customization
   =================================== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent: #00a86b;
    --accent-dim: #00a86b20;
    --border: #e0e0e0;
    --added: #d4edda;
    --removed: #f8d7da;
    --added-text: #155724;
    --removed-text: #721c24;
    --shadow: 0 4px 24px rgba(0, 168, 107, 0.15);
}

/* ===================================
   Base Styles
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===================================
   Layout
   =================================== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeIn 0.6s ease-out;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    position: relative;
    padding-right: 140px; /* Space for header-nav */
}

.header-nav {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.coffee-btn-small {
    background: var(--bg-secondary);
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    line-height: 1;
}

.coffee-btn-small:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-1px);
}

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

#langSelector {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#langSelector:hover {
    border-color: var(--accent);
}

#langSelector:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ===================================
   Typography
   =================================== */
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent), #0088cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* ===================================
   Diff Interface
   =================================== */
.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    animation: slideUp 0.7s ease-out 0.2s both;
}

.text-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.text-panel:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.panel-header {
    background: var(--bg-primary);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

textarea {
    width: 100%;
    height: 400px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    padding: 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.8;
    resize: vertical;
    outline: none;
}

textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* ===================================
   Controls
   =================================== */
.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    animation: slideUp 0.8s ease-out 0.3s both;
}

button {
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 168, 107, 0.3);
}

button:active {
    transform: translateY(0);
}

button.secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

button.secondary:hover {
    background: var(--accent-dim);
}

/* ===================================
   Results Section
   =================================== */
#results {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    min-height: 200px;
    margin-bottom: 2rem;
    display: none;
    animation: slideUp 0.5s ease-out;
}

#results.active {
    display: block;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.stats {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.stat-value.added {
    color: var(--added-text);
}

.stat-value.removed {
    color: var(--removed-text);
}

/* ===================================
   Diff Output
   =================================== */
.diff-output {
    font-family: inherit;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-line {
    padding: 0.25rem 0.75rem;
    margin: 0.1rem 0;
    border-radius: 3px;
}

.diff-added {
    background: var(--added);
    color: var(--added-text);
    border-left: 3px solid var(--added-text);
}

.diff-removed {
    background: var(--removed);
    color: var(--removed-text);
    border-left: 3px solid var(--removed-text);
}

.diff-unchanged {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ===================================
   Footer
   =================================== */
footer {
    text-align: center;
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: fadeIn 1s ease-out 0.5s both;
}

.donate-section {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
}

.donate-section h3 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ===================================
   SEO Content Section (visible but styled)
   =================================== */
.seo-content {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: left;
}

.seo-content h4 {
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.seo-content h4:not(:first-child) {
    margin-top: 1.5rem;
}

.seo-content p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.seo-content ul {
    list-style: none;
    padding: 0;
}

.seo-content li {
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.seo-content li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ===================================
   Info Sections (FAQ, Privacy, About)
   =================================== */
.info-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    scroll-margin-top: 2rem;
}

.info-section h3 {
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-section h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.info-section p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.faq-item {
    padding: 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.3s ease;
}

.faq-item:hover {
    border-color: var(--accent);
}

.faq-item h4 {
    margin-bottom: 0.75rem;
}

.faq-item p {
    margin-bottom: 0;
}

/* ===================================
   Footer Navigation
   =================================== */
footer nav {
    margin-top: 1rem;
}

footer nav a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

footer nav a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.copyright {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ===================================
   Accessibility - Visually Hidden
   (for screen readers and SEO)
   =================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .diff-container {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem;
    }

    textarea {
        height: 250px;
    }

    .stats {
        flex-direction: column;
        gap: 1rem;
    }

    .seo-content {
        padding: 1.5rem;
    }

    .info-section {
        padding: 1.5rem;
    }

    .header-nav {
        position: static;
        margin-top: 0.5rem;
    }

    .header-top {
        flex-direction: column;
        padding-right: 0;
    }
}
