.markdown-editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.milkdown-editor-wrapper {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    overflow: auto;
    padding: 1.5rem;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.milkdown-editor-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
}

/* 3. Bypassing Blazor CSS Isolation for Dynamic JS DOMs using ::deep */
::deep .milkdown-editor-wrapper .crepe {
    max-width: 100% !important;
}

::deep .milkdown-editor-wrapper .milkdown {
    background-color: var(--bg-surface) !important;
    color: var(--text-main) !important;
    font-family: var(--nexus-font-sans) !important;
    border: none !important;
    box-shadow: none !important;
    
    /* Map Crepe's internal variables to our design tokens */
    --crepe-color-background: var(--bg-surface);
    --crepe-color-on-background: var(--text-main);
    --crepe-color-surface: rgba(255, 255, 255, 0.03);
    --crepe-color-surface-low: rgba(255, 255, 255, 0.01);
    --crepe-color-primary: var(--accent);
    --crepe-color-outline: var(--border);
}

::deep .milkdown-editor-wrapper .milkdown .editor {
    color: var(--text-main) !important;
    background: transparent !important;
    outline: none !important;
    padding: 0.5rem 0 !important;
    min-height: 200px;
}

/* Style the buttons using variables from app.css */
.nexus-btn {
    font-family: var(--nexus-font-sans);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    text-decoration: none;
    background: var(--nexus-neon);
    color: #000000;
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 36px;
}

.nexus-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 4px 15px var(--nexus-primary-glow);
}

.nexus-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Stateful Status Indicator Footer */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-surface-low, rgba(255, 255, 255, 0.02));
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border);
    margin-top: -0.5rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted, #888888);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 8px currentColor;
}

.status-dot.saved {
    color: #10B981; /* Green */
    background-color: #10B981;
}

.status-dot.saving {
    color: #F59E0B; /* Amber */
    background-color: #F59E0B;
    animation: status-pulse 1s infinite alternate;
}

.status-dot.offline {
    color: #EF4444; /* Red */
    background-color: #EF4444;
}

/* Orange Restoration Warning Banner */
.restoration-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md, 8px);
    color: var(--text-main);
    font-size: 0.9rem;
    gap: 1rem;
    margin-bottom: 0.75rem;
    animation: banner-fadeIn 0.3s ease-out;
}

.banner-text {
    font-weight: 500;
}

.banner-actions {
    display: flex;
    gap: 0.75rem;
}

.banner-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm, 4px);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.restore-btn {
    background: #F59E0B;
    color: #000;
}

.restore-btn:hover {
    background: #D97706;
    transform: translateY(-1px);
}

.dismiss-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

@keyframes status-pulse {
    0% { opacity: 0.4; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.1); }
}

@keyframes banner-fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
