@import url('https://fonts.googleapis.com/css2?family=Playfair+Display+SC:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&display=swap');

/* CSS variables are inherited from shared/header.css via import in HTML */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Libre Baskerville', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* Main content layout matching notes structure */
.main-content {
    display: flex;
    height: calc(100vh - 73px);
    min-height: calc(100vh - 73px);
    flex: 1;
}

.content-area {
    flex: 1;
    background: var(--bg-secondary);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* DO NOT override header styles - let shared/header.css handle everything */

/* Modern scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #444;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #666 var(--bg-tertiary);
}

[data-theme="dark"] * {
    scrollbar-color: #444 var(--bg-tertiary);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover, a:focus {
    color: var(--accent-hover);
    text-decoration: underline;
}

.katex { 
    font-size: 1.15em; 
}

/* DO NOT override any header, action-btn, or theme-toggle styles - shared/header.css handles them */

/* Only style modal and form buttons, never header buttons */
.modal button,
.form-group button,
.button-group button {
    background-color: var(--bg-secondary);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    margin: 0 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Libre Baskerville', serif;
    transition: all 0.2s ease;
}

.modal button:hover,
.form-group button:hover,
.button-group button:hover {
    background-color: var(--hover-bg);
    border-color: var(--accent-color);
}

/* Toast notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    box-shadow: var(--shadow);
    font-family: 'Libre Baskerville', serif;
}

.toast.show {
    opacity: 1;
}

/* Publications container */
.publications-container {
    flex: 1;
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 50px;
}

.container {
    max-width: 38rem;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 38em) {
    .container {
        max-width: 32rem;
    }
}

@media (min-width: 56em) {
    .container {
        max-width: 38rem;
    }
}

/* Refs-specific modal overrides */
.modal {
    display: none; /* Ensure modal is hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    width: 80%;
    max-width: 800px; /* Wider for refs */
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
}

/* Form styling */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-family: 'Libre Baskerville', serif;
}

.form-group textarea,
.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Libre Baskerville', serif;
    transition: border-color 0.2s ease;
}

.form-group textarea:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.form-group textarea {
    height: 200px;
    resize: vertical;
}

.button-group {
    margin-top: 20px;
    text-align: right;
}

.button-group button {
    margin-left: 10px;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    background-color: var(--accent-bg);
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.reference-description {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 0.5em;
    font-style: italic;
}

.modal .button {
    background-color: var(--bg-secondary);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    margin: 0 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Libre Baskerville', serif;
    transition: all 0.2s ease;
}

.modal .button:hover {
    background-color: var(--hover-bg);
    border-color: var(--accent-color);
}

.modal .button.primary {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.modal .button.primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.modal .button.danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.modal .button.danger:hover {
    background-color: #c82333;
    border-color: #c82333;
}

.key-validation {
    font-size: 0.75rem;
    font-weight: normal;
    display: inline;
}

.key-validation.valid {
    color: #28a745;
}

.key-validation.invalid {
    color: #dc3545;
}

.key-validation.conflict {
    color: #ff8c00;
}

/* Edit button styles - darker yellow text and border with transparent background */
button[onclick^="editReference"],
.edit-button {
    background-color: transparent;
    color: #d39e00;
    border: 1.5px solid #d39e00;
    padding: 6px 12px;
    margin: 0 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

button[onclick^="editReference"]:hover,
.edit-button:hover {
    background-color: #d39e00;
    border-color: #d39e00;
    color: #212529;
}

[data-theme="dark"] button[onclick^="editReference"],
[data-theme="dark"] .edit-button {
    color: #f39c12;
    border-color: #f39c12;
}

[data-theme="dark"] button[onclick^="editReference"]:hover,
[data-theme="dark"] .edit-button:hover {
    background-color: #f39c12;
    border-color: #f39c12;
    color: #1a1a1a;
}

/* Override publication card fonts for refs to match homepage */
.publication-card .publication-title,
.publication-card .publication-authors,
.publication-card .publication-description,
.publication-card .publication-button,
.publication-card .publication-badge {
    font-family: 'Libre Baskerville', serif;
}

/* Responsive styles */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}