/* Chatbot Widget Styles */
/* Privacy-protected floating chatbot for Copenhagen Shuttle */

:root {
    --chatbot-primary: #2c3e50;
    --chatbot-secondary: #3498db;
    --chatbot-accent: #e74c3c;
    --chatbot-success: #27ae60;
    --chatbot-light: #ecf0f1;
    --chatbot-dark: #34495e;
    --chatbot-shadow: rgba(0, 0, 0, 0.1);
    --chatbot-shadow-heavy: rgba(0, 0, 0, 0.2);
}

/* Chatbot container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: ltr; /* Override RTL for Arabic */
}

/* Floating button (minimized state) */
.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--chatbot-shadow-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px var(--chatbot-shadow-heavy);
}

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

.chatbot-button-icon {
    font-size: 24px;
    color: white;
    transition: all 0.3s ease;
}

.chatbot-button.active .chatbot-button-icon {
    transform: rotate(45deg);
}

/* Notification badge */
.chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--chatbot-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

/* Chat window */
.chatbot-window {
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px var(--chatbot-shadow-heavy);
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: 80px;
    right: 0;
    overflow: hidden;
    border: 1px solid #e1e8ed;
}

.chatbot-window.active {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

/* Chat header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.chatbot-header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header-status {
    width: 8px;
    height: 8px;
    background: var(--chatbot-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Chat messages area */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafbfc;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-light);
    border-radius: 3px;
}

/* Message bubbles */
.message {
    max-width: 80%;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
}

.message.bot {
    align-self: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message.user .message-bubble {
    background: var(--chatbot-secondary);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.bot .message-bubble {
    background: white;
    color: var(--chatbot-dark);
    border: 1px solid #e1e8ed;
    border-bottom-left-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: #8899a6;
    margin-top: 4px;
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

/* Privacy protection indicator */
.message-privacy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--chatbot-accent);
    margin-top: 4px;
}

.privacy-icon {
    width: 12px;
    height: 12px;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #8899a6;
    font-size: 13px;
}

.typing-indicator.active {
    display: flex;
}

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

.typing-dot {
    width: 6px;
    height: 6px;
    background: #8899a6;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Chat input area */
.chatbot-input-area {
    padding: 16px;
    border-top: 1px solid #e1e8ed;
    background: white;
    border-radius: 0 0 16px 16px;
}

.chatbot-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e1e8ed;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    min-height: 20px;
    max-height: 100px;
    line-height: 1.4;
}

.chatbot-input:focus {
    border-color: var(--chatbot-secondary);
}

.chatbot-input::placeholder {
    color: #8899a6;
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chatbot-secondary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 16px;
}

.chatbot-send:hover:not(:disabled) {
    background: var(--chatbot-primary);
    transform: scale(1.05);
}

.chatbot-send:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-action {
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--chatbot-secondary);
    border-radius: 16px;
    font-size: 12px;
    color: var(--chatbot-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action:hover {
    background: var(--chatbot-secondary);
    color: white;
}

/* Message buttons */
.message-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    max-width: 100%;
}

.message-button {
    padding: 8px 12px;
    background: var(--chatbot-secondary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-button:hover:not(:disabled) {
    background: var(--chatbot-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message-button:active:not(:disabled) {
    transform: translateY(0);
}

.message-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

/* Responsive button layout */
@media (max-width: 480px) {
    .message-button {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 42px;
    }
    
    .message-buttons {
        gap: 6px;
        margin-top: 10px;
    }
}

/* Datetime picker styles */
.datetime-picker-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.datetime-picker-input {
    padding: 12px 16px;
    border: 1px solid var(--chatbot-secondary);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: white;
    outline: none;
    transition: border-color 0.2s ease;
}

.datetime-picker-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.datetime-submit-btn {
    padding: 12px 24px;
    background: var(--chatbot-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.datetime-submit-btn:hover:not(:disabled) {
    background: var(--chatbot-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.datetime-submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

/* Mobile responsive datetime picker */
@media (max-width: 480px) {
    .datetime-picker-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
    }
    
    .datetime-submit-btn {
        padding: 14px 24px;
        font-size: 16px;
        align-self: stretch;
    }
}

/* Error states */
.error-message {
    background: #fee;
    border: 1px solid var(--chatbot-accent);
    color: var(--chatbot-accent);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    margin: 8px 0;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        left: 10px;
        bottom: 10px;
        position: fixed;
        top: 10px;
        border-radius: 12px;
        max-height: calc(100vh - 20px);
    }
    
    .chatbot-container {
        right: 15px;
        bottom: 15px;
        position: fixed;
    }
    
    .chatbot-button {
        width: 55px;
        height: 55px;
    }
    
    .chatbot-button-icon {
        font-size: 22px;
    }
    
    /* Ensure messages area is properly scrollable on mobile */
    .chatbot-messages {
        flex: 1;
        overflow-y: auto;
        max-height: calc(100vh - 200px);
        padding: 12px;
    }
    
    /* Improve header spacing on mobile */
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-header-title {
        font-size: 15px;
    }
    
    /* Improve input area on mobile */
    .chatbot-input-area {
        padding: 12px;
    }
    
    .chatbot-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 14px;
    }
    
    .chatbot-send {
        width: 42px;
        height: 42px;
        font-size: 15px;
    }
}

/* Extra small mobile screens */
@media (max-width: 360px) {
    .chatbot-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        right: 8px;
        left: 8px;
        bottom: 8px;
        top: 8px;
    }
    
    .chatbot-container {
        right: 12px;
        bottom: 12px;
    }
    
    .chatbot-button {
        width: 50px;
        height: 50px;
    }
    
    .chatbot-button-icon {
        font-size: 20px;
    }
    
    .chatbot-messages {
        padding: 10px;
        max-height: calc(100vh - 180px);
    }
    
    .message-button {
        padding: 8px 10px;
        font-size: 13px;
        min-height: 38px;
    }
}

/* RTL support for Arabic */
.chatbot-window[dir="rtl"] {
    direction: rtl;
}

.chatbot-window[dir="rtl"] .message.user {
    align-self: flex-start;
}

.chatbot-window[dir="rtl"] .message.bot {
    align-self: flex-end;
}

.chatbot-window[dir="rtl"] .message.user .message-bubble {
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 6px;
}

.chatbot-window[dir="rtl"] .message.bot .message-bubble {
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 6px;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .chatbot-messages {
        background: #1a1a1a;
    }
    
    .message.bot .message-bubble {
        background: #2d2d2d;
        color: #e1e8ed;
        border-color: #444;
    }
    
    .chatbot-input-area {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .chatbot-input {
        background: #2d2d2d;
        color: #e1e8ed;
        border-color: #444;
    }
    
    .quick-action {
        background: #2d2d2d;
        border-color: #444;
        color: #e1e8ed;
    }
}

/* Animation for entrance */
.chatbot-container.fade-in {
    animation: fadeInUp 0.5s ease-out;
}

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

/* Accessibility improvements */
.chatbot-button:focus,
.chatbot-close:focus,
.chatbot-send:focus,
.quick-action:focus {
    outline: 2px solid var(--chatbot-secondary);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chatbot-window {
        border: 2px solid #000;
    }
    
    .message.bot .message-bubble {
        border: 2px solid #000;
    }
}