/**
 * Airpak Express - Chat Widget CSS
 * Responsive Dark AI Agent Interface
 */

/* Main Widget Container - LEFT SIDE */
#airpak-chat-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* OUTSIDE - Horizontal Pill-shaped "Chat With Us" button (Freshchat style) */
#airpak-chat-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    background: #CD2727;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    min-width: 180px;
}

#airpak-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(205, 39, 39, 0.4);
}

#airpak-chat-toggle .chat-icon {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#airpak-chat-toggle .chat-icon svg {
    width: 14px;
    height: 14px;
    fill: #CD2727;
}

#airpak-chat-toggle .chat-text {
    color: white;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* INSIDE - Responsive Dark Mode AI Agent Window */
#airpak-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 480px;
    max-height: 100vh;
    background: #1a1a1a;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: none;
    z-index: 999998;
    animation: slideIn 0.3s ease-out;
    right: 0;
    margin-left: auto;
}

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

/* Close button */
#airpak-chat-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: #333;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

#airpak-chat-close:hover {
    background: #444;
}

#airpak-chat-close svg {
    width: 20px;
    height: 20px;
    fill: #888;
}

/* Header */
#airpak-chat-header {
    background: #222;
    padding: 60px 16px 16px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.chat-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #CD2727, #e53935);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-status {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-status h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-status span {
    font-size: 12px;
    color: #888;
}

/* Search Bar */
.chat-search {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #333;
}

.chat-search svg {
    width: 18px;
    height: 18px;
    fill: #666;
    flex-shrink: 0;
}

.chat-search input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

.chat-search input::placeholder {
    color: #666;
}

/* Content Area */
#airpak-chat-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

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

.quick-action-card {
    background: #252525;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #333;
}

.quick-action-card:hover {
    background: #2a2a2a;
    border-color: #CD2727;
    transform: translateY(-2px);
}

.quick-action-icon {
    width: 36px;
    height: 36px;
    background: #CD2727;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-action-icon svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.quick-action-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.quick-action-text span {
    color: white;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.quick-action-text small {
    color: #888;
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.3;
}

.quick-action-arrow {
    color: #666;
    font-size: 14px;
    margin-left: auto;
    flex-shrink: 0;
}

/* AI Agent Card */
.ai-agent-card {
    background: linear-gradient(135deg, #252525, #2a2a2a);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #333;
}

.ai-agent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ai-badge {
    background: #CD2727;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.team-avatars {
    display: flex;
    gap: -8px;
}

.team-avatar {
    width: 28px;
    height: 28px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #888;
    border: 2px solid #1a1a1a;
    margin-left: -8px;
}

.team-avatar:first-child {
    margin-left: 0;
}

.ai-agent-card p {
    color: #ccc;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
}

/* Alert Box */
.alert-box {
    background: rgba(205, 39, 39, 0.15);
    border: 1px solid rgba(205, 39, 39, 0.3);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-box svg {
    width: 18px;
    height: 18px;
    fill: #CD2727;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-box span {
    color: #ccc;
    font-size: 12px;
    line-height: 1.5;
}

/* Section */
.chat-section {
    margin-bottom: 16px;
}

.chat-section-title {
    color: #888;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* FAQ List */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: #252525;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.faq-item:hover {
    background: #2a2a2a;
    border-color: #333;
}

.faq-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.faq-item-left svg {
    width: 18px;
    height: 18px;
    fill: #666;
    flex-shrink: 0;
}

.faq-item-left span {
    color: #ccc;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.faq-item-arrow {
    color: #666;
    font-size: 14px;
    flex-shrink: 0;
}

/* Create Ticket Button */
.create-ticket-btn {
    width: 100%;
    background: #CD2727;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
}

.create-ticket-btn:hover {
    background: #b82222;
}

/* Navigation */
#airpak-chat-nav {
    background: #222;
    border-top: 1px solid #333;
    display: flex;
    padding: 8px;
    flex-shrink: 0;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-item:hover {
    background: #2a2a2a;
}

.nav-item.active {
    background: #CD2727;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    fill: #888;
}

.nav-item.active svg {
    fill: white;
}

.nav-item span {
    font-size: 10px;
    color: #888;
}

.nav-item.active span {
    color: white;
}

/* Input Area */
#airpak-chat-input-area {
    background: #222;
    border-top: 1px solid #333;
    padding: 12px;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #2a2a2a;
    border-radius: 20px;
    padding: 4px 4px 4px 16px;
    border: 1px solid #333;
}

#airpak-chat-input {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 0;
    color: white;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

#airpak-chat-input::placeholder {
    color: #666;
}

#airpak-chat-send {
    width: 40px;
    height: 40px;
    background: #CD2727;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#airpak-chat-send:hover {
    background: #b82222;
    transform: scale(1.05);
}

#airpak-chat-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Messages Area */
.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

.chat-message .bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.chat-message.user .bubble {
    background: #CD2727;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.bot .bubble {
    background: #252525;
    color: #ccc;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.chat-message.typing .bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat Messages in Messages Tab */
#chat-messages-tab {
    display: none;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
}

#chat-messages-tab.active {
    display: flex;
}

#chat-messages-tab .chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

#chat-messages-tab .chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

#chat-messages-tab .chat-message.bot {
    align-self: flex-start;
    align-items: flex-start;
}

#chat-messages-tab .chat-message .bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

#chat-messages-tab .chat-message.user .bubble {
    background: #CD2727;
    color: white;
    border-bottom-right-radius: 4px;
}

#chat-messages-tab .chat-message.bot .bubble {
    background: #2a2a2a;
    color: #ddd;
    border-bottom-left-radius: 4px;
}

#chat-messages-tab .chat-message.bot .bubble a {
    color: #CD2727;
    text-decoration: underline;
}

/* Tab Content Visibility */
.chat-tab-content {
    display: none;
}

.chat-tab-content.active {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #airpak-chat-widget {
        bottom: 16px;
        left: 16px;
    }

    #airpak-chat-toggle {
        padding: 10px 20px;
        min-width: 150px;
    }

    #airpak-chat-toggle .chat-text {
        font-size: 13px;
    }

    #airpak-chat-window {
        max-width: 100%;
    }

    #airpak-chat-header {
        padding: 50px 12px 12px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}