/* ═══════════════════════════════════════════════
   BLUEPRINT DIFF — Side-by-side comparison styling
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-page: hsl(40, 30%, 97%);
    --bg-white: hsl(0, 0%, 100%);
    --bg-warm: hsl(35, 40%, 95%);
    --bg-soft: hsl(30, 20%, 93%);
    --bg-card: hsl(0, 0%, 100%);
    --border: hsl(30, 15%, 88%);
    --border-hover: hsl(30, 20%, 78%);
    --text-0: hsl(220, 20%, 16%);
    --text-1: hsl(220, 10%, 38%);
    --text-2: hsl(220, 8%, 55%);
    --text-3: hsl(220, 6%, 68%);
    --accent: hsl(245, 58%, 56%);
    --accent-light: hsl(245, 58%, 64%);
    --accent-bg: hsl(245, 60%, 96%);
    --accent-border: hsl(245, 50%, 88%);
    --coral: hsl(12, 80%, 62%);
    --teal: hsl(170, 50%, 45%);
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-pill: 100px;
    --transition: 200ms ease;
    --shadow-sm: 0 1px 3px hsla(220, 20%, 16%, 0.06);
    --shadow-md: 0 4px 16px hsla(220, 20%, 16%, 0.08);
    --shadow-lg: 0 8px 32px hsla(220, 20%, 16%, 0.1);
    --shadow-btn: 0 2px 8px hsla(245, 58%, 56%, 0.2);

    /* Diff colors */
    --diff-add-bg: hsl(145, 40%, 94%);
    --diff-add-border: hsl(145, 35%, 80%);
    --diff-add-text: hsl(145, 40%, 28%);
    --diff-del-bg: hsl(0, 50%, 95%);
    --diff-del-border: hsl(0, 45%, 82%);
    --diff-del-text: hsl(0, 50%, 35%);
    --diff-line-num: hsl(220, 6%, 72%);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    background: var(--bg-page);
    color: var(--text-0);
    min-height: 100vh;
    overflow-x: hidden;
}

.diff-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.diff-app>#shared-footer {
    margin-top: auto;
}

/* ─── Intro ─── */

.diff-main {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

.diff-intro {
    text-align: center;
    margin-bottom: 36px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 8px;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    color: var(--text-0);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-2);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ─── Auth Gate ─── */

.diff-auth-gate {
    max-width: 440px;
    margin: 0 auto;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.auth-card h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-0);
    margin-bottom: 16px;
}

.auth-row {
    display: flex;
    gap: 10px;
}

.auth-hint {
    font-size: 0.78rem;
    color: var(--text-2);
    margin-top: 12px;
}

.auth-hint a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-hint a:hover {
    text-decoration: underline;
}

/* ─── Selectors ─── */

.diff-selectors {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.diff-selector {
    flex: 1;
    min-width: 200px;
}

.diff-selector label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin-bottom: 8px;
}

.diff-select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-0);
    font-family: var(--sans);
    font-size: 0.82rem;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239598a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.diff-select:focus {
    outline: none;
    border-color: var(--accent);
}

.diff-arrow {
    font-size: 1.4rem;
    color: var(--text-3);
    padding-bottom: 8px;
    flex-shrink: 0;
}

/* ─── Stats ─── */

.diff-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    animation: fadeSlideIn 300ms ease;
}

.stat {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
}

.stat-add {
    background: var(--diff-add-bg);
    color: var(--diff-add-text);
    border: 1px solid var(--diff-add-border);
}

.stat-del {
    background: var(--diff-del-bg);
    color: var(--diff-del-text);
    border: 1px solid var(--diff-del-border);
}

.stat-same {
    background: var(--bg-soft);
    color: var(--text-2);
    border: 1px solid var(--border);
}

/* ─── Diff Output ─── */

.diff-output {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: fadeSlideIn 400ms ease;
}

.diff-pane-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border);
    background: var(--bg-warm);
}

.diff-pane-title {
    padding: 10px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
}

.diff-pane-title:first-child {
    border-right: 1px solid var(--border);
}

.diff-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-height: 65vh;
    overflow-y: auto;
}

.diff-pane {
    padding: 0;
    font-family: var(--mono);
    font-size: 0.74rem;
    line-height: 1.7;
    border-right: 1px solid var(--border);
    min-width: 0;
}

.diff-pane:last-child {
    border-right: none;
}

/* Diff lines */
.diff-line {
    display: flex;
    padding: 1px 12px 1px 0;
    min-height: 22px;
}

.diff-line-num {
    flex: 0 0 40px;
    text-align: right;
    padding-right: 10px;
    color: var(--diff-line-num);
    font-size: 0.68rem;
    user-select: none;
    border-right: 1px solid var(--border);
    margin-right: 10px;
}

.diff-line-content {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.diff-line.added {
    background: var(--diff-add-bg);
}

.diff-line.added .diff-line-content {
    color: var(--diff-add-text);
}

.diff-line.added .diff-line-content::before {
    content: '+ ';
    font-weight: 700;
}

.diff-line.removed {
    background: var(--diff-del-bg);
}

.diff-line.removed .diff-line-content {
    color: var(--diff-del-text);
}

.diff-line.removed .diff-line-content::before {
    content: '− ';
    font-weight: 700;
}

.diff-line.empty {
    background: hsl(220, 8%, 96%);
}

/* ─── Empty State ─── */

.diff-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-3);
}

.diff-empty .empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.diff-empty p {
    font-size: 0.88rem;
}

/* ─── Actions ─── */

.diff-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* ─── Buttons / Inputs (shared) ─── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--bg-white);
    border-color: var(--border);
    color: var(--text-0);
}

.btn-ghost:hover:not(:disabled) {
    border-color: var(--border-hover);
    background: var(--bg-warm);
}

.input {
    width: 100%;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-0);
    font-family: var(--sans);
    font-size: 0.88rem;
    padding: 11px 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px hsla(245, 58%, 56%, 0.08);
}

.input::placeholder {
    color: var(--text-3);
}

/* ─── Toast ─── */

.toast {
    position: fixed;
    bottom: 32px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-0);
    background: var(--bg-white);
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateY(10px);
    transition: all 250ms ease;
    pointer-events: none;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    border-color: hsl(0, 60%, 85%);
    background: var(--diff-del-bg);
    color: var(--diff-del-text);
}

/* ─── Animations ─── */

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Scrollbar ─── */

.diff-panes::-webkit-scrollbar {
    width: 6px;
}

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

.diff-panes::-webkit-scrollbar-thumb {
    background: var(--bg-soft);
    border-radius: 3px;
}

.diff-panes::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}

/* ─── Responsive ─── */

@media (max-width: 800px) {
    .diff-main {
        padding: 24px 16px 40px;
    }

    .diff-selectors {
        flex-direction: column;
        align-items: stretch;
    }

    .diff-arrow {
        text-align: center;
        padding: 0;
    }

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

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

    .diff-pane-title:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .diff-pane:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .section-title {
        font-size: 1.6rem;
    }
}