:root {
    --color-primary: #860038;   
    --color-secondary: #48002e; 
    --color-tertiary: #87b0ff;  
    --color-accent: #fdb913;    
    --color-white: #fff;

    /* text */
    --color-text: #231f20;       
    --color-text-muted: #63666f; 

    /* surfaces */
    --color-bg: #ecedef;     
    --color-border: #d0d3d9; 

    /* status */
    --color-danger: #c53030;
    --color-success: #2d7a4f;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* Hartnell primary typeface */
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--color-white);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: visible;
}

.header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.chat-container {
    height: 600px;
    /* max height and increase px origionally 500*/
    overflow-y: auto;
    padding: 20px;
    background: var(--color-bg);
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    line-height: 1.5;
    position: relative;

}

.message.user .message-content {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    border-bottom-right-radius: 5px;
}

.message.bot .message-content {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 5px;
    white-space: pre-wrap;
    display: flex;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--color-white);
}

.message.user .message-avatar {
    background: var(--color-primary);
}

.message.bot .message-avatar {
    background: var(--color-accent);
}

.sources {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
    font-size: 0.9em;
    color: var(--color-text-muted);
}

.sources a {
    color: var(--color-primary);
    text-decoration: none;
    margin-right: 10px;
}

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

.htmx-indicator{
    display:none;
}

.htmx-request .htmx-indicator{
    display: flex;
}

.htmx-request.htmx-indicator{
    display: flex;
}

.input-container {
    padding: 20px;
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--color-border);
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

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

.input-group button {
    padding: 15px 30px;
    background: var(--color-accent);
    color: var(--color-secondary);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s;
}

.input-group button:hover {
    transform: translateY(-2px);
}

.input-group button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.welcome-message h3 {
    margin-bottom: 15px;
    color: var(--color-primary);
}

.sample-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.sample-question {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.review-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.review-modal-content {
    position: relative;
    color : var(--color-white);
    margin: 15% auto;
    padding: 20px;
    border: 1px solid var(--color-secondary);
    width: 40%;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    background-color: var(--color-secondary);
    font-size: 1rem;
}

.review-feedback {
    margin-top: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    font-weight: 500;
    display: block;
}

.review-feedback:empty {
    display: none;
    margin: 0;
    padding: 0;
}

.reviewMessage{
    overflow-y: auto;
}

.modal-word-count {
    font-size: 0.5em;
}

.input-word-counter {
    font-size: 10px;
    color: var(--color-text);
}


.open-modal-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
    color: var(--color-white);
}

.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    float: right;
    line-height: 1;
    color: var(--color-white);
}
.submit-review-btn {
    background: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
}
.feedback-buttons {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    justify-self: flex-end;
    white-space: nowrap;
    gap: 4px;

}

.feedback-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    opacity: 0.4;
    transition: opacity 0.2s, border-color 0.2s;

}

.feedback-btn:hover {
    opacity: 1;
}

.feedback-btn.selected {
    opacity: 1;
    border-color: #aaa;
    background: rgba(0,0,0,0.05);
}



.sample-question:hover {
    background: var(--color-border);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }

    .header h1 {
        font-size: 2em;
    }

    .message-content {
        max-width: 85%;
        position: relative;
    }
}
