:root {
    /* Brand Colors - Indigo / Purple Gradients */
    --brand-primary: #8b5cf6;
    --brand-secondary: #ec4899;
    --brand-hover: #7c3aed;

    /* Semantic Colors */
    --color-feature: #10b981;
    --color-fix: #3b82f6;
    --color-breaking: #ef4444;
    --color-misc: #8b5cf6;

    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.4);
}

/* Dark Theme (Default) */
[data-theme="dark"] {
    --bg-base: #030712;
    --bg-panel: rgba(17, 24, 39, 0.7);
    --bg-element: #1f2937;
    --bg-hover: #374151;

    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(139, 92, 246, 0.5);

    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-danger: #f87171;

    --glass-blur: blur(12px);
}

/* Light Theme */
[data-theme="light"] {
    --bg-base: #f3f4f6;
    --bg-panel: rgba(255, 255, 255, 0.8);
    --bg-element: #e5e7eb;
    --bg-hover: #d1d5db;

    --border-subtle: rgba(0, 0, 0, 0.1);
    --border-focus: rgba(139, 92, 246, 0.5);

    --text-main: #111827;
    --text-muted: #6b7280;
    --text-danger: #ef4444;

    --glass-blur: blur(12px);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

svg {
    display: block;
}

.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.h-6 {
    height: 1.5rem;
}

.w-full {
    width: 100%;
}

.hidden {
    display: none !important;
}

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

.relative {
    position: relative;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

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

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-icon {
    font-size: 1.25rem;
    filter: drop-shadow(0 0 10px var(--brand-primary));
}

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

.shortcut-hint {
    background: var(--bg-element);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    border: 1px solid var(--border-subtle);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
    color: var(--text-main);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--text-muted);
    border: 1px solid transparent;
}

.btn-icon:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

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

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

.btn-text.text-danger:hover {
    color: var(--text-danger);
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    background: var(--brand-hover);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

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

/* Main Content Workspace */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

@media (max-width: 900px) {
    .app-layout {
        padding: 1rem;
        height: auto;
        min-height: 100vh;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .pane {
        height: 600px;
    }

    .hidden-mobile {
        display: none;
    }
}

/* Pane & Glass Effect */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.pane-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

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

/* Tabs */
.tab-group {
    display: flex;
    background: var(--bg-element);
    border-radius: 6px;
    padding: 0.25rem;
    gap: 0.25rem;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: var(--bg-hover);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Editors */
.editor-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.code-editor {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    resize: none;
    border: none;
    background: transparent;
    color: var(--text-main);
    padding: 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    outline: none;
}

.code-editor::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.pane-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

/* Output Data */
.output-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.rich-preview {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    color: var(--text-main);
}

.empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    filter: grayscale(1);
}

/* HTML Preview Typographic Styles */
.rich-preview h1,
.rich-preview h2,
.rich-preview h3 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
}

.rich-preview h2 {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.rich-preview ul {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
    list-style-type: none;
}

.rich-preview li {
    margin-bottom: 0.5em;
    position: relative;
}

.rich-preview li::before {
    content: "•";
    position: absolute;
    left: -1em;
    color: var(--text-muted);
}

/* Badges for Conventional Commits via Output View */
.badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    margin-right: 0.5rem;
}

.badge-feature {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-feature);
}

.badge-fix {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-fix);
}

.badge-breaking {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-breaking);
}

.badge-misc {
    background: rgba(139, 92, 246, 0.15);
    color: var(--color-misc);
}

/* AI Overlay Loader */
.ai-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    font-weight: 500;
    z-index: 10;
}

[data-theme="light"] .ai-overlay {
    background: rgba(255, 255, 255, 0.8);
}

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 1rem;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: var(--bg-base);
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}