:root {
    --bg-color: #0f111a;
    --panel-bg: rgba(255, 255, 255, 0.03);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: rgba(255, 255, 255, 0.1);
    --secondary-hover: rgba(255, 255, 255, 0.15);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.app-container {
    width: 100%;
    max-width: 1100px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; }
.logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.25rem; letter-spacing: -0.5px; }
.server-config { display: flex; align-items: center; gap: 0.75rem; }

.status-indicator {
    width: 10px; height: 10px; border-radius: 50%;
    background-color: var(--warning); box-shadow: 0 0 8px var(--warning); transition: all 0.3s ease;
}
.status-indicator.online { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.status-indicator.offline { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }

input[type="text"], input[type="number"] {
    background: rgba(0,0,0,0.2); border: 1px solid var(--panel-border);
    border-radius: 8px; padding: 0.5rem 0.75rem; color: var(--text-main);
    font-family: inherit; font-size: 0.875rem; transition: all 0.2s;
}
input[type="text"]:focus, input[type="number"]:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Buttons */
button {
    font-family: inherit; font-weight: 500; cursor: pointer; border: none;
    border-radius: 8px; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small { padding: 0.5rem 1rem; font-size: 0.875rem; background: var(--secondary); color: var(--text-main); }
.btn-small:hover:not(:disabled) { background: var(--secondary-hover); }

.btn-primary { padding: 0.75rem 1.5rem; font-size: 1rem; background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary { padding: 0.75rem 1.5rem; font-size: 1rem; background: var(--secondary); color: var(--text-main); }
.btn-secondary:hover:not(:disabled) { background: var(--secondary-hover); }

.btn-icon { padding: 0.5rem; background: transparent; color: var(--text-muted); border-radius: 6px; }
.btn-icon:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

/* Dropzone */
.step-section { padding: 2rem; animation: fadeIn 0.4s ease forwards; }
.flex-col { display: flex; flex-direction: column; gap: 1.5rem; }

.drop-zone {
    border: 2px dashed var(--panel-border); border-radius: 12px;
    padding: 4rem 2rem; text-align: center; cursor: pointer; transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: rgba(79, 70, 229, 0.05); }
.drop-zone svg { margin-bottom: 1rem; color: var(--text-muted); }

/* Workspace Editor */
.workspace-toolbar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 1.5rem; border-bottom: 1px solid var(--panel-border); }
.subtitle { color: var(--text-muted); font-size: 0.875rem; }

/* Splitter Panel */
.splitter-panel { background: rgba(0,0,0,0.2); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--primary); animation: fadeIn 0.3s ease; }
.splitter-header { margin-bottom: 1rem; }
.splitter-header h3 { font-size: 1.1rem; margin-bottom: 0.25rem; color: var(--primary); }
.splitter-header p { font-size: 0.875rem; color: var(--text-muted); }
.splitter-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.split-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 0.5rem; align-items: center; }
.split-row input { width: 100%; }
.splitter-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Editor Loading */
.editor-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 0; gap: 1rem; color: var(--text-muted); }
.big-spinner { width: 32px; height: 32px; border-width: 3px; border-top-color: var(--primary); }

/* Cards List */
.editor-list { display: flex; flex-direction: column; gap: 1.5rem; }

.chapter-card {
    background: rgba(255,255,255,0.02); border: 1px solid var(--panel-border);
    border-radius: 12px; overflow: hidden;
}
.card-header {
    padding: 1rem 1.5rem; background: rgba(0,0,0,0.2);
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--panel-border);
}
.card-title { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.card-pages { font-size: 0.75rem; background: var(--secondary); padding: 0.25rem 0.5rem; border-radius: 4px; color: var(--text-muted); }
.card-actions { display: flex; gap: 0.5rem; }

textarea.md-editor {
    width: 100%; min-height: 300px; padding: 1.5rem; background: transparent;
    border: none; color: var(--text-main); font-family: monospace; font-size: 0.9rem;
    resize: vertical; line-height: 1.6;
}
textarea.md-editor:focus { outline: none; }

.spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white; border-radius: 50%; animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
