/* Pavingbot Chat Page - Menu-Driven v2.0 */

.pavingbot-chat-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header - Compact */
.chat-header {
    background: linear-gradient(135deg, #0d3b59 0%, #1a5f8a 100%);
    border-radius: 10px;
    color: #fff;
    margin-bottom: 15px;
    padding: 14px 20px;
}

.chat-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.chat-header-text h1 {
    font-size: 20px;
    margin: 0 0 2px 0;
    font-weight: 700;
    text-align: right;
}

.chat-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
    text-align: right;
}

.chat-experts {
    display: flex;
    gap: 12px;
}

.expert {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    padding: 6px 12px;
    border-radius: 20px;
}

.expert-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.expert-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0d3b59, #1a5f8a);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.expert-info {
    text-align: left;
}

.expert-info strong {
    display: block;
    font-size: 12px;
    line-height: 1.2;
}

.expert-info span {
    font-size: 10px;
    opacity: 0.8;
}

/* Container */
.chat-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 15px;
    min-height: 580px;
}

/* Sidebar */
.chat-sidebar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: 700px;
}

.chat-sidebar h3 {
    font-size: 13px;
    color: #0d3b59;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #0d3b59;
}

/* Menu Buttons */
.menu-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-btn {
    display: block;
    width: 100%;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #333;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.3;
}

.menu-btn:hover {
    border-color: #0d3b59;
    background: #f0f7ff;
}

.menu-btn.active {
    background: #0d3b59;
    color: #fff;
    border-color: #0d3b59;
}

.menu-btn-back {
    background: #f5f5f5;
    border-style: dashed;
    color: #666;
    font-size: 11px;
    margin-top: 6px;
}

.menu-btn-back:hover {
    background: #eee;
    color: #333;
}

.menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

.menu-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    padding: 4px 0;
    font-weight: 600;
}

/* Main Chat Area */
.chat-main {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ddd;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    min-height: 500px;
    max-height: 580px;
    background: #fafafa;
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-message .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-message .avatar .fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #0d3b59;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.chat-message.user .avatar .fallback {
    background: #6c757d;
}

.chat-message .content {
    max-width: 80%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chat-message.user .content {
    background: #0d3b59;
    color: #fff;
    border-color: #0d3b59;
}

.chat-message .name {
    font-weight: 600;
    font-size: 11px;
    color: #0d3b59;
    margin-bottom: 3px;
}

.chat-message.user .name {
    color: rgba(255,255,255,0.8);
}

.chat-message .text {
    font-size: 13px;
    line-height: 1.5;
}

.chat-message .text a {
    color: #0d3b59;
    text-decoration: underline;
}

.chat-message.user .text a {
    color: #fff;
}

/* User choice pill */
.user-choice {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}

.user-choice span {
    background: #0d3b59;
    color: #fff;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
}

/* Read More Button */
.chat-read-more {
    display: inline-block;
    background: #0d3b59;
    color: #fff !important;
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none !important;
    margin-top: 8px;
    font-size: 12px;
    transition: background 0.2s;
}

.chat-read-more:hover {
    background: #1a5f8a;
}

/* Related Links */
.chat-related {
    margin: 8px 0 0 0;
    padding: 0;
    list-style: none;
}

.chat-related li {
    margin-bottom: 3px;
}

.chat-related a {
    font-size: 12px;
    color: #0d3b59;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #0d3b59;
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Suggestions */
.chat-suggestions {
    background: #fff;
    border-top: 1px solid #eee;
    max-height: 160px;
    overflow-y: auto;
    display: none;
}

.chat-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}

.suggestion-item:hover {
    background: #f0f7ff;
}

/* Input Area */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #eee;
}

#chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #0d3b59;
}

#chat-send {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: #0d3b59;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#chat-send:hover {
    background: #1a5f8a;
}

#chat-send svg {
    width: 14px;
    height: 14px;
}

/* Responsive */
@media (max-width: 900px) {
    .chat-container {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        max-height: none;
    }
    
    .chat-header-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .chat-experts {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .pavingbot-chat-page {
        padding: 10px;
    }
    
    .chat-header {
        padding: 12px 14px;
    }
    
    .chat-header-text h1 {
        font-size: 18px;
    }
    
    .chat-experts {
        flex-direction: column;
        gap: 8px;
    }
    
    .chat-message .content {
        max-width: 90%;
    }
    
    #chat-send span {
        display: none;
    }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.chat-sidebar::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-sidebar::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
