/* Driver List Styling */
.chat-back-btn {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 13px;
    color: var(--chat-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.chat-back-btn:hover {
    background: #e9ecef;
}

.driver-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

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

.driver-item.active {
    background: #e1f0ff;
    border-left: 4px solid var(--chat-primary);
}

.driver-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.driver-name {
    font-weight: 600;
    color: var(--chat-text-dark);
    font-size: 14px;
}

.driver-last-msg {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.unread-badge {
    background: #e74c3c;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.empty-msg, .loading-spinner, .error-msg {
    text-align: center;
    padding: 20px;
    color: #888;
    font-style: italic;
}

/* AI Chat Widget - Modern & Premium Design */
:root {
    --chat-primary: #3498db;
    --chat-secondary: #2980b9;
    --chat-bg-light: #f8f9fa;
    --chat-bg-dark: #1a1a1a;
    --chat-bubble-user: #3498db;
    --chat-bubble-ai: #ffffff;
    --chat-text-dark: #2c3e50;
    --chat-text-light: #ecf0f1;
    --chat-shadow: 0 15px 35px rgba(0,0,0,0.2);
    --chat-radius: 18px;
}

.ai-chat-widget {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 850px;
    height: 600px;
    background: var(--chat-bg-light);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.ai-chat-widget.collapsed {
    height: 55px;
    width: 320px;
    cursor: pointer;
    transform: translateY(0);
}

.ai-chat-widget.collapsed:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.chat-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100% - 55px);
}

/* Sidebar Styles */
.chat-sidebar {
    width: 280px;
    background: #2c3e50;
    border-right: 1px solid rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar, .driver-list::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track, .driver-list::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb, .driver-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.sidebar-header {
    padding: 18px 20px;
    background: #1e2b37;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.driver-item {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    background: transparent;
}

.driver-item:hover {
    background: rgba(255,255,255,0.05);
    padding-left: 24px;
}

.driver-item.active {
    background: #3498db;
    border-left: 4px solid #ffffff;
}

.driver-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 2px;
}

.driver-last-msg {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.driver-item.active .driver-last-msg {
    color: rgba(255,255,255,0.8);
}

.unread-badge {
    background: #e74c3c;
    color: white;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.driver-list {
    flex: 1;
    overflow-y: auto;
}

/* Main Chat Area Styles */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    position: relative;
}

.empty-chat-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    gap: 15px;
}

.empty-chat-state i {
    font-size: 48px;
    opacity: 0.3;
}

/* Header Design */
.chat-header {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-secondary));
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: 55px;
}

.chat-header-left, .chat-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
}

.widget-unread-badge {
    background: #e74c3c;
    color: white;
    font-size: 10px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.chat-header .status-dot {
    width: 10px;
    height: 10px;
    background: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 8px #2ecc71;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

.chat-header-right button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-right button:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

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

/* Mesaj Alanı */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f4f7f9;
    scroll-behavior: smooth;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.user-message {
    align-self: flex-end;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.user-message .msg-time {
    color: rgba(255,255,255,0.7);
}

.ai-message {
    align-self: flex-start;
    background: #ffffff;
    color: #333;
    border-bottom-left-radius: 2px;
    border: 1px solid #e1e8ed;
}

.ai-message .msg-time {
    color: #999;
}

.msg-time {
    display: block;
    font-size: 10px;
    margin-top: 5px;
    text-align: right;
}

/* Input Area */
.chat-input-area {
    padding: 12px 16px;
    background: #f0f2f5;
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.chat-input-area button {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-input-area button:hover {
    background: var(--chat-secondary);
    transform: scale(1.1) rotate(5deg);
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    background: rgba(0,0,0,0.05);
    padding: 10px 15px;
    border-radius: 15px;
    display: none;
    margin-bottom: 10px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #bdc3c7;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.3s infinite;
}

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

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

/* Dark Mode Desteği */
body.dark-mode .ai-chat-widget,
[data-theme="dark"] .ai-chat-widget {
    background: var(--chat-bg-dark);
    border-color: rgba(255,255,255,0.05);
}

body.dark-mode .chat-sidebar,
[data-theme="dark"] .chat-sidebar {
    background: #1a1a1a;
    border-right-color: #333;
}

body.dark-mode .sidebar-header,
[data-theme="dark"] .sidebar-header {
    background: #111;
    border-bottom-color: #222;
}

body.dark-mode .driver-item.active {
    background: var(--chat-primary);
}

body.dark-mode .chat-messages,
[data-theme="dark"] .chat-messages {
    background: #111111;
}

body.dark-mode .ai-message,
[data-theme="dark"] .message.ai-message {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #333;
}

body.dark-mode .msg-time {
    color: rgba(255,255,255,0.4);
}

body.dark-mode .chat-input-area,
[data-theme="dark"] .chat-input-area {
    background: #1a1a1a;
    border-top-color: rgba(255,255,255,0.05);
}

body.dark-mode .chat-input-area input,
[data-theme="dark"] .chat-input-area input {
    background: #2c2c2c;
    border-color: #2c2c2c;
    color: white;
}

body.dark-mode .chat-input-area input:focus,
[data-theme="dark"] .chat-input-area input:focus {
    border-color: var(--chat-primary);
    background: #2c2c2c;
}

body.dark-mode .chat-back-btn,
[data-theme="dark"] .chat-back-btn {
    background: #1a1a1a;
    border-bottom-color: #333;
}

body.dark-mode .driver-item,
[data-theme="dark"] .driver-item {
    border-bottom-color: #333;
}

body.dark-mode .driver-item:hover,
[data-theme="dark"] .driver-item:hover {
    background: #2c2c2c;
}

body.dark-mode .driver-item.active,
[data-theme="dark"] .driver-item.active {
    background: #333;
}

body.dark-mode .driver-name,
[data-theme="dark"] .driver-name {
    color: #eee;
}

body.dark-mode .driver-last-msg,
[data-theme="dark"] .driver-last-msg {
    color: #aaa;
}
