/* ============================================
   Markdown Presentation Builder
   Primary: #6C63FF | Secondary: #A78BFA
   Accent: #F472B6 | Background: #0F0A1A
   ============================================ */

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

:root {
    --primary: #6C63FF;
    --primary-glow: rgba(108, 99, 255, 0.15);
    --secondary: #A78BFA;
    --accent: #F472B6;
    --bg: #0F0A1A;
    --bg-card: #1a1230;
    --bg-input: #120d20;
    --border: #2a2045;
    --border-focus: #6C63FF;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --success: #34d399;
    --error: #f87171;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.6
}

/* Header */
.header {
    position: relative;
    z-index: 100;
    background: rgba(15, 10, 26, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border)
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1.25rem
}

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

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-glow);
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: var(--radius-sm);
    color: var(--primary)
}

.logo-title {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2
}

.logo-subtitle {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em
}

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

/* Controls */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    background: none;
    color: var(--text)
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #5b52e0);
    color: white;
    border-color: rgba(108, 99, 255, 0.3);
    box-shadow: 0 2px 10px rgba(108, 99, 255, 0.25)
}

.btn-primary:hover {
    box-shadow: 0 4px 18px rgba(108, 99, 255, 0.35);
    transform: translateY(-1px)
}

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

.btn-ghost:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05)
}

.btn-ghost.active {
    color: var(--primary);
    background: var(--primary-glow)
}

.btn-sm {
    padding: 0.35rem 0.625rem;
    font-size: 0.75rem
}

.select-input {
    padding: 0.4rem 0.625rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.75rem;
    outline: none;
    cursor: pointer
}

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

/* Layout */
.main {
    height: calc(100vh - 53px)
}

.app-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    height: 100%
}

/* Editor */
.editor-pane,
.preview-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden
}

.preview-pane {
    border-left: 1px solid var(--border)
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.015)
}

.pane-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em
}

.slide-indicator {
    font-size: 0.6875rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem
}

.nav-indicator {
    font-size: 0.6875rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: center
}

.md-editor {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    resize: none;
    outline: none;
    tab-size: 2;
    overflow: auto
}

.md-editor::placeholder {
    color: var(--text-dim);
    opacity: 0.35
}

/* Slide Frame */
.slide-frame {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15)
}

.slide-content {
    width: 100%;
    max-width: 720px;
    aspect-ratio: 16/9;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: background 0.3s, color 0.3s
}

.slide-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-dim);
    text-align: center;
    height: 100%
}

.placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.2
}

.slide-placeholder p {
    font-size: 0.875rem
}

/* Slide typography */
.slide-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--text), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2
}

.slide-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
    color: var(--secondary)
}

.slide-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text)
}

.slide-content p {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
    line-height: 1.7
}

.slide-content ul,
.slide-content ol {
    margin: 0.5rem 0 0.75rem 1.5rem
}

.slide-content li {
    margin-bottom: 0.375rem;
    color: var(--text-muted);
    font-size: 0.9375rem
}

.slide-content code {
    padding: 0.1rem 0.35rem;
    background: rgba(108, 99, 255, 0.12);
    border: 1px solid rgba(108, 99, 255, 0.15);
    border-radius: 3px;
    font-size: 0.825em;
    color: var(--secondary)
}

.slide-content pre {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    overflow-x: auto
}

.slide-content pre code {
    padding: 0;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.8125rem
}

.slide-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    background: rgba(108, 99, 255, 0.05);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-style: italic;
    color: var(--text-muted)
}

.slide-content strong {
    color: var(--text);
    font-weight: 600
}

.slide-content img {
    max-width: 100%;
    border-radius: var(--radius-xs)
}

/* Speaker Notes */
.speaker-notes {
    border-top: 1px solid var(--border);
    max-height: 140px;
    overflow-y: auto
}

.notes-header {
    padding: 0.375rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1)
}

.notes-content {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
    white-space: pre-wrap
}

/* Presentation Overlay */
.presentation-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none
}

.presentation-overlay:hover {
    cursor: default
}

.presentation-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    overflow: auto
}

.presentation-slide h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-align: center;
    background: linear-gradient(135deg, #fff, var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.presentation-slide h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--secondary)
}

.presentation-slide h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.625rem;
    color: #e2e8f0
}

.presentation-slide p {
    font-size: 1.375rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    line-height: 1.7;
    max-width: 800px
}

.presentation-slide ul,
.presentation-slide ol {
    margin: 0.5rem 0 1rem 2rem
}

.presentation-slide li {
    font-size: 1.375rem;
    color: #94a3b8;
    margin-bottom: 0.5rem
}

.presentation-slide code {
    padding: 0.15rem 0.5rem;
    background: rgba(108, 99, 255, 0.15);
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--secondary)
}

.presentation-slide pre {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    max-width: 800px;
    overflow-x: auto
}

.presentation-slide pre code {
    padding: 0;
    background: none;
    font-size: 1.125rem;
    color: #e2e8f0
}

.presentation-slide blockquote {
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1.5rem;
    background: rgba(108, 99, 255, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    max-width: 700px
}

.presentation-slide blockquote p {
    font-style: italic
}

.presentation-controls {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s
}

.presentation-overlay:hover .presentation-controls {
    opacity: 1
}

.presentation-indicator {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-variant-numeric: tabular-nums
}

.presentation-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    transition: width 0.3s ease
}

/* Slide Themes */
.theme-light .slide-content {
    background: #fff;
    border-color: #e2e8f0;
    color: #1e293b
}

.theme-light .slide-content h1 {
    -webkit-text-fill-color: #1e293b;
    background: none
}

.theme-light .slide-content h2 {
    color: #6C63FF
}

.theme-light .slide-content p,
.theme-light .slide-content li {
    color: #475569
}

.theme-light .slide-content code {
    background: rgba(108, 99, 255, 0.08);
    color: #6C63FF
}

.theme-ocean .slide-content {
    background: linear-gradient(135deg, #0c1b33, #162d4f);
    border-color: #1e3a5f
}

.theme-ocean .slide-content h2 {
    color: #38bdf8
}

.theme-ocean .slide-content code {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8
}

.theme-ocean .slide-content blockquote {
    border-left-color: #38bdf8
}

.theme-forest .slide-content {
    background: linear-gradient(135deg, #0a1a14, #122820);
    border-color: #1e3a30
}

.theme-forest .slide-content h2 {
    color: #34d399
}

.theme-forest .slide-content code {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399
}

.theme-forest .slide-content blockquote {
    border-left-color: #34d399
}

.theme-sunset .slide-content {
    background: linear-gradient(135deg, #1a0f0a, #2a1610);
    border-color: #3a2620
}

.theme-sunset .slide-content h2 {
    color: #fb923c
}

.theme-sunset .slide-content code {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c
}

.theme-sunset .slide-content blockquote {
    border-left-color: #fb923c
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 0.8125rem;
    color: var(--text);
    animation: toast-in 0.3s ease
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px
}

/* Responsive */
@media(max-width:768px) {
    .app-layout {
        grid-template-columns: 1fr
    }

    .preview-pane {
        display: none
    }

    .header-actions .btn span {
        display: none
    }
}