/* St. John's University Official Brand Colors */
:root {
    --sju-red: #BA0C2F;
    --sju-red-dark: #9A0A28;
    --sju-red-light: #D50E35;
    --sju-blue: #041C2C;
    --sju-silver: #A7A8AA;
    --sju-gray-light: #F8F9FA;
    --sju-white: #FFFFFF;
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

.bg-sju-red {
    background-color: var(--sju-red) !important;
}

.text-sju-red {
    color: var(--sju-red) !important;
}

.btn-sju-red {
    background-color: var(--sju-red);
    border-color: var(--sju-red);
    color: white;
}

.btn-sju-red:hover {
    background-color: var(--sju-red-dark);
    border-color: var(--sju-red-dark);
    color: white;
}

.btn-sju-red:focus, .btn-sju-red.focus {
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.5);
}

/* Login Page Styles */
.login-page {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

.login-page .bg-sju-red {
    background: linear-gradient(135deg, var(--sju-red) 0%, var(--sju-red-dark) 100%);
}

.feature-item {
    font-size: 1.1rem;
    opacity: 0.95;
}

.card {
    border-radius: 15px;
}

.form-control:focus {
    border-color: var(--sju-red);
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.25);
}

/* Chat Page Styles */
.chat-page {
    height: 100vh;
    overflow: hidden;
}

.navbar-brand {
    font-size: 1.5rem;
}

/* Agent Cards in Sidebar */
.agent-card {
    padding: 10px;
    border-radius: 8px;
    background-color: white;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.agent-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Messages */
#chatContainer {
    height: calc(100vh - 140px);
}


#chatMessages::-webkit-scrollbar {
    width: 8px;
}

#chatMessages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: var(--sju-silver);
    border-radius: 4px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: var(--sju-red);
}

/* Chat Messages Container */
#chatMessages {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Message Structure */
.message {
    display: flex;
    margin-bottom: 20px;
    max-width: 75%;
    position: relative;
}

.message:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
}

/* Agent Messages - Left Aligned */
.agent-message {
    flex-direction: row;
    align-self: flex-start;
    background: #e3f2fd !important;
    border-radius: 15px;
    padding: 15px;
    margin-right: 20%;
    border: 2px solid #1976d2 !important;
}

/* Student Messages - Right Aligned */
.user-message {
    flex-direction: row-reverse;
    align-self: flex-end;
}

/* Message Avatar */
.message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 12px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.agent-message .message-avatar {
    background: linear-gradient(135deg, var(--sju-red) 0%, var(--sju-red-dark) 100%);
    color: white;
    order: 1;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, var(--sju-blue) 0%, #0a2a3d 100%);
    color: white;
    order: 1;
}

/* Message Content Wrapper */
.message-content {
    flex: 1;
    order: 2;
}

/* Message Header - Now at top with avatar */
.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #666;
}

.agent-message .message-header {
    justify-content: flex-start;
}

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

/* Message Bubble */
.message-bubble {
    padding: 15px 18px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.agent-message .message-bubble {
    background: white;
    border: 1px solid #ced4da;
    border-top-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-message .message-bubble {
    background: linear-gradient(135deg, var(--sju-red) 0%, var(--sju-red-light) 100%);
    color: white;
    border-top-right-radius: 6px;
}

/* Agent Label and Timestamp */
.agent-label {
    font-weight: 600;
    margin-right: 8px;
}

.agent-message .agent-label {
    color: var(--sju-red);
}

.user-message .agent-label {
    color: var(--sju-blue);
}

.timestamp {
    color: #888;
    font-size: 0.8rem;
}

/* Chat Input */
#messageInput {
    border-radius: 20px;
    border: 2px solid #dee2e6;
    padding: 12px 20px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#messageInput:focus {
    border-color: var(--sju-red);
    box-shadow: 0 0 0 0.2rem rgba(200, 16, 46, 0.15);
}

#sendButton {
    border-radius: 999px;      /* pill shape */
    height: 48px;              /* consistent control height */
    padding: 0 16px;           /* room for icon + text */
    min-width: 110px;          /* prevents cramped text */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;                  /* space between icon and text */
    white-space: nowrap;       /* keep content on one line */
    font-size: 1rem;           /* readable label size */
    transition: all 0.2s ease;
}

#sendButton i { 
    font-size: 1.15rem; 
}

#sendButton:hover {
    transform: scale(1.05);
}

/* Loading Animation */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .message-container {
        max-width: 95%;
    }
    
    .message {
        padding: 12px;
    }
    
    .navbar-text {
        display: none !important;
    }
    
    #chatContainer {
        height: calc(100vh - 120px);
    }
}

/* Accessibility Improvements */
.message:focus {
    outline: 2px solid var(--sju-red);
    outline-offset: 2px;
}

/* Animation for new messages */
.message-container {
    animation: fadeInUp 0.3s ease-out;
}

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

/* Modal Improvements */
.modal-content {
    border-radius: 15px;
    border: none;
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 15px 15px 0 0;
}

/* Alert Styling */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-info {
    background-color: #d1ecf1;
    color: #055160;
}

/* Button Styling */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Form Styling */
.form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    transition: all 0.2s ease;
}

.form-control:focus {
    transform: translateY(-1px);
}

/* Dropdown Styling */
.dropdown-menu {
    border-radius: 10px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dropdown-item:hover {
    background-color: var(--sju-red);
    color: white;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.lead {
    font-weight: 400;
    opacity: 0.9;
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-sju-red {
    border-color: var(--sju-red) !important;
}

/* Print Styles */
@media print {
    .navbar, .modal, .btn, #chatForm {
        display: none !important;
    }
    
    .message {
        break-inside: avoid;
        margin-bottom: 10px;
    }
}

/* Range slider track visibility (questionnaire 7c confidence sliders, etc.) */
.form-range {
    height: 1.5rem;
}

.form-range::-webkit-slider-runnable-track {
    height: 0.5rem;
    background-color: #ced4da;
    border-radius: 1rem;
    border: 1px solid #adb5bd;
}

.form-range::-moz-range-track {
    height: 0.5rem;
    background-color: #ced4da;
    border-radius: 1rem;
    border: 1px solid #adb5bd;
}

.form-range::-webkit-slider-thumb {
    margin-top: -0.3rem;
}
