/* General Body Styling */
html, body {
    height: 100%;
    margin: 0;
}
body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #262626;
    color: #E9ECEF;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.text-gradient {
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;
            background-image: linear-gradient(to right, #CC8800, #B04000);
        }
        
/* Main Container */
.container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    padding: 5px 35px 15px 35px;
    max-width: 95%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Header Styling */
header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #CED4DA;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
}
header h1 {
    font-family: 'Georgia', serif;
    color: #262626;
    font-size: clamp(24px, 5vw, 40px);
    margin: 0 0 0 0;
}
header .tagline {
    font-family: 'Arial', sans-serif;
    color: #495057;
    font-size: 1em;
    font-style: italic;
    margin: 0;
}

.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(to right, #CC8800, #B04000);
}

/* User Info Area */
#user-info-area {
    color: #495057;
    text-align: right;
    font-size: 0.9em;
    align-content: center;
    max-width: 30%;
}
#user-info-area a.btn-small {
    color: #008080;
    padding: 2px 10px;
    font-size: 0.85em;
    border-radius: 5px;
    margin-left: 8px;
    text-decoration: none;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
}
#user-info-area a.btn-small:hover {
    background-color: #F8F9FA;
}

/* Two-Pane "Forge" Layout */
.forge-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-grow: 1;
}
.editor-pane, .chat-pane {
    display: flex;
    flex-direction: column;
    background-color: #F8F9FA;
    border-radius: 8px;
    padding: 20px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}
.editor-pane {
    flex-basis: 55%;
    position: relative; /* This is the crucial change */
}
.chat-pane { flex-basis: 45%; }

/* Editor Pane Elements */
.editor-pane label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #343A40;
}

#passage-input {
    width: 100%;
    flex-grow: 1;
    padding: 20px; /* Increased padding */
    border: none;
    border-radius: 6px;
    font-family: 'Georgia', serif; /* More readable serif font */
    font-size: 11.5pt; /* Larger font size */
    line-height: 2; /* Double-spacing */
    box-sizing: border-box;
    resize: none;
    background-color: white;
    color: #343A40;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 300px;
    max-height: 480px;
    field-sizing: content;
}
#passage-input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Chat Pane Elements */
.conversation-log {
    flex-grow: 1;
    overflow-y: auto;
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 300px;
    max-height: 480px;
}
#user-answer-input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    resize: vertical;
    margin-bottom: 10px;
    background-color: white;
    color: #343A40;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 70px;
}

/* Word Count */
.word-count {
    text-align: right;
    font-size: 0.9em;
    color: #777;
    margin-top: 8px;
}
.word-count.warning { color: #dc3545; font-weight: bold; }

/* General Button Styling */
button, .button-link {
    background-color: white;
    color: #008080;
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    text-align: center;
}
button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
button:disabled {
    background-color: #CED4DA;
    color: #6c757d;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
#submit-passage-btn:enabled:hover, #submit-answer-btn:hover {
    background-color: #008080;
    color: white;
}
#end-session-btn {
    background-color: #f8f9fa;
    color: #B04000;
    border: 1px solid #B04000;
    margin-top: 10px;
}
#end-session-btn:hover {
    background-color: #B04000;
    color: white;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 15px 0;
    color: #495057;
    font-style: italic;
    display: none;
    font-size: 1.1em;
}

/* Conversation Bubbles */
.conversation-log p {
    margin: 0 0 12px 0;
    padding: 12px 18px;
    border-radius: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    max-width: 80%;
}
.conversation-log .ai-message {
    background-color: #ffffff;
    color: #343A40;
    text-align: left;
    margin-right: auto;
}
.conversation-log .user-message {
    background-color: #d1e7dd;
    color: #0f5132;
    text-align: left; /* Keep text left-aligned for readability */
    margin-left: auto;
}
.conversation-log strong { color: #262626; }

/* Rating & Insight Controls */
.rating-controls, .insight-controls { margin-top: 10px; text-align: right; }
.rating-controls span { font-size: 0.75em; color: #6a6a6a; margin-right: 8px; }
.rating-controls .rate-btn {
    background-color: transparent;
    color: #008080;
    border: 1px solid #008080;
    padding: 4px 8px;
    font-size: 0.8em;
    border-radius: 5px;
    width: auto;
    margin: 5px 0 0 5px;
    box-shadow: none;
}
.rating-controls .rate-btn:hover { background-color: #008080; color: white; transform: none; }
.rating-controls .rate-btn:disabled { background-color: #CED4DA; border-color: #CED4DA; cursor: not-allowed; opacity: 0.7; }
.add-insight-btn {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 5px;
    color: #CC8800;
    border: 1px solid #CC8800;
    background: transparent;
    cursor: pointer;
    width: auto;
    box-shadow: none;
}
.add-insight-btn:hover { background-color: #CC8800; color: white; transform: none; }

/* General Modal Overlay */
.modal-overlay-base {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.modal-content {
    background-color: #fefefe;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    color: #343A40;
    text-align: center;
}
.modal-content h2 {
    font-family: 'Georgia', serif;
    color: #262626;
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 15px;
}
.modal-content p {
    font-size: 1.05em;
    margin-bottom: 10px;
}
.close-button {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}
.close-button:hover, .close-button:focus { color: #262626; text-decoration: none; }

/* Form elements inside modals */
.modal-content form label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
    margin-top: 15px;
}
.modal-content form input[type="text"],
.modal-content form input[type="email"],
.modal-content form input[type="password"],
.modal-content form textarea {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    background-color: #F8F9FA;
    color: #343A40;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    margin-bottom: 10px;
}
.modal-content form input:focus,
.modal-content form textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.25), inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.modal-content form button {
    margin-top: 20px;
    width: 80%;
    max-width: 250px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}
.modal-message {
    text-align: center;
    margin-top: 10px;
    color: #d9534f; /* Red for error */
    min-height: 1.2em;
}

/* Pricing Modal Specifics */
#pricing-modal .modal-content {
    max-width: 1000px;
}
.pricing-tiers-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-top: 20px;
}
.pricing-tier {
    flex: 1;
    max-width: 320px;
    background-color: #F8F9FA;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.pricing-tier h3 { margin-top: 0; font-family: 'Georgia', serif; font-size: 1.8em; }
.pricing-tier .tier-price { font-size: 1.5em; font-weight: bold; margin-bottom: 20px; }
.pricing-tier ul { list-style: none; padding: 0; text-align: left; margin-bottom: 30px; flex-grow: 1; }
.pricing-tier ul li { margin-bottom: 8px; }
.pricing-tier .tier-button { width: 80%; margin: 0 auto; }
.pricing-tier .current-tier { background-color: #CED4DA; color: #495057; cursor: default; }
.pricing-tier .select-plan-btn[data-plan="founders"] { background-color: #CC8800; color: white; }

#pricing-modal { z-index: 1001; }
#insight-modal { z-index: 1002; }

/* Footer */
footer {
    text-align: center;
    color: #aaa;
    font-size: 0.8em;
    padding: 10px;
    flex-shrink: 0;
}
footer .privacy-link { color: #ccc; text-decoration: none; }
footer .privacy-link:hover { text-decoration: underline; }

/* Responsive Adjustments */
@media (max-width: 900px) {
    html, body {
        height: auto;
        overflow: auto; /* Allow body to scroll on mobile */
    }
    .container {
        height: auto;
        padding: 15px;
    }
    .forge-container {
        flex-direction: column;
        overflow-y: auto;
    }
}
