/**
 * EVALORA Student Repository - Editor Styles
 * Comprehensive styling for edit-before-publish.php
 */

/* ============================================
   CSS VARIABLES & RESET
   ============================================ */

:root {
    /* Colors - Evalora Brand */
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #d1fae5;
    --primary-dark: #065f46;
    
    --secondary: #6366f1;
    --secondary-hover: #4f46e5;
    --secondary-light: #e0e7ff;
    
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-light: #fee2e2;
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    
    --success: #10b981;
    --success-light: #d1fae5;
    
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Background */
    --bg-primary: #f8f4f1;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    
    /* Text */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --text-muted: #9ca3af;
    
    /* Borders */
    --border-color: #e5e7eb;
    --border-focus: #059669;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --header-height: 64px;
    --progress-height: 48px;
    --sidebar-width: 320px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ============================================
   HEADER
   ============================================ */

.editor-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 24px;
    max-width: 1920px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.back-link:hover {
    background: var(--gray-100);
    color: var(--text-primary);
    text-decoration: none;
}

.back-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title .logo {
    height: 28px;
    width: auto;
}

.header-title span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.save-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.save-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    transition: background var(--transition);
}

.save-status.saving .status-dot {
    background: var(--warning);
    animation: pulse 1s infinite;
}

.save-status.error .status-dot {
    background: var(--danger);
}

.save-status.unsaved .status-dot {
    background: var(--gray-400);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Progress Indicator */
.publish-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 24px;
    background: var(--gray-50);
    border-top: 1px solid var(--border-color);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-tertiary);
    transition: all var(--transition);
    cursor: pointer;
}

.progress-step:hover {
    background: var(--gray-100);
}

.progress-step .step-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gray-200);
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition);
}

.progress-step.active {
    color: var(--primary);
}

.progress-step.active .step-number {
    background: var(--primary);
    color: white;
}

.progress-step.completed .step-number {
    background: var(--success);
    color: white;
}

.progress-step.completed .step-number::after {
    content: '✓';
    font-size: 12px;
}

.progress-step.completed .step-number span {
    display: none;
}

.progress-line {
    width: 40px;
    height: 2px;
    background: var(--gray-200);
    margin: 0 4px;
}

.progress-line.active {
    background: var(--primary);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-dark) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger-outline:hover:not(:disabled) {
    background: var(--danger-light);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border-radius: var(--radius);
}

.btn-icon:hover {
    background: var(--gray-100);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-block {
    width: 100%;
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    background: transparent;
    border: 1px dashed var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-add:hover {
    background: var(--primary-light);
    border-style: solid;
}

.btn-add svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

.editor-main {
    padding-top: calc(var(--header-height) + var(--progress-height));
    min-height: 100vh;
}

.paper-form {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.editor-left {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.editor-sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--progress-height) + 24px);
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   FORM SECTIONS
   ============================================ */

.form-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--gray-50);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header h2 svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
}

.section-badge {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    background: var(--gray-200);
    color: var(--text-secondary);
}

.section-badge.required {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.section-content {
    padding: 24px;
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Collapsible Sections */
.form-section.collapsible .section-header {
    cursor: pointer;
    user-select: none;
}

.form-section.collapsible .collapse-icon {
    width: 20px;
    height: 20px;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    fill: none;
    transition: transform var(--transition);
    margin-left: auto;
}

.form-section.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.form-section.collapsible.collapsed .collapsible-content {
    display: none;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
    border-color: var(--gray-400);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.input-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.input-help-text {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.char-count,
.word-count {
    font-size: 12px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Checkbox & Radio */
.checkbox-label,
.radio-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-label input,
.radio-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom,
.radio-custom {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.radio-custom {
    border-radius: 50%;
}

.checkbox-label:hover .checkbox-custom,
.radio-label:hover .radio-custom {
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkbox-custom,
.radio-label input:checked + .radio-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.radio-label input:checked + .radio-custom::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-content strong {
    font-size: 14px;
    font-weight: 600;
}

.radio-content span {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ============================================
   AUTHORS LIST
   ============================================ */

.authors-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.author-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--gray-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: grab;
    transition: all var(--transition-fast);
}

.author-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.author-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.author-drag-handle {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    cursor: grab;
}

.author-drag-handle span {
    display: block;
    width: 12px;
    height: 2px;
    background: var(--gray-400);
    border-radius: 1px;
}

.author-order {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
}

.author-info {
    flex: 1;
    min-width: 0;
}

.author-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-corresponding-badge {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 10px;
}

.author-details {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.author-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.author-actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.author-actions button svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    fill: none;
}

.author-actions button:hover {
    background: var(--gray-200);
}

.author-actions button:hover svg {
    stroke: var(--text-primary);
}

.author-actions button.delete:hover {
    background: var(--danger-light);
}

.author-actions button.delete:hover svg {
    stroke: var(--danger);
}

/* ============================================
   TIPTAP EDITOR
   ============================================ */

.tiptap-editor-wrapper {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.tiptap-editor-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.tiptap-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 8px;
}

.tiptap-toolbar button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tiptap-toolbar button:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.tiptap-toolbar button.active {
    background: var(--primary-light);
    color: var(--primary);
}

.tiptap-toolbar select {
    height: 32px;
    padding: 0 28px 0 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    cursor: pointer;
}

.tiptap-editor {
    min-height: 150px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tiptap-editor-wrapper.main-editor .tiptap-editor {
    min-height: 400px;
    font-family: var(--font-serif);
    font-size: 15px;
}

.tiptap-editor:focus {
    outline: none;
}

.tiptap-editor.ProseMirror {
    outline: none;
}

/* Tiptap Content Styles */
.tiptap-editor h1,
.tiptap-editor h2,
.tiptap-editor h3,
.tiptap-editor h4 {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.5em 0 0.5em;
}

.tiptap-editor h1:first-child,
.tiptap-editor h2:first-child,
.tiptap-editor h3:first-child {
    margin-top: 0;
}

.tiptap-editor h1 { font-size: 1.75em; }
.tiptap-editor h2 { font-size: 1.5em; }
.tiptap-editor h3 { font-size: 1.25em; }
.tiptap-editor h4 { font-size: 1.1em; }

.tiptap-editor p {
    margin: 1em 0;
}

.tiptap-editor p:first-child {
    margin-top: 0;
}

.tiptap-editor ul,
.tiptap-editor ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.tiptap-editor li {
    margin: 0.25em 0;
}

.tiptap-editor blockquote {
    margin: 1em 0;
    padding: 12px 20px;
    border-left: 4px solid var(--primary);
    background: var(--gray-50);
    font-style: italic;
    color: var(--text-secondary);
}

.tiptap-editor a {
    color: var(--primary);
    text-decoration: underline;
}

.tiptap-editor img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1em 0;
}

.tiptap-editor table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.tiptap-editor th,
.tiptap-editor td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
}

.tiptap-editor th {
    background: var(--gray-50);
    font-weight: 600;
}

.tiptap-editor hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 2em 0;
}

/* Placeholder */
.tiptap-editor p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: var(--text-muted);
    pointer-events: none;
    height: 0;
}

.tiptap-editor[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

/* ============================================
   FILE UPLOAD
   ============================================ */

.upload-area {
    margin-bottom: 16px;
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    transition: all var(--transition);
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-dropzone svg {
    width: 40px;
    height: 40px;
    stroke: var(--text-tertiary);
    stroke-width: 1.5;
    fill: none;
}

.upload-dropzone p {
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-browse {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.uploaded-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.file-icon.image {
    background: var(--secondary-light);
    color: var(--secondary);
}

.file-icon.code {
    background: var(--warning-light);
    color: var(--warning);
}

.file-icon.dataset {
    background: var(--success-light);
    color: var(--success);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.file-actions {
    display: flex;
    gap: 4px;
}

.file-actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.file-actions button svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    fill: none;
}

.file-actions button:hover {
    background: var(--gray-100);
}

.file-actions button.delete:hover {
    background: var(--danger-light);
}

.file-actions button.delete:hover svg {
    stroke: var(--danger);
}

/* Upload Progress */
.file-card.uploading .file-progress {
    display: block;
}

.file-progress {
    display: none;
    width: 100%;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.file-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width var(--transition);
}

/* ============================================
   SIDEBAR CARDS
   ============================================ */

.sidebar-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.sidebar-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sidebar-card .card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-card .card-header svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    fill: none;
}

/* Citation Preview */
#citationPreview .citation-content {
    font-family: var(--font-serif);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.citation-placeholder {
    font-style: italic;
    color: var(--text-muted);
}

.citation-url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--info-light);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--info);
    font-family: var(--font-mono);
}

.citation-url svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

/* Study Link */
.study-link-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.study-link-info svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.study-link-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.study-link-info a {
    font-size: 13px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* Notice Card */
.notice-card {
    background: var(--warning-light);
    border-color: transparent;
}

.notice-card .card-header {
    margin-bottom: 8px;
}

.notice-card .card-header svg {
    stroke: var(--warning);
}

.notice-card .card-header h3 {
    color: var(--gray-800);
}

.notice-card p {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.5;
}

/* Actions Card */
.actions-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================
   IMPORTED NOTICE
   ============================================ */

.imported-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--success-light);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.imported-notice svg {
    width: 24px;
    height: 24px;
    stroke: var(--success);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.imported-notice strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.imported-notice p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   PEER REVIEW SECTION
   ============================================ */

.peer-review-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--info-light);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.peer-review-notice svg {
    width: 20px;
    height: 20px;
    stroke: var(--info);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
    margin-top: 2px;
}

.peer-review-notice p {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.5;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-tertiary);
    stroke-width: 2;
    fill: none;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--gray-50);
}

/* Preview Modal */
.preview-modal {
    max-width: 900px;
}

.preview-modal .modal-body {
    padding: 0;
}

.paper-preview {
    padding: 48px 64px;
    max-width: 800px;
    margin: 0 auto;
    font-family: var(--font-serif);
    font-size: 14px;
    line-height: 1.8;
}

.paper-preview .preview-title {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
}

.paper-preview .preview-authors {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.paper-preview .preview-abstract {
    padding: 20px 24px;
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-bottom: 32px;
}

.paper-preview .preview-abstract-label {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.paper-preview .preview-keywords {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 16px;
}

.paper-preview h2 {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 700;
    margin: 32px 0 16px;
}

.paper-preview h3 {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    margin: 24px 0 12px;
}

/* Publish Modal */
.publish-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.checklist-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.checklist-item.valid .checklist-icon {
    background: var(--success-light);
    color: var(--success);
}

.checklist-item.invalid .checklist-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.checklist-item.warning .checklist-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.checklist-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.checklist-item.invalid .checklist-text {
    color: var(--danger);
}

.publish-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--info-light);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.publish-notice svg {
    width: 20px;
    height: 20px;
    stroke: var(--info);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.publish-notice p {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.5;
}

.publish-agreement {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.publish-agreement .checkbox-label {
    font-size: 13px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: all var(--transition);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: var(--gray-900);
}

.toast-icon {
    width: 20px;
    height: 20px;
}

.toast-icon::before {
    content: '✓';
    font-size: 16px;
}

.toast.error .toast-icon::before {
    content: '✕';
}

.toast.warning .toast-icon::before {
    content: '⚠';
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .paper-form {
        grid-template-columns: 1fr;
    }
    
    .editor-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }
    
    .header-center {
        display: none;
    }
    
    .header-title span {
        display: none;
    }
    
    .publish-progress {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 12px 16px;
    }
    
    .progress-step .step-label {
        display: none;
    }
    
    .paper-form {
        padding: 16px;
    }
    
    .section-content {
        padding: 16px;
    }
    
    .tiptap-toolbar {
        gap: 2px;
        padding: 6px 8px;
    }
    
    .toolbar-divider {
        margin: 0 4px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .btn span {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .paper-preview {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .header-right .btn-secondary {
        display: none;
    }
    
    .author-card {
        flex-wrap: wrap;
    }
    
    .author-info {
        order: 1;
        width: 100%;
        margin-top: 8px;
    }
    
    .editor-sidebar {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .editor-header,
    .editor-sidebar,
    .btn,
    .modal-overlay {
        display: none !important;
    }
    
    .editor-main {
        padding: 0;
    }
    
    .paper-form {
        display: block;
        max-width: none;
        padding: 0;
    }
    
    .form-section {
        border: none;
        break-inside: avoid;
    }
    
    .tiptap-toolbar {
        display: none;
    }
    
    .tiptap-editor {
        border: none;
        padding: 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Loading spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}