:root {
    --primary: #10B981;
    --primary-hover: #059669;
    --accent: #8B5CF6;
    --bg-dark: #0F172A;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --bg-input: rgba(15, 23, 42, 0.8);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border: rgba(51, 65, 85, 0.6);

    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;

    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background-image:
        radial-gradient(circle at 15% 30%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
}

.app-container {
    width: 100%;
    max-width: 1100px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.header-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 850px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

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

.text-sm {
    font-size: 0.85rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Diff Editor area */
.editor-container {
    position: relative;
    width: 100%;
    height: 350px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-top-color: var(--accent);
    border-top-width: 2px;
    background: var(--bg-input);
}

textarea,
.diff-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    border: none;
    background: transparent;
    margin: 0;
    border-radius: 0;
}

textarea {
    color: transparent;
    /* Text is transparent, carets and selection visible */
    caret-color: var(--text-main);
    resize: none;
    z-index: 2;
    white-space: pre;
    overflow: auto;
}

textarea:focus {
    outline: none;
}

.diff-highlight {
    color: var(--text-main);
    z-index: 1;
    pointer-events: none;
    /* Let clicks pass through */
    overflow: hidden;
    white-space: pre;
}

/* Syntax highlighting classes */
.hl-add {
    color: #34D399;
}

.hl-del {
    color: #F87171;
}

.hl-meta {
    color: var(--text-muted);
}

.hl-hunk {
    color: var(--accent);
}

.options-bar {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

/* Toggle Switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toggle-switch:hover {
    color: var(--text-main);
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    transition: .3s;
    border: 1px solid var(--border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: .3s;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(16px);
    background-color: white;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    width: 100%;
}

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

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

.icon-btn {
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 4px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hidden {
    display: none !important;
}

#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    height: 300px;
    color: var(--text-muted);
}

.pulse-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    left: -10px;
    top: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: pulse 1.5s linear infinite;
    opacity: 0;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.suggestion-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.suggestion-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--type-color, var(--text-muted));
}

.suggestion-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.sugg-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.sugg-title {
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
}

.sugg-type-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background: var(--type-bg, rgba(255, 255, 255, 0.1));
    color: var(--type-color, var(--text-main));
}

.sugg-body {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    margin-top: 0.5rem;
}

.sugg-footer {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--danger);
    white-space: pre-wrap;
    margin-top: 0.5rem;
    font-weight: 500;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.code-font {
    font-family: 'Fira Code', monospace;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.stat-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-val {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}