/**
 * AI Chat Widget Styles
 * Author: Gocha Shevardnadze
 * Description: Standalone AI chat widget for portfolio
 */

/* ===== AI CHAT WIDGET STYLES ===== */

.ai-chat-container {
    position: fixed;
    left: 24px;
    top: 24px;
    width: calc(33.3333% - 48px);
    height: calc(100vh - 48px);
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #daa520 0%, #b8941a 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header .left-section {
    display: flex;
    align-items: center;
    flex: 1;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-avatar i {
    font-size: 20px;
    color: #fff;
}

.chat-favicon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.chat-favicon:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.chat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.chat-info h4 {
    color: #fff;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.status.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4CAF50;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #1a1a1a;
    scrollbar-width: thin;
    scrollbar-color: #daa520 #333;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #333;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #daa520;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #daa520 0%, #b8941a 100%);
    color: #fff;
    border-radius: 50%;
    overflow: hidden;
}

.ai-message .message-avatar .chat-favicon {
    width: 20px;
    height: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.user-message .message-avatar {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: #fff;
    margin-right: 0;
    margin-left: 12px;
}

.user-message .message-avatar i::before {
    content: '\f007'; /* fa-user */
}

.message-content {
    flex: 1;
    background: #2d2d2d;
    padding: 12px 16px;
    color: #fff;
    line-height: 1.5;
    max-width: 80%;
    border: 1px solid #444;
}

.user-message .message-content {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #45a049;
}

.ai-message .message-content {
    border-color: #444;
}

.message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
    font-size: 13px;
}

/* Enhanced Message Headers */
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sender-name {
    font-size: 12px;
    font-weight: 600;
    color: #daa520;
}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* Enhanced Message Content */
.message-content strong {
    color: #daa520;
    font-weight: 600;
}

.message-content em {
    color: #fff;
    font-style: italic;
}

.message-content code {
    background: rgba(218, 165, 32, 0.2);
    color: #daa520;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Enhanced Typing Indicator */
.typing-indicator .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
}

.typing-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    margin-top: 4px;
    font-style: italic;
}

/* Message Animations */
.message {
    transition: all 0.3s ease;
}

.message:hover {
    transform: translateX(2px);
}

.message:hover .message-content {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Enhanced Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
}

.quick-btn {
    background: rgba(218, 165, 32, 0.15);
    border: 1px solid rgba(218, 165, 32, 0.3);
    color: #daa520;
    padding: 8px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quick-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(218, 165, 32, 0.2), transparent);
    transition: left 0.5s ease;
}

.quick-btn:hover::before {
    left: 100%;
}

.quick-btn:hover {
    background: rgba(218, 165, 32, 0.25);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(218, 165, 32, 0.2);
}

/* Light Theme Enhancements */
body:not(.dark) .message-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body:not(.dark) .sender-name {
    color: #daa520;
}

body:not(.dark) .message-time {
    color: rgba(0, 0, 0, 0.5);
}

body:not(.dark) .message-content strong {
    color: #b8941a;
}

body:not(.dark) .message-content code {
    background: rgba(218, 165, 32, 0.15);
    color: #b8941a;
}

body:not(.dark) .typing-text {
    color: rgba(0, 0, 0, 0.6);
}

/* Responsive Enhancements */
@media (max-width: 1200px) {
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .quick-btn {
        font-size: 10px;
        padding: 6px 10px;
    }
}

/* Scrollbar Enhancements */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #daa520 0%, #b8941a 100%);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #b8941a 0%, #daa520 100%);
}

/* Enhanced Status Indicator */
.status.online::before {
    width: 10px;
    height: 10px;
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
    animation: pulse 2s infinite, glow 2s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 8px rgba(76, 175, 80, 0.6); }
    50% { box-shadow: 0 0 16px rgba(76, 175, 80, 0.8); }
}

/* Message Content Enhancements */
.message-content {
    position: relative;
    overflow: hidden;
}

.message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s ease;
}

.message:hover .message-content::before {
    left: 100%;
}

/* Chat Input */
.chat-input-container {
    background: #2d2d2d;
    padding: 15px 20px;
    border-top: 1px solid #444;
}

.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.quick-btn {
    background: rgba(218, 165, 32, 0.2);
    border: 1px solid #daa520;
    color: #daa520;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-btn:hover {
    background: #daa520;
    color: #fff;
    transform: translateY(-2px);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

#chatInput {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #444;
    color: #fff;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

#chatInput:focus {
    border-color: #daa520;
    box-shadow: 0 0 0 2px rgba(218, 165, 32, 0.2);
}

#chatInput::placeholder {
    color: #888;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #daa520 0%, #b8941a 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Light Theme Support */
body:not(.dark) .ai-chat-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #dee2e6;
}

body:not(.dark) .chat-messages {
    background: #f8f9fa;
}

body:not(.dark) .message-content {
    background: #fff;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #dee2e6;
}

body:not(.dark) .chat-input-container {
    background: #e9ecef;
    border-color: #dee2e6;
}

body:not(.dark) #chatInput {
    background: #fff;
    border-color: #ced4da;
    color: #333;
}

body:not(.dark) #chatInput::placeholder {
    color: #6c757d;
}

body:not(.dark) .quick-btn {
    background: rgba(218, 165, 32, 0.1);
    color: #daa520;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #2d2d2d;
    margin-bottom: 20px;
    border: 1px solid #444;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #daa520;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

/* Responsive adjustments for chat */
@media (max-width: 1200px) {
    .ai-chat-container {
        width: calc(40% - 48px);
    }
}

@media (max-width: 992px) {
    .ai-chat-container {
        display: none !important;
    }
}

/* Animation for chat container */
.ai-chat-container {
    animation: chatSlideIn 0.5s ease;
}

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}