:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    --deprecated: #6b7280;
    
    --transition: all 0.25s ease;
    --radius: 12px;
}

body.theme-light {
    --bg-main: #f8fafc;
    --bg-panel: rgba(255, 255, 255, 0.7);
    --bg-panel-solid: #ffffff;
    --border: rgba(0, 0, 0, 0.1);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-input: rgba(255, 255, 255, 0.9);
    --bg-hover: rgba(0, 0, 0, 0.05);
}

body.theme-dark {
    --bg-main: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --bg-panel-solid: #1e293b;
    --border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-input: rgba(15, 23, 42, 0.9);
    --bg-hover: rgba(255, 255, 255, 0.05);
}

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

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

.app-layout {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Sidebar */
.sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    z-index: 10;
}

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

.sidebar-actions {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}

.view-toggles {
    display: flex;
    gap: 0.5rem;
}

.view-toggles .btn {
    flex: 1;
}

.filters {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.adr-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.adr-item {
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--bg-panel-solid);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.adr-item:hover, .adr-item.active {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.adr-item-title {
    font-weight: 600;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.adr-status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-proposed { background: var(--warning); color: #fff; }
.status-accepted { background: var(--success); color: #fff; }
.status-deprecated { background: var(--deprecated); color: #fff; }
.status-superseded { background: var(--text-muted); color: #fff; }

.adr-item-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.export-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
}

.export-actions .btn {
    flex: 1;
    font-size: 0.85rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.view-panel {
    position: absolute;
    inset: 1rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: auto;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.empty-state {
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Editor */
.editor-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.title-input {
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-main);
    outline: none;
    flex: 1;
    margin-right: 1rem;
}

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

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

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

.edit-area, .preview-area {
    position: absolute;
    inset: 0;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.markdown-input {
    flex: 1;
    width: 100%;
    resize: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
}

/* Timeline */
.timeline-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.timeline-container {
    padding: 2rem;
    position: relative;
    flex: 1;
    overflow-y: auto;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 2rem;
    top: 2rem;
    bottom: 2rem;
    width: 2px;
    background: var(--border);
}

.timeline-node {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 2rem;
}

.timeline-node::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
}

.timeline-card {
    background: var(--bg-panel-solid);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
}

/* UI Elements */
.btn {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.9rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover, .btn-secondary.active {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.input-base {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
}

.input-base:focus {
    outline: none;
    border-color: var(--primary);
}

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

/* Markdown Styles */
.markdown-body {
    line-height: 1.6;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}
.markdown-body h1 { font-size: 2em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.markdown-body p, .markdown-body ul, .markdown-body ol { margin-bottom: 1em; }
.markdown-body ul, .markdown-body ol { padding-left: 2em; }
.markdown-body code {
    background: var(--bg-hover);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}
.markdown-body pre {
    background: var(--bg-panel-solid);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
}
.markdown-body pre code { background: transparent; padding: 0; }
.markdown-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    color: var(--text-muted);
    margin: 1rem 0;
}
