/* CSS Variables for Theming */
:root {
    --bg-color: #ffffff;
    --panel-bg: #fafafa;
    --border-color: #e1e5e9;
    --text-color: #2c3e50;
    --text-secondary: #7f8c8d;
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 6px;
    --header-height: 70px;
    --panel-header-height: 50px;
    --toolbar-height: 40px;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    --transition: all 0.2s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --panel-bg: #2d2d2d;
    --border-color: #404040;
    --text-color: #e8e8e8;
    --text-secondary: #b0b0b0;
    --accent-color: #5dade2;
    --accent-hover: #3498db;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background: var(--bg-color);
    height: 100vh;
    overflow: hidden;
    transition: var(--transition);
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-left {
    flex: 0 0 auto;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-title i {
    color: var(--accent-color);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-color);
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.toolbar-group {
    display: flex;
    gap: 2px;
}

.toolbar-btn {
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 2px;
    transition: var(--transition);
    min-width: 32px;
    justify-content: center;
}

.toolbar-btn:hover {
    background: var(--accent-color);
    color: white;
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

/* Action Buttons */
.action-btn, .panel-btn, .theme-toggle {
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    font-family: var(--font-family);
}

.action-btn:hover, .panel-btn:hover, .theme-toggle:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: var(--shadow-hover);
}

.action-btn.primary {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.action-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.theme-toggle {
    padding: 8px;
    min-width: 36px;
    justify-content: center;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* Panels */
.editor-panel, .preview-panel {
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
}

.editor-panel {
    flex: 1;
}

.preview-panel {
    flex: 1;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.panel-header {
    height: var(--panel-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Splitter */
.splitter {
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    transition: var(--transition);
    z-index: 10;
}

.splitter:hover {
    background: var(--accent-color);
}

/* Editor */
.editor-container {
    flex: 1;
    overflow: hidden;
}

#editor {
    height: 100%;
    font-family: var(--font-mono);
}

.editor-footer {
    height: 32px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.editor-info {
    display: flex;
    gap: 16px;
}

/* Preview */
.preview-container {
    flex: 1;
    overflow: auto;
    background: #f8f9fa;
    position: relative;
}

[data-theme="dark"] .preview-container {
    background: #1e1e1e;
}

#pdf-viewer {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.preview-placeholder p {
    margin-bottom: 8px;
}

.preview-hint {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* PDF Canvas */
.pdf-page {
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    background: var(--panel-bg);
    padding: 32px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-hover);
    color: var(--text-color);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 16px;
}

.loading-spinner.show {
    display: flex;
}

/* Shortcuts Help */
.shortcuts-help {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-hover);
    z-index: 1001;
    display: none;
    min-width: 300px;
}

.shortcuts-help.show {
    display: block;
}

.shortcuts-help h4 {
    margin-bottom: 16px;
    color: var(--text-color);
    text-align: center;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

kbd {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-color);
}

/* Status Indicators */
.status-ready { color: var(--success-color); }
.status-compiling { color: var(--warning-color); }
.status-error { color: var(--danger-color); }

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px;
    }
    
    .header-center {
        order: 3;
        flex: 100%;
        margin-top: 12px;
    }
    
    .toolbar {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-content {
        flex-direction: column;
        height: calc(100vh - 120px);
    }
    
    .editor-panel, .preview-panel {
        flex: 1;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .preview-panel {
        border-left: none;
        border-bottom: none;
    }
    
    .splitter {
        display: none;
    }
}

/* Zoom Controls */
#zoom-level {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    min-width: 40px;
    text-align: center;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Selection */
::selection {
    background: var(--accent-color);
    color: white;
}

/* Focus Styles */
button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Animation for smooth transitions */
.panel-transition {
    transition: flex 0.3s ease;
}
.latexjs-container {
    padding: 20px;
    background: white;
    max-width: 8.5in;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.advanced-html-preview {
    padding: 20px;
    background: #f5f5f5;
    height: 100%;
    overflow-y: auto;
}

.document-container {
    max-width: 8.5in;
    margin: 0 auto;
    background: white;
    padding: 0.75in;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.6;
    font-size: 10pt;
}

.center-block {
    text-align: center;
    margin-bottom: 1em;
}

.large-bold {
    font-size: 1.2em;
    font-weight: bold;
    margin: 0;
    line-height: 1.2;
}

.section-header {
    font-size: 1em;
    font-weight: bold;
    margin: 0.9em 0 0.8em 0;
    padding-bottom: 2px;
    border-bottom: 1px solid #000;
}

.hfill {
    float: right;
}

.right-line {
    text-align: right;
    margin-bottom: 0.5em;
}

.medium-skip {
    height: 0.5em;
}

.vspace {
    height: -1.75em;
    margin-top: -1.75em;
}

.line-break-spacing {
    margin-bottom: 2pt;
}

.document-container a {
    color: #0066cc;
    text-decoration: none;
}

.document-container a:hover {
    text-decoration: underline;
}

.document-container ul {
    margin: 0;
    padding-left: 1.5em;
}

.document-container li {
    margin: 0;
    padding: 0;
}

.document-container p {
    margin: 0 0 1em 0;
    text-align: justify;
}

.advanced-html-preview {
    padding: 20px;
    background: #f5f5f5;
    height: 100%;
    overflow-y: auto;
}

.document-container {
    max-width: 8.5in;
    margin: 0 auto;
    background: white;
    padding: 0.75in;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.4;
    font-size: 11pt;
    color: #000;
}

.resume-name {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    margin: 0 0 0.3em 0;
    line-height: 1.2;
    color: #000;
}

.text-center {
    text-align: center;
    margin-bottom: 1.5em;
    line-height: 1.3;
}

.text-center a {
    color: #0066cc;
    text-decoration: none;
}

.text-center a:hover {
    text-decoration: underline;
}

.resume-section {
    font-size: 1em;
    font-weight: bold;
    margin: 1.5em 0 0.8em 0;
    padding-bottom: 2px;
    border-bottom: 1px solid #000;
    text-transform: uppercase;
    color: #000;
}

.resume-subsection {
    font-size: 0.95em;
    font-weight: bold;
    margin: 1.2em 0 0.6em 0;
    color: #000;
}

.pull-right {
    float: right;
    font-weight: normal;
}

.text-right {
    text-align: right;
    margin: 0.2em 0;
    font-weight: normal;
}

.spacing-medium {
    height: 0.8em;
}

.spacing-custom {
    height: 0.5em;
}

.spaced-break {
    margin-bottom: 2pt;
}

.resume-list {
    margin: 0.5em 0 1em 0;
    padding-left: 1.2em;
    list-style-type: disc;
}

.resume-list li {
    margin: 0.2em 0;
    line-height: 1.3;
    color: #000;
}

.resume-item {
    margin: 0.8em 0;
    line-height: 1.3;
}

.job-header {
    display: flex;
    justify-content: space-between;
    margin: 0.8em 0 0.3em 0;
    line-height: 1.2;
}

.job-header strong {
    color: #000;
}

.location {
    font-weight: normal;
    color: #000;
}

.document-container p {
    margin: 0.5em 0;
    line-height: 1.3;
    color: #000;
}

.document-container strong {
    font-weight: bold;
    color: #000;
}

.document-container em {
    font-style: italic;
    color: #000;
}

/* Fix for dark theme */
[data-theme="dark"] .document-container {
    background: white;
    color: #000;
}

[data-theme="dark"] .document-container * {
    color: #000 !important;
}

/* Print-like formatting */
.document-container br {
    line-height: 0.8;
}

/* Better spacing for resume sections */
.document-container > p:first-of-type {
    margin-top: 0;
}

.document-container h2:first-child {
    margin-top: 0;
}

.advanced-html-preview {
    padding: 20px;
    background: #f5f5f5;
    height: 100%;
    overflow-y: auto;
}

.document-container {
    max-width: 8.5in;
    margin: 0 auto;
    background: white;
    padding: 0.75in;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.4;
    font-size: 10pt;
    color: #000;
}

/* Name styling - larger and centered */
.resume-name {
    text-align: center;
    font-size: 14pt;
    font-weight: bold;
    margin: 0 0 4pt 0;
    line-height: 1.2;
    color: #000;
    letter-spacing: 0.5pt;
}

/* Contact info - centered, smaller, with proper spacing */
.text-center {
    text-align: center;
    margin-bottom: 12pt;
    line-height: 1.2;
    font-size: 9pt;
}

.text-center a {
    color: #0066cc;
    text-decoration: none;
}

.text-center a:hover {
    text-decoration: underline;
}

/* Section headers - bold, with underline, proper spacing */
.resume-section {
    font-size: 11pt;
    font-weight: bold;
    margin: 14pt 0 8pt 0;
    padding-bottom: 1pt;
    border-bottom: 1px solid #000;
    text-transform: uppercase;
    color: #000;
    letter-spacing: 0.3pt;
}

/* Job/Education entries */
.job-entry {
    margin: 8pt 0 4pt 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.job-title {
    font-weight: bold;
    font-size: 10pt;
}

.job-location-date {
    font-weight: normal;
    font-size: 10pt;
    text-align: right;
}

.job-subtitle {
    font-style: italic;
    margin: 2pt 0 4pt 0;
    font-size: 10pt;
}

.job-subtitle-with-date {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-style: italic;
    margin: 2pt 0 4pt 0;
    font-size: 10pt;
}

/* Project/subsection headers */
.project-header {
    font-weight: bold;
    margin: 6pt 0 2pt 0;
    font-size: 10pt;
}

/* Lists - tighter spacing, proper indentation */
.resume-list {
    margin: 4pt 0 8pt 0;
    padding-left: 16pt;
    list-style-type: disc;
}

.resume-list li {
    margin: 1pt 0;
    line-height: 1.3;
    color: #000;
    font-size: 10pt;
}

/* Paragraphs */
.document-container p {
    margin: 4pt 0;
    line-height: 1.3;
    color: #000;
    font-size: 10pt;
    text-align: justify;
}

/* Remove spacing between certain elements */
.no-margin {
    margin: 0;
}

/* Skills list - inline format */
.skills-list {
    margin: 2pt 0;
    padding: 0;
    list-style: none;
}

.skills-list li {
    margin: 1pt 0;
    padding: 0;
}

/* Better text alignment and spacing */
.text-right {
    text-align: right;
    font-weight: normal;
}

/* Ensure consistent font weights */
.document-container strong {
    font-weight: bold;
    color: #000;
}

.document-container em {
    font-style: italic;
    color: #000;
    font-weight: normal;
}

/* Tighter line spacing for contact info */
.contact-line {
    margin: 0;
    padding: 0;
    line-height: 1.1;
}


/* Computer Modern font from cdn */
@font-face {
    font-family: 'Computer Modern';
    src: url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@latest/fonts/CMUSerif-Roman.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@latest/fonts/CMUSerif-Roman.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Computer Modern';
    src: url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@latest/fonts/CMUSerif-Bold.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@latest/fonts/CMUSerif-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Computer Modern';
    src: url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@latest/fonts/CMUSerif-Italic.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/gh/aaaakshat/cm-web-fonts@latest/fonts/CMUSerif-Italic.woff') format('woff');
    font-weight: normal;
    font-style: italic;
}

