/* =============================================
   Markdown Slide Presenter — Styles
   Theme: Dark mode, Forest Moss
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #22C55E;
  --primary-dim: rgba(34,197,94,0.12);
  --primary-glow: rgba(34,197,94,0.3);
  --secondary: #86EFAC;
  --accent: #A3E635;
  --accent-dim: rgba(163,230,53,0.12);
  --bg: #0A1A0D;
  --bg-card: #0F2614;
  --bg-input: #081208;
  --bg-hover: #153320;
  --border: rgba(34,197,94,0.15);
  --border-focus: rgba(34,197,94,0.5);
  --text: #E0F2E4;
  --text-dim: #7BAF8A;
  --text-muted: #3D6B4A;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 0.2s ease;
  --shadow: 0 4px 24px 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; line-height: 1.6; overflow: hidden; }
body::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at top left, rgba(34,197,94,0.05), transparent 50%), radial-gradient(ellipse at bottom right, rgba(163,230,53,0.03), transparent 50%); pointer-events: none; }

/* Header */
.header { border-bottom: 1px solid var(--border); background: rgba(15,38,20,0.9); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.header-inner { padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.2rem; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: var(--primary-dim); border-radius: var(--radius-sm); }
.header h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { font-size: 0.72rem; color: var(--text-dim); }
.header-actions { display: flex; gap: 6px; align-items: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-family: var(--font); font-size: 0.8rem; font-weight: 500; border: none; border-radius: 6px; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #16A34A); color: #0A1A0D; font-weight: 600; }
.btn-primary:hover { box-shadow: 0 4px 16px var(--primary-glow); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--primary); background: var(--primary-dim); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

.sel { padding: 6px 28px 6px 10px; font-family: var(--font); font-size: 0.8rem; font-weight: 500; color: var(--accent); background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; outline: none; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237BAF8A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }

/* Editor Layout */
.editor-layout { display: grid; grid-template-columns: 1fr 1fr; height: calc(100vh - 59px); }
.editor-pane { display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.preview-pane { display: flex; flex-direction: column; overflow: hidden; }

.pane-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.pane-label { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.slide-count { font-size: 0.72rem; color: var(--text-muted); font-family: var(--mono); }
.counter { font-size: 0.78rem; font-family: var(--mono); color: var(--text-dim); }
.preview-nav { display: flex; align-items: center; gap: 6px; }

.md-editor { flex: 1; padding: 16px; font-family: var(--mono); font-size: 0.85rem; line-height: 1.7; color: var(--text); background: var(--bg-input); border: none; outline: none; resize: none; tab-size: 2; }
.md-editor::placeholder { color: var(--text-muted); }

/* Preview */
.slide-preview { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); overflow: auto; }

.slide-content { width: 100%; max-width: 800px; padding: 40px; font-size: 1rem; line-height: 1.8; }
.slide-content h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 16px; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.slide-content h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 12px; color: var(--secondary); }
.slide-content h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.slide-content p { margin-bottom: 12px; color: var(--text-dim); }
.slide-content ul, .slide-content ol { margin-bottom: 12px; padding-left: 24px; color: var(--text-dim); }
.slide-content li { margin-bottom: 6px; }
.slide-content code { font-family: var(--mono); font-size: 0.88em; background: var(--primary-dim); color: var(--accent); padding: 2px 6px; border-radius: 4px; }
.slide-content pre { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; overflow-x: auto; }
.slide-content pre code { background: none; padding: 0; color: var(--text); font-size: 0.82rem; line-height: 1.6; }
.slide-content blockquote { border-left: 3px solid var(--primary); padding-left: 16px; margin-bottom: 12px; color: var(--text-dim); font-style: italic; }
.slide-content strong { color: var(--text); font-weight: 600; }
.slide-content em { color: var(--secondary); }
.slide-content img { max-width: 100%; border-radius: var(--radius-sm); }
.slide-content a { color: var(--accent); text-decoration: none; }
.slide-content a:hover { text-decoration: underline; }
.slide-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Presentation Mode */
.presentation { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: flex; flex-direction: column; }
.presentation[hidden] { display: none; }
.slide-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; overflow: auto; }
.presentation .slide-content { max-width: 960px; font-size: 1.2rem; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.progress-bar { height: 3px; background: rgba(34,197,94,0.15); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.3s ease; }

.pres-controls { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; border-top: 1px solid var(--border); background: rgba(15,38,20,0.9); }

/* Slide Themes */
.theme-light .slide-content { background: #FAFDF7; color: #1A2E1D; }
.theme-light .slide-content h1 { background: linear-gradient(135deg, #16A34A, #65A30D); -webkit-background-clip: text; background-clip: text; }
.theme-light .slide-content h2 { color: #16A34A; }
.theme-light .slide-content p { color: #4B5E50; }
.theme-light .slide-content pre { background: #F0F7F1; border-color: #D1E7D5; }
.theme-light .slide-content code { background: rgba(34,197,94,0.1); color: #16A34A; }
.theme-ocean .slide-content h1 { background: linear-gradient(135deg, #3B82F6, #06B6D4); -webkit-background-clip: text; background-clip: text; }
.theme-ocean .slide-content h2 { color: #60A5FA; }
.theme-moss .slide-content h1 { background: linear-gradient(135deg, #22C55E, #A3E635); -webkit-background-clip: text; background-clip: text; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column-reverse; gap: 8px; }
.toast { padding: 10px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 0.82rem; display: flex; align-items: center; gap: 8px; animation: toastIn 0.3s ease; }
.toast.success { border-color: rgba(34,197,94,0.4); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 768px) {
  .editor-layout { grid-template-columns: 1fr; height: auto; }
  .editor-pane { height: 40vh; border-right: none; border-bottom: 1px solid var(--border); }
  .preview-pane { height: 50vh; }
  .header-inner { flex-wrap: wrap; gap: 8px; }
  .header h1 { font-size: 1rem; }
  .presentation .slide-content { font-size: 1rem; padding: 24px; }
}
