:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(31, 41, 55, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #6366f1;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --diff-add-bg: rgba(16, 185, 129, 0.2);
    --diff-add-border: #10b981;
    --diff-del-bg: rgba(239, 68, 68, 0.2);
    --diff-del-border: #ef4444;
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(241, 245, 249, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #4f46e5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --diff-add-bg: rgba(16, 185, 129, 0.15);
    --diff-del-bg: rgba(239, 68, 68, 0.15);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background Ambient Glow */
.background-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}

.background-glow.top-left {
    top: -100px;
    left: -100px;
    background: radial-gradient(circle, #6366f1, #a855f7);
}

.background-glow.bottom-right {
    bottom: 50px;
    right: -100px;
    background: radial-gradient(circle, #ec4899, #8b5cf6);
}

.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

/* Navbar */
.navbar {
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.brand-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.brand-title .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    color: var(--text-secondary);
}

.device-pill i {
    color: var(--accent-primary);
}

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--accent-primary);
    transform: scale(1.05);
}

/* Main Layout */
.main-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    position: relative;
    z-index: 10;
}

/* Hero Section */
.hero-section {
    text-align: center;
    max-width: 780px;
    margin: 0.5rem auto 1rem;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
    margin-bottom: 1rem;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

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

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Controls Card */
.controls-card {
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.controls-row {
    display: grid;
    grid-template-columns: 1.6fr 1.2fr 1fr;
    gap: 1.5rem;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tone-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.tone-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.tone-chip:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.tone-chip.active {
    background: var(--accent-primary);
    color: #ffffff;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: var(--font-body);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.custom-select:focus {
    border-color: var(--border-focus);
}

.slider-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

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

.slider-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 700;
}

.custom-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--bg-secondary);
    outline: none;
    cursor: pointer;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: var(--transition);
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Quick Samples */
.samples-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.samples-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sample-btn {
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    transition: var(--transition);
}

.sample-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Editor Grid */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.editor-card {
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-height: 420px;
    overflow: hidden;
}

.card-header {
    padding: 0.9rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-title h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-input {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.dot-output {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.card-actions {
    display: flex;
    gap: 0.4rem;
}

.action-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition);
}

.action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.action-btn.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.editor-body {
    flex: 1;
    position: relative;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.editor-body textarea {
    width: 100%;
    height: 100%;
    min-height: 280px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    resize: none;
}

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

.output-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.diff-container {
    width: 100%;
    height: 100%;
    min-height: 280px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-added {
    background-color: var(--diff-add-bg);
    border-bottom: 2px solid var(--diff-add-border);
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
}

.diff-removed {
    background-color: var(--diff-del-bg);
    border-bottom: 2px solid var(--diff-del-border);
    text-decoration: line-through;
    opacity: 0.7;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    margin-right: 0.25rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: 20;
    transition: var(--transition);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-weight: 600;
    font-size: 0.95rem;
}

.loading-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-footer {
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

.stats-pills {
    display: flex;
    gap: 0.75rem;
}

.stat-pill {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.score-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-weight: 600;
}

.score-indicator.ai-high {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.score-indicator.ai-mid {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.score-indicator.ai-low {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-indicator.ai-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
}

.btn-humanize {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    padding: 1rem 2.75rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 24px var(--accent-glow);
    transition: var(--transition);
}

.btn-humanize:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 32px var(--accent-glow);
}

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

/* Insights Panel */
.insights-section {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.insights-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-pill {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-title {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-values {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-values i {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.metric-highlight {
    color: var(--accent-primary);
}

.metric-highlight.success {
    color: var(--success);
}

.metric-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* API Info Panel */
.api-info-panel {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.api-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #a855f7;
    margin-bottom: 0.5rem;
}

.api-info-content h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.api-info-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.code-snippet {
    background: #000000;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.code-snippet code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #38bdf8;
    white-space: pre;
}

/* Footer */
.footer {
    margin-top: auto;
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--accent-primary);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    pointer-events: none;
    z-index: 9999;
}

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

.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .controls-row {
        grid-template-columns: 1fr;
    }
    .editor-grid {
        grid-template-columns: 1fr;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 2.2rem;
    }
}
