:root {
    --bg-color: #1e1e24;
    --sidebar-bg: #25252d;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary: #4cc9f0;
    --primary-hover: #4895ef;
    --section-bg: #2b2b36;
    --border-color: #3e3e4a;
    --input-bg: #18181d;
    --danger: #ff6b6b;
    --success: #4cc9f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.top-bar {
    background: rgba(30, 30, 36, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.top-bar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

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

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

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

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

/* Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.search-box {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-box input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 6px;
    color: var(--text-color);
}

.volume-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.volume-item {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 2px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.volume-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-color);
}

.volume-item.active {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--primary);
}

/* Editor Area */
.editor-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
}

.editor-content {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

.hidden {
    display: none !important;
}

.volume-header {
    background-color: var(--section-bg);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.volume-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Input group for button + input */
.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

/* Sections Editor */
.sections-editor {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.sections-editor h3 {
    font-size: 0.9rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
}

.section-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.section-tag {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.remove-tag {
    cursor: pointer;
    color: var(--danger);
    font-weight: bold;
}

/* Articles */
.articles-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-card {
    background-color: var(--section-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s;
}

.article-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.article-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    align-items: center;
}

.article-id-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--primary);
    font-family: "Inter", sans-serif;
    font-size: 1rem;
    padding: 0.5rem;
    width: 350px;
    text-align: left;
    border-radius: 6px;
    font-weight: 500;
}

.article-id-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.article-authors {
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.authors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.authors-header h4 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.author-item {
    background: var(--section-bg);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    position: relative;
}

.author-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.remove-author-btn {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.25rem;
    opacity: 0.6;
}

.remove-author-btn:hover {
    opacity: 1;
}

.btn-small {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--sidebar-bg);
    width: 90%;
    height: 90%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

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

.modal-header h3 {
    margin: 0;
}

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

#pdfFrame {
    flex: 1;
    border: none;
    background: #fff;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 30, 36, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Quill Dark Mode Overrides */
.ql-toolbar.ql-snow {
    border-color: var(--border-color) !important;
    background-color: var(--section-bg);
}

.ql-toolbar .ql-stroke {
    stroke: var(--text-color) !important;
}

.ql-toolbar .ql-fill {
    fill: var(--text-color) !important;
}

.ql-toolbar .ql-picker {
    color: var(--text-color) !important;
}

.ql-container.ql-snow {
    border-color: var(--border-color) !important;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
}

.ql-editor {
    min-height: 150px;
}

.ql-editor strong {
    font-weight: bold;
}

/* ... (previous styles) ... */

/* Chip Input */
.chip-group-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 0;
}

.chip {
    background-color: rgba(76, 201, 240, 0.2);
    color: var(--text-color);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(76, 201, 240, 0.3);
}

.chip .remove-chip {
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 0.8;
}

.chip .remove-chip:hover {
    color: var(--text-color);
}

.chip-input {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}

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