/* =====================================================
   SNOBA AI COPILOT - Premium Chat Toggle Styles
   ===================================================== */

[x-cloak] { display: none !important; }

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-spinner {
    animation: ai-spin 1s linear infinite;
}

/* --- Floating Action Button - Compact & Simple --- */
.ai-copilot-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.ai-copilot-fab:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(13, 148, 136, 0.45), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.ai-copilot-fab:active {
    transform: translateY(0) scale(0.98);
}

.ai-fab-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-fab-icon {
    width: 26px;
    height: 26px;
}

/* Subtle pulse animation */
.ai-fab-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(13, 148, 136, 0.4);
    animation: ai-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes ai-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.15);
        opacity: 0;
    }
}

/* --- Chat Panel - Smaller & More Compact --- */
.ai-copilot-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9998;
    width: 320px;
    max-width: calc(100vw - 32px);
    height: 450px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Dark Mode Support */
.dark .ai-copilot-panel {
    background: #1e293b;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 10px 25px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Panel Transitions */
.ai-panel-enter {
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ai-panel-enter-start {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
}
.ai-panel-enter-end {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.ai-panel-leave {
    transition: all 0.2s ease-in;
}
.ai-panel-leave-start {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.ai-panel-leave-end {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
}

/* --- Panel Header - Compact --- */
.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: white;
    flex-shrink: 0;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-avatar svg {
    width: 16px;
    height: 16px;
}

.ai-header-info {
    display: flex;
    flex-direction: column;
}

.ai-header-title {
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
    line-height: 1.1;
}

.ai-header-status {
    font-size: 10.5px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.ai-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4ade80;
    animation: ai-status-blink 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes ai-status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.ai-header-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}

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

.ai-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* --- Messages Container --- */
.ai-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: #f8fafc;
}

.dark .ai-messages-container {
    background: #0f172a;
}

.ai-messages-container::-webkit-scrollbar {
    width: 5px;
}

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

.ai-messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.dark .ai-messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Welcome Screen --- */
.ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 10px;
    gap: 8px;
}

.ai-welcome-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #0d9488;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.ai-welcome-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

/* Float removed */

.ai-welcome-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.dark .ai-welcome-title {
    color: #f1f5f9;
}

.ai-welcome-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 8px 0;
}

.dark .ai-welcome-desc {
    color: #94a3b8;
}

/* --- Quick Action Buttons --- */
.ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 4px;
}

.ai-quick-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #334155;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-quick-btn:hover {
    background: #0d9488;
    color: white;
    border-color: #0d9488;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.3);
}

.dark .ai-quick-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

.dark .ai-quick-btn:hover {
    background: #0d9488;
    color: white;
    border-color: #0d9488;
}

/* --- Messages --- */
.ai-msg {
    display: flex;
    gap: 8px;
    animation: ai-msg-appear 0.3s ease-out;
}

@keyframes ai-msg-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-msg-user {
    justify-content: flex-end;
}

.ai-msg-assistant {
    justify-content: flex-start;
    align-items: flex-start;
}

.ai-msg-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #0d9488;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 3px;
}

.ai-msg-avatar-sm svg {
    width: 14px;
    height: 14px;
    color: white;
}


.ai-msg-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.ai-msg-bubble p {
    margin: 0;
}

.ai-msg-bubble-user {
    background: #0d9488;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-msg-bubble-assistant {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.dark .ai-msg-bubble-assistant {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

.ai-msg-content {
    word-break: break-word;
}

.ai-msg-content p {
    margin: 0 0 6px 0;
}

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

.ai-msg-content ul,
.ai-msg-content ol {
    margin: 4px 0;
    padding-left: 18px;
}

.ai-msg-content li {
    margin-bottom: 3px;
}

.ai-msg-content strong {
    font-weight: 600;
    color: #0d9488;
}

.dark .ai-msg-content strong {
    color: #5eead4;
}

.ai-msg-time {
    display: block;
    font-size: 10px;
    opacity: 0.5;
    margin-top: 4px;
    text-align: right;
}

/* --- Typing Indicator --- */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.ai-typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: ai-typing-bounce 1.4s ease-in-out infinite;
}

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

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

@keyframes ai-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* --- Input Area --- */
.ai-input-area {
    padding: 12px;
    border-top: 1px solid #f1f5f9;
    background: white;
    flex-shrink: 0;
}

.dark .ai-input-area {
    border-top-color: #334155;
    background: #1e293b;
}

.ai-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border-radius: 12px;
    padding: 0;
    border: none;
    transition: none;
}

.ai-input-field {
    flex: 1;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    padding: 10px 14px;
    line-height: 1.4;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.ai-input-field:focus {
    background: white;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.ai-input-field::placeholder {
    color: #94a3b8;
}

.dark .ai-input-field {
    color: #e2e8f0;
    background: #0f172a;
    border-color: #334155;
}

.dark .ai-input-field:focus {
    background: #1e293b;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.dark .ai-input-field::placeholder {
    color: #64748b;
}

.ai-input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: none;
    background: #0d9488;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
    background: #0f766e;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

.ai-send-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ai-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Input Footer - REMOVED --- */

/* --- Mobile Responsive - Compact --- */
@media (max-width: 480px) {
    .ai-copilot-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .ai-copilot-fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .ai-fab-icon {
        width: 24px;
        height: 24px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .ai-copilot-panel {
        width: 320px;
        height: 450px;
    }
}
