:root {
    --bg: #ffffff;
    --text: #000000;
    --border: #ccc;
    --added-bg: #eaffea;
    --removed-bg: #ffecec;
    --added-text: #22863a;
    --removed-text: #d73a49;
}

body.dark {
    --bg: #1e1e1e;
    --text: #eeeeee;
    --border: #444;
    --added-bg: #294436;
    --removed-bg: #452e2e;
    --added-text: #90ee90;
    --removed-text: #f28b82;
}

body {
    /* font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; */
    font-family: "Google Sans Flex", sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text);
}

.top-bar {
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.top-bar h1 {
    margin: 0;
    text-align: center;
    flex-grow: 1;
}

.branding {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 20px;
    gap: 12px;
}

.branding img {
    width: 48px;
    height: 48px;
}

.highlight {
    outline: 1px solid orange;
    animation: flash 0.6s ease-in-out;
    scroll-margin-top: 80px;
    /* prevents it from being hidden under top bar */
}

.button-area {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.button-area button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    font-family: "Google Sans Flex", sans-serif;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.button-area button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    /* Slight lift effect */
}

.button-area button:active {
    background-color: #004085;
    transform: translateY(0);
    /* Cancel hover effect on click */
}

.button-area button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(38, 143, 255, 0.5);
    /* Subtle focus ring */
}

.shortcut-hint {
    font-size: 12px;
    color: gray;
    text-align: center;
    width: 100%;
}

.controls {
    position: absolute;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: 10px;
    font-size: 14px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    /* optional, for spacing from above elements */
}

.toggle-input {
    display: none;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    position: relative;
    padding-left: 44px;
    /* space for switch */
}

.toggle-switch::before {
    content: "";
    position: absolute;
    left: 0;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background-color: #ccc;
    transition: background-color 0.3s ease;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

/* Checked state */
.toggle-input:checked+.toggle-switch::before {
    background-color: #007bff;
}

.toggle-input:checked+.toggle-switch::after {
    transform: translateX(16px);
}

/* Only style the dark mode toggle */
.dark-mode-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

/* Hide default checkbox */
#darkModeToggle {
    display: none;
}

/* Custom switch background */
.dark-mode-toggle::before {
    content: "";
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background-color: #ccc;
    position: relative;
    transition: background-color 0.3s ease;
}

/* Switch knob */
.dark-mode-toggle::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

/* When checked */
#darkModeToggle:checked+.dark-mode-toggle::before {
    background-color: #007bff;
}

#darkModeToggle:checked+.dark-mode-toggle::after {
    transform: translateX(16px);
}

.container,
.diff-output {
    max-height: calc(100vh - 239px);
    overflow: auto;
    border: 1px solid var(--border);
    white-space: pre-wrap;
    word-wrap: break-word;
    background-color: var(--bg);
    margin: 16px;
    padding: 20px 24px;
}

/* Default: Synced scrolling (single scroll area for both sides) */
.container.split-scroll-shared {
    display: flex;
    overflow-x: auto;
}

.container.split-scroll-shared .half {
    height: 100%;
    padding-right: 24px;
    border-right: 1px solid var(--border);
    box-sizing: border-box;
    width: 50%;
    flex-shrink: 0;
}

.container.split-scroll-shared .half:last-child {
    height: 100%;
    border-left: 1px solid var(--border);
    border-right: none;
    padding-left: 24px;
    padding-right: 0;
}

/* Independent scrolling (two scrollers) */
.container.split-scroll-independent {
    display: flex;
}

.container.split-scroll-independent .half {
    padding-right: 24px;
    overflow-x: auto;
    border-right: 1px solid var(--border);
    box-sizing: border-box;
    width: 50%;
}

.container.split-scroll-independent .half:last-child {
    border-right: none;
    padding: 0 24px;
}

.added {
    background-color: var(--added-bg);
    color: var(--added-text);
}

.removed {
    background-color: var(--removed-bg);
    color: var(--removed-text);
}

.inline-added {
    color: #0a810a;
    background-color: rgba(0, 128, 0, 0.15);
    font-weight: bold;
}

.inline-removed {
    color: #b30000;
    background-color: rgba(255, 0, 0, 0.1);
    font-weight: bold;
}

body.dark .inline-added {
    color: #98fb98;
    /* light green */
    background-color: rgba(144, 238, 144, 0.15);
    /* pale green background */
}

body.dark .inline-removed {
    color: #f28b82;
    /* soft red/pink */
    background-color: rgba(255, 99, 71, 0.12);
    /* light tomato background */
}

.gray-placeholder {
    background-color: #f0f0f0;
    color: #999;
    font-style: italic;
}

body.dark .gray-placeholder {
    background-color: #2a2a2a;
    color: #aaa;
}

.diff-group {
    margin-bottom: 4px;
}

.diff-group .highlight {
    outline: 2px solid orange;
}

/* .line {
    display: block;
}

.line-number {
    display: inline-block;
    width: 40px;
    text-align: right;
    margin-right: 10px;
    color: gray;
    user-select: none;
    flex-shrink: 0;
}

.line-content {
    flex: 1;
} */

/* Update/Add these classes */
.line {
    display: flex;
    height: 24px;       /* FORCE exact height */
    line-height: 24px;  /* FORCE exact line spacing */
    overflow: hidden;   /* Prevent long lines from expanding height */
    white-space: pre;   /* Preserve spaces/tabs */
    font-family: monospace; /* Monospace aligns better */
}

.line-number {
    width: 40px;
    text-align: right;
    margin-right: 10px;
    color: #999;
    flex-shrink: 0;     /* Prevent number from shrinking */
    user-select: none;
    background: rgba(0,0,0,0.05); /* Optional: subtle bg for numbers */
    padding-right: 5px;
}

.line-content {
    flex-grow: 1;
    padding-left: 5px;
}

/* Ensure empty placeholders take up space */
.placeholder .line-content {
    visibility: hidden; /* Hide content but keep layout */
}

/* .placeholder .line-number,
.placeholder .line-content {
    visibility: hidden;
} */

.collapsed-line {
    color: gray;
    font-style: italic;
    cursor: pointer;
    user-select: none;
}

.collapsed-line.expanded::after {
    content: " (click to collapse)";
    font-weight: normal;
    font-style: italic;
    color: #999;
}

.collapsed-line::after {
    content: " (click to expand)";
    font-weight: normal;
    font-style: italic;
    color: #999;
}

#collapseToggleWrapper {
    align-items: center;
}

.hidden {
    display: none;
}

/* Container positioning */
/* .ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    z-index: 1;
} */

/* Base style for placeholders */
/* .ad-placeholder {
    background-color: #f8f9fa;
    border: 1px dashed #ccc;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 4px;
} */

/* Dark mode adjustment */
/* body.dark .ad-placeholder {
    background-color: #2d2d2d;
    border-color: #555;
    color: #777;
} */

/* --- AD SIZING & TOGGLING LOGIC --- */

/* 1. Default State (Desktop): Large Ad ON, Small Ad OFF */
.ad-large {
    width: 468px;
    height: 60px;
    display: flex;
    /* Visible */
}

.ad-small {
    width: 320px;
    height: 50px;
    display: none;
    /* Hidden */
}

/* 2. Tablet Mode (< 1100px): Switch to Small Ad */
@media (max-width: 1100px) {
    .ad-large {
        display: none;
    }

    .ad-small {
        display: flex;
    }
}

/* 3. Mobile Mode (< 680px): Hide text ads entirely 
   (The top bar is too crowded with Branding + Controls + Ad on small screens) 
*/
@media (max-width: 680px) {
    .ad-container {
        display: none;
    }
}

/* Add these new styles */
.input-area {
    display: flex;
    gap: 20px;
    padding: 20px 24px 0 24px;
    height: 150px;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-wrapper label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.input-wrapper textarea {
    flex: 1;
    resize: none;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: "Google Sans Flex", sans-serif;
    font-size: 13px;
    background-color: var(--bg);
    color: var(--text);
}

.input-wrapper textarea:focus {
    outline: 2px solid #007bff;
    border-color: transparent;
}

.generate-section {
    display: flex;
    justify-content: center;
    padding: 15px 0;
}

#generateBtn {
    background-color: #28a745;
    /* Green for generate */
    color: white;
    border: none;
    padding: 10px 30px;
    font-family: "Google Sans Flex", sans-serif;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.2s;
}

#generateBtn:hover {
    background-color: #218838;
}

/* --- SEO Content Styling --- */
.seo-content {
    background-color: var(--bg);
    color: var(--text);
    padding: 60px 20px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.content-wrapper {
    max-width: 900px;
    /* Optimal reading width */
    margin: 0 auto;
    line-height: 1.6;
}

.seo-content h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #007bff;
    /* Brand color */
}

.seo-content h3 {
    font-size: 20px;
    margin-top: 30px;
    margin-bottom: 10px;
}

.seo-content p,
.seo-content li {
    font-size: 16px;
    color: var(--text);
    opacity: 0.9;
    margin-bottom: 15px;
}

/* Feature Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.feature-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

body.dark .feature-card {
    background-color: #2d2d2d;
}

/* Lists */
.seo-content ul,
.seo-content ol {
    margin-left: 20px;
    margin-bottom: 30px;
}

.seo-content li {
    margin-bottom: 8px;
}

/* Footer */
footer {
    background-color: #f1f3f5;
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: #666;
    font-size: 14px;
}

body.dark footer {
    background-color: #1a1a1a;
    color: #aaa;
}

p.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-links {
    margin: 15px 0;
}

.footer-links a {
    color: #007bff;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.separator {
    margin: 0 10px;
    color: #ccc;
}

.donate-plug {
    margin-top: 20px;
    font-weight: bold;
}