/* WGP Package Builder Styles */

/* Chat Messages */
.chat-msg-user {
    background: linear-gradient(135deg, #0400B7, #1a1aff);
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 16px;
    max-width: 80%;
    word-wrap: break-word;
}
.chat-msg-assistant {
    background: #f3f4f6;
    color: #1f2937;
    border-radius: 18px 18px 18px 4px;
    padding: 10px 16px;
    max-width: 85%;
    word-wrap: break-word;
}
.chat-msg-assistant pre {
    background: #e5e7eb;
    padding: 8px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12px;
    margin: 4px 0;
}
.chat-msg-assistant code { font-size: 12px; }

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
}
.typing-indicator span {
    width: 8px; height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Category badges */
.cat-go { background: #dbeafe; color: #1d4ed8; }
.cat-grow { background: #dcfce7; color: #15803d; }
.cat-glow { background: #ffedd5; color: #c2410c; }

/* Warning states */
.limit-exceeded { border-color: #ef4444 !important; background-color: #fef2f2 !important; }
.limit-warning { border-color: #f59e0b !important; background-color: #fffbeb !important; }

/* Scrollbar */
#chatMessages::-webkit-scrollbar, .overflow-y-auto::-webkit-scrollbar { width: 6px; }
#chatMessages::-webkit-scrollbar-track, .overflow-y-auto::-webkit-scrollbar-track { background: transparent; }
#chatMessages::-webkit-scrollbar-thumb, .overflow-y-auto::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
#chatMessages::-webkit-scrollbar-thumb:hover, .overflow-y-auto::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

#chatInput { overflow-y: hidden; }
#itemsTableBody tr:hover { background-color: #f9fafb; }

/* Pulse animation for submit button */
@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(172, 18, 18, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(172, 18, 18, 0); }
}
.pulse-ready { animation: pulse-border 2s infinite; }

/* Loading overlay */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid #fff; border-top-color: #0400B7;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MOBILE RESPONSIVE ===== */

/* Mobile: stack panels, show/hide with toggle */
@media (max-width: 1023px) {
    #chatPanel {
        width: 100% !important;
        border-right: none !important;
    }
    #previewPanel {
        display: none !important;
        position: fixed;
        top: 56px; left: 0; right: 0; bottom: 0;
        width: 100% !important;
        z-index: 40;
        background: #f9fafb;
    }
    #previewPanel.mobile-visible {
        display: flex !important;
    }
    /* Category cards: 2x2 grid */
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Chat input: prevent iOS zoom */
    #chatInput {
        font-size: 16px !important;
    }
    /* Merchant bar stacks vertically */
    .merchant-bar {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }
    .merchant-bar > div:first-child {
        width: 100% !important;
    }
    .merchant-bar select {
        width: 100% !important;
    }
    /* Hide supplier columns on mobile */
    .hide-mobile {
        display: none !important;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .chat-msg-user, .chat-msg-assistant {
        max-width: 92%;
        font-size: 14px;
        padding: 8px 12px;
    }
    nav .font-bold.text-lg {
        font-size: 14px !important;
    }
}

/* Mobile toggle button */
#togglePreview {
    display: none;
}
@media (max-width: 1023px) {
    #togglePreview {
        display: flex;
    }
}
