/* ==========================================
   Google Fonts - Inter (Modern, minimalistic)
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ==========================================
   CSS Variables for Consistent Theming
   ========================================== */
:root {
    --primary-color: #990000;
    --primary-hover: #d4a5a5;
    --text-color: #2c3e50;
    --text-light: #5a6c7d;
    --bg-color: #f5f5f5;
    --card-bg: #fafafa;
    --border-color: #e5e7eb;
    --white: #fff;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.15);

    /* Typography - Modern, minimalistic font stack */
    --font-system: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 16px;
    --font-size-lg: 20px;
    --font-size-homepage: 21px;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.7;
}

/* ==========================================
   Base Styles
   ========================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-system);
    font-size: var(--font-size-base);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: var(--line-height-base);
}

/* ==========================================
   Layout Container
   ========================================== */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    max-width: 1000px;
    word-wrap: break-word;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   Navigation
   ========================================== */
nav {
    background-color: #2c3e50;
    color: var(--white);
    padding: 14px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

nav h2 {
    margin: 0;
    font-size: 1.6em;
    font-weight: 500;
    letter-spacing: -0.02em;
}

nav h2 a {
    color: var(--white);
    text-decoration: none;
    border-bottom: none;
    transition: opacity 0.3s ease;
}

nav h2 a:hover {
    opacity: 0.85;
}

.horizontal-nav {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 8px;
}

.horizontal-nav li {
    margin-left: 0;
}

.horizontal-nav a {
    text-decoration: none;
    color: var(--white);
    font-weight: 500;
    font-size: 1.05em;
    padding: 8px 18px;
    transition: all 0.2s ease;
    border-bottom: none;
    border-radius: 6px;
}

.horizontal-nav a.active {
    background-color: rgba(153, 0, 0, 0.2);
    color: var(--white);
}

.horizontal-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================
   Homepage / Profile Section
   ========================================== */
.profile-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
    padding: 35px 30px;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.profile-image-wrapper {
    flex-shrink: 0;
    width: 340px;
}

.profile-image {
    width: 100%;
    height: auto;
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.profile-text {
    flex: 1;
    min-width: 0;
}

.profile-text p {
    margin-bottom: 12px;
}

.profile-text p:last-child {
    margin-bottom: 0;
}

.profile-text strong {
    font-weight: 600;
}

.profile-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.profile-text a:hover {
    text-decoration: underline;
}

.research-tagline {
    text-align: center;
    margin-bottom: 12px;
    margin-top: 0;
    font-size: 2.4em;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

.research-subtitle {
    text-align: center;
    font-size: 1.3em;
    font-weight: 400;
    color: var(--text-light);
    margin-bottom: 40px;
    line-height: 1.5;
}

/* ==========================================
   Social Links
   ========================================== */
.social-links {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 800px;
    margin: 30px auto;
}

.social-links a {
    color: var(--text-color);
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.social-links a:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(153, 0, 0, 0.2);
}

/* ==========================================
   Publication Cards (Research & Teaching)
   ========================================== */
.pub-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 10px 0 12px;
    background: var(--white);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pub-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.1);
}

.pub-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pub-title {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.05em;
}

.pub-title:hover {
    color: var(--primary-color);
}

.publication-info {
    font-style: italic;
    opacity: 0.85;
    font-size: 0.95em;
}

.author-names {
    font-weight: 600;
    font-size: 0.95em;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.mini-btn {
    display: inline-block;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #ddd;
    text-decoration: none;
    line-height: 1.2;
    background: var(--white);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.mini-btn:hover {
    background: #f3f4f6;
}

.abstract-container {
    display: none;
    border-top: 1px dashed var(--border-color);
    margin-top: 8px;
    padding-top: 8px;
    line-height: 1.6;
}

/* ==========================================
   PDF Download Section
   ========================================== */
.pdf-download-section {
    text-align: center;
    padding: 30px 20px;
    background: var(--bg-color);
    border-radius: 8px;
    margin: 20px 0;
}

.pdf-download-section p {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: var(--text-color);
}

.pdf-download-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.pdf-download-btn:hover {
    background: #770000;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   General Link Styling
   ========================================== */
a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================
   Headings
   ========================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    margin-top: 1.3em;
    margin-bottom: 0.5em;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.2em;
    font-weight: 700;
}

h2 {
    font-size: 1.7em;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 0.8em;
}

h3 {
    font-size: 1.35em;
    font-weight: 600;
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        align-items: center;
        padding: 12px 15px;
    }

    nav h2 {
        text-align: center;
        margin-bottom: 12px;
        font-size: 1.4em;
    }

    .horizontal-nav {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .horizontal-nav li {
        margin: 0;
    }

    .horizontal-nav a {
        font-size: 0.95em;
        padding: 7px 14px;
    }

    .container {
        padding: 15px;
    }

    .profile-container {
        flex-direction: column;
        align-items: center;
        padding: 24px 18px;
        font-size: 14px;
    }

    .profile-image-wrapper {
        width: 100%;
        margin-bottom: 20px;
    }

    .profile-image {
        max-width: 280px;
    }

    .research-tagline {
        font-size: 1.8em;
    }

    .research-subtitle {
        font-size: 1.15em;
    }
}

@media (max-width: 480px) {
    .profile-image {
        max-width: 200px;
    }

    .social-links {
        flex-direction: column;
        align-items: center;
    }

    .social-links a {
        width: 200px;
        text-align: center;
    }
}

/* ==========================================
   AI Assistant Chat Widget
   ========================================== */
.ai-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: var(--font-system);
}

.ai-widget-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.ai-widget-toggle:hover {
    background: #770000;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-icon {
    font-size: 20px;
}

.ai-widget-chat {
    display: flex;
    flex-direction: column;
    width: 380px;
    height: 550px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--primary-color);
    color: var(--white);
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
}

.ai-chat-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-chat-intro {
    padding: 20px;
    background: #f9f9f9;
    border-bottom: 1px solid var(--border-color);
}

.ai-chat-intro p {
    margin: 0 0 12px 0;
    color: var(--text-color);
    font-size: 14px;
}

.ai-suggested-questions {
    margin-top: 12px;
}

.ai-suggested-questions p {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.ai-suggestion {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion:hover {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--white);
}

.ai-message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
}

.ai-message-user .ai-message-content {
    background: var(--primary-color);
    color: var(--white);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant .ai-message-content {
    background: var(--bg-color);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.ai-message-sources {
    margin-top: 6px;
    padding-left: 14px;
    font-size: 12px;
    color: #666;
}

.ai-loading .ai-message-content {
    opacity: 0.7;
}

.ai-loading .ai-message-content::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.ai-chat-input-wrapper {
    display: flex;
    padding: 12px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-family: var(--font-system);
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: var(--primary-color);
}

.ai-chat-send {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-chat-send:hover {
    background: #770000;
}

.ai-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ai-chat-footer {
    padding: 8px 12px;
    text-align: center;
    background: #f9f9f9;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: #999;
}

/* Mobile responsiveness for chat widget */
@media (max-width: 480px) {
    .ai-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .ai-widget-chat {
        width: 100%;
        height: 500px;
    }

    .ai-widget-toggle {
        width: 100%;
        justify-content: center;
    }
}
