/* Ramana Website Styles */

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 2.5em;
    font-weight: normal;
    color: #444;
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.header-home {
    color: inherit;
    text-decoration: none;
}

.about-link {
    font-size: 0.85em;
    color: #8b7355;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.about-link:hover {
    text-decoration: underline;
}

/* About Page */
.about-page {
    max-width: 700px;
    margin: 0 auto;
}

.about-page h2 {
    font-size: 1.6em;
    font-weight: normal;
    color: #444;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

.about-section {
    margin-bottom: 28px;
}

.about-section h3 {
    font-size: 1.1em;
    font-weight: normal;
    color: #8b7355;
    margin-bottom: 8px;
}

.about-section p {
    font-size: 1em;
    line-height: 1.8;
    color: #555;
}

/* Gloss annotations in passage text */
.gloss-word {
    position: relative;
    border-bottom: 1px dotted #8b7355;
    cursor: help;
}

.gloss-word::after {
    content: attr(data-gloss);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #444;
    color: #f5f5f5;
    font-size: 0.82em;
    font-style: normal;
    line-height: 1.5;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: normal;
    max-width: 280px;
    width: max-content;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
}

.gloss-word:hover::after,
.gloss-word.gloss-active::after {
    opacity: 1;
}

.gloss-standalone {
    font-size: 0.88em;
    color: #999;
}

/* Nan_Yar Section */
.nan-yar-section {
    margin-bottom: 30px;
    padding: 30px;
    background-color: #fff;
    border-left: 4px solid #8b7355;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nan-yar-passage {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
    font-style: italic;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.nan-yar-passage p {
    margin: 0;
}

.nan-yar-passage .passage-source {
    margin-top: 12px;
    font-size: 0.85em;
    font-style: normal;
    color: #888;
    font-weight: normal;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}

.mode-option {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-label {
    padding: 6px 16px;
    font-size: 0.88em;
    font-family: inherit;
    color: #777;
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: all 0.2s;
    user-select: none;
}

.mode-option input[type="radio"]:checked + .mode-label {
    color: #444;
    border-color: #8b7355;
    background-color: rgba(139, 115, 85, 0.08);
}

.mode-label:hover {
    color: #555;
    border-color: #aaa;
}

/* Main Layout */
.main-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.main-content {
    flex: 2;
    min-width: 0;
}

.sidebar {
    flex: 1;
    min-width: 300px;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-top: 3px solid #8b7355;
}

.sidebar h2 {
    font-size: 1.3em;
    font-weight: normal;
    margin-bottom: 20px;
    color: #444;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Response Sections (direct mode) */
.response-section,
.expanded-response-section {
    background-color: #fff;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.response-section h2,
.expanded-response-section h2 {
    font-size: 1.5em;
    font-weight: normal;
    margin-bottom: 20px;
    color: #444;
}

.response-text,
.expanded-response-text {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
    white-space: pre-wrap;
}

.expanded-response-text {
    font-size: 1em;
    color: #666;
}

/* ── Conversation Pane (conversational mode) ── */
.conv-history {
    background-color: #fff;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.conv-turn {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.conv-turn:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.conv-question {
    font-size: 1em;
    line-height: 1.7;
    color: #777;
    margin-bottom: 10px;
    padding-left: 14px;
    border-left: 3px solid #ddd;
    white-space: pre-wrap;
}

.conv-response {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
    white-space: pre-wrap;
}

.conv-expand-link {
    display: inline-block;
    margin-top: 8px;
    padding: 0;
    font-family: inherit;
    font-size: 0.92em;
    color: #8b7355;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.conv-expand-link:hover {
    color: #6d5a42;
}

.conv-loading {
    font-size: 0.92em;
    color: #999;
    font-style: italic;
    margin-top: 8px;
}

/* ── Query Section (bottom, both modes) ── */
.query-section {
    background-color: #fff;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#query-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#query-input {
    flex: 1;
    padding: 12px 15px;
    font-family: inherit;
    font-size: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    line-height: 1.6;
    min-height: 52px;
}

#query-input:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 0 2px rgba(139, 115, 85, 0.1);
}

#submit-btn {
    padding: 12px 30px;
    font-size: 1em;
    font-family: inherit;
    background-color: #8b7355;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

#submit-btn:hover:not(:disabled) {
    background-color: #6d5a42;
}

#submit-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

/* ── Expand Modal ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 40px;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    font-size: 1.5em;
    font-weight: normal;
    margin-bottom: 20px;
    color: #444;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.6em;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}

.modal-close:hover {
    color: #555;
}

/* Passages List */
.passages-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.passage-item {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.passage-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.passage-meta {
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #777;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.passage-author {
    font-weight: bold;
    color: #555;
}

.passage-title {
    font-style: italic;
}

.passage-tradition {
    background-color: #f0f0f0;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.85em;
}

.passage-text {
    font-size: 0.95em;
    line-height: 1.7;
    color: #555;
    white-space: pre-wrap;
}

.another-voice-btn {
    display: block;
    margin: 0 auto;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 0.88em;
    color: #8b7355;
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.another-voice-btn:hover {
    border-color: #8b7355;
    background-color: rgba(139, 115, 85, 0.06);
}

.empty-message,
.loading-message,
.error-message {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

.error-message {
    color: #c66;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        min-width: 100%;
    }
    
    .passages-list {
        max-height: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .nan-yar-section,
    .query-section,
    .response-section,
    .expanded-response-section,
    .sidebar {
        padding: 20px;
    }
    
    .nan-yar-passage {
        font-size: 1em;
    }
    
    .conv-history {
        max-height: 50vh;
        padding: 15px 20px;
    }

    .modal-content {
        padding: 25px;
        width: 95%;
    }

    #query-form {
        flex-direction: column;
        align-items: stretch;
    }

    #submit-btn {
        align-self: flex-start;
    }
}
