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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    padding: 16px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 4px solid #667eea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-left h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 4px;
}

.header-left p {
    color: #666;
    font-size: 13px;
}

.header-right input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    min-width: 260px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.style-profile-label {
    font-size: 13px;
    color: #555;
}

.style-profile-select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

code {
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

.citation {
    color: #1f3a68;
    font-weight: 500;
}

/* Content Area */
.content {
    --input-width: 50%;
    display: grid;
    grid-template-columns: var(--input-width) 8px 1fr;
    flex: 1;
    padding: 15px;
    overflow: hidden;
    min-height: 0;
}

/* Panels */
.panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.panel-header h2 {
    font-size: 18px;
    color: #333;
    margin: 0;
}


.resize-divider {
    cursor: col-resize;
    background: linear-gradient(to right, #d7dee8, #a9b8cc, #d7dee8);
    border-radius: 6px;
}

.resize-divider:hover {
    background: linear-gradient(to right, #b8c5d8, #8da2bf, #b8c5d8);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Input Panel */
.input-panel {
    background: white;
}

.input-textarea {
    flex: 1;
    padding: 20px;
    border: none;
    resize: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #fafafa;
    outline: none;
}

.input-textarea::placeholder {
    color: #999;
    font-size: 13px;
}

/* Preview Panel */
.preview-panel {
    background: white;
}

.preview-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

.placeholder-text {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* Preview Styling */
.preview-heading {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: bold;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.preview-heading:first-child {
    margin-top: 0;
}

h1.preview-heading {
    font-size: 28px;
    color: #667eea;
}

h2.preview-heading {
    font-size: 22px;
    color: #764ba2;
}

h3.preview-heading {
    font-size: 18px;
    color: #666;
}

h4.preview-heading {
    font-size: 16px;
}

h5.preview-heading {
    font-size: 14px;
}

h6.preview-heading {
    font-size: 13px;
}

.preview-paragraph {
    margin-bottom: 12px;
    text-align: justify;
}

.preview-equation {
    background: #f0f4ff;
    padding: 15px 20px;
    margin: 20px 0;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-style: italic;
    text-align: center;
    color: #333;
    overflow-x: auto;
}

.preview-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    display: block;
    overflow-x: auto;
    white-space: normal;
}

.preview-content th,
.preview-content td {
    border: 1px solid #d7dee8;
    padding: 7px 9px;
    text-align: left;
}

.preview-content th {
    background: #f4f7fb;
    font-weight: 700;
}

.preview-content blockquote {
    border-left: 4px solid #8aa1bd;
    color: #4d5b69;
    margin: 16px 0;
    padding: 4px 0 4px 16px;
    font-style: italic;
}

.preview-content pre {
    background: #f6f8fa;
    border: 1px solid #d7dee8;
    border-radius: 6px;
    overflow-x: auto;
    padding: 12px;
}

.preview-caption {
    text-align: center;
    color: #4d5b69;
}

.list-level-1 {
    margin-left: 20px;
}

.list-level-2 {
    margin-left: 40px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:hover {
    background: #dee2e6;
}

/* Footer */
.footer {
    background: white;
    padding: 12px 30px;
    border-top: 1px solid #e9ecef;
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .resize-divider {
        display: none;
    }

    .panel {
        min-height: 400px;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Citation Styling */
span[class*="citation"] {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
    color: #000;
}
