/* Chat Panel Base Styles */
.unified-chat-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.unified-chat-panel.active {
    right: 0;
}

/* Chat Panel Header */
.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    flex-shrink: 0;
}

.tutor-info-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tutor-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.tutor-details h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.tutor-specialty {
    font-size: 14px;
    opacity: 0.8;
}

/* Chat Controls */
.chat-controls {
    display: flex;
    gap: 10px;
}

.chat-controls button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

#bloomberg-chat {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Loading State */
.chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar */
.session-progress {
    padding: 15px 20px;
    background: #f0f0f0;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-right: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    transition: width 0.3s ease;
}

.prompts-remaining {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

/* Overlay for mobile */
.chat-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
}

.chat-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .unified-chat-panel {
        width: 100%;
        right: -100%;
    }
    
    .unified-chat-panel.active {
        right: 0;
    }
    
    body.chat-panel-open {
        overflow: hidden;
    }
}

/* Tutor Card Active State */
.tutor-card.in-session {
    position: relative;
    transform: scale(1.02);
    opacity: 1;
    box-shadow: 0 0 0 3px #6cffc4, 0 10px 40px rgba(108, 255, 196, 0.3);
    z-index: 10;
}

.tutor-card.in-session::after {
    content: "Session Active";
    position: absolute;
    top: 15px;
    right: 15px;
    background: #4CAF50;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Minimized State */
.unified-chat-panel.minimized {
    transform: translateY(calc(100% - 60px));
}

.unified-chat-panel.minimized .chat-container,
.unified-chat-panel.minimized .session-progress {
    display: none;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    display: flex;
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease-out;
}

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

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

.message.assistant {
    justify-content: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 10px;
    flex-shrink: 0;
}

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

.message.user .message-avatar {
    order: 2;
    margin-right: 0;
    margin-left: 10px;
}

.message-content {
    max-width: 70%;
}

.message-text {
    background: #e9ecef;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.message.user .message-text {
    background: #007bff;
    color: white;
}

.message.assistant .message-text {
    background: #f1f3f5;
    color: #333;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #dee2e6;
    gap: 10px;
}

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

.chat-input:focus {
    border-color: #007bff;
}

.send-button {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.send-button:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

/* Loading State for Tutor Cards */
.tutor-card.loading {
    pointer-events: none;
}

.tutor-card.loading .action-btn {
    position: relative;
    color: transparent;
}

.tutor-card.loading .action-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* Limit Reached Modal */
.limit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.limit-modal {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    animation: modalSlide 0.3s ease-out;
}

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

.limit-modal h2 {
    margin: 0 0 15px;
    color: #333;
    font-size: 24px;
}

.limit-modal p {
    margin: 0 0 30px;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.limit-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-signup,
.btn-cancel {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signup {
    background: #007bff;
    color: white;
}

.btn-signup:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.btn-cancel {
    background: #e9ecef;
    color: #495057;
}

.btn-cancel:hover {
    background: #dee2e6;
}

/* Session Restore Prompt - Unified Interface Style */
.session-restore-prompt {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, rgba(16, 43, 48, 0.98) 0%, rgba(13, 53, 62, 0.98) 100%);
    border: 2px solid #1b5059;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(108, 255, 196, 0.1);
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-width: 380px;
    animation: slideUpGlow 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.session-restore-prompt::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #6CFFC4, #4DCCA1);
    border-radius: 20px;
    opacity: 0.1;
    z-index: -1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes slideUpGlow {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.1;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.02);
    }
}

.session-restore-prompt p {
    margin: 0 0 20px;
    font-size: 16px;
    color: #FFFFFF;
    font-weight: 400;
    line-height: 1.5;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.session-restore-prompt button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.restore-yes {
    background: linear-gradient(135deg, #1b5059, #2a6a73);
    color: #FFFFFF;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.restore-yes::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(108, 255, 196, 0.2), transparent);
    transition: left 0.5s;
}

.restore-yes:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(108, 255, 196, 0.2);
}

.restore-yes:hover::before {
    left: 100%;
}

.restore-no {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.restore-no:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(108, 255, 196, 0.3);
    transform: scale(1.02);
}

/* Chat Error Message */
.chat-error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
}

.chat-error-message p {
    margin: 0 0 20px;
    font-size: 16px;
    color: #666;
}

.retry-connection {
    padding: 10px 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.retry-connection:hover {
    background: #0056b3;
    transform: scale(1.05);
}