/**
 * PKM Universe - AI Chatbot & Ticket System CSS
 * Advanced styling for chat interface
 */

/* ============================================
   CHATBOT CONTAINER
   ============================================ */
.pkm-chatbot {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================
   CHAT BUBBLE
   ============================================ */
.chatbot-bubble {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.4);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
}

.chatbot-bubble:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 12px 48px rgba(0, 212, 255, 0.5);
}

.chatbot-bubble.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.bubble-icon {
    position: relative;
    z-index: 2;
}

.bubble-icon svg {
    width: 30px;
    height: 30px;
    stroke: white;
}

.bubble-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.bubble-pulse {
    position: absolute;
    inset: -5px;
    border: 3px solid #00d4ff;
    border-radius: 50%;
    animation: bubblePulse 2s ease-out infinite;
}

@keyframes bubblePulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ============================================
   CHAT WINDOW
   ============================================ */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: linear-gradient(180deg, rgba(13, 13, 26, 0.98), rgba(8, 8, 18, 0.99));
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(0, 212, 255, 0.1);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(20px);
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ============================================
   CHAT HEADER
   ============================================ */
.chatbot-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.15));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: white;
    position: relative;
}

.avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid rgba(13, 13, 26, 0.98);
}

.chatbot-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: white;
}

.chatbot-status {
    font-size: 0.8rem;
    color: #22c55e;
}

.chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.chatbot-ticket-btn,
.chatbot-close {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chatbot-ticket-btn:hover,
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.chatbot-ticket-btn svg,
.chatbot-close svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

/* ============================================
   MESSAGES AREA
   ============================================ */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 3px;
}

.chat-message {
    display: flex;
    gap: 12px;
    animation: messageSlide 0.3s ease-out;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.message-content {
    max-width: 75%;
}

.message-text {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.bot .message-text {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top-left-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
}

.chat-message.user .message-text {
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    color: white;
    border-top-right-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
    padding: 0 8px;
}

.chat-message.user .message-time {
    text-align: right;
}

/* ============================================
   TYPING INDICATOR
   ============================================ */
.chatbot-typing {
    padding: 0 20px;
    display: none;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}

.chatbot-typing.show {
    display: flex;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #00d4ff;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

/* ============================================
   QUICK REPLIES
   ============================================ */
.chatbot-quick-replies {
    padding: 0 20px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-reply-btn {
    padding: 10px 18px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 100px;
    color: #00d4ff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

/* ============================================
   INPUT AREA
   ============================================ */
.chatbot-input-area {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 12px;
}

.chatbot-input-area input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.chatbot-input-area input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-input-area input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.chatbot-input-area button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chatbot-input-area button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.chatbot-input-area button svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* ============================================
   TICKET MODAL
   ============================================ */
.ticket-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100010;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.ticket-modal.open {
    opacity: 1;
    visibility: visible;
}

.ticket-modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: linear-gradient(180deg, rgba(13, 13, 26, 0.98), rgba(8, 8, 18, 0.99));
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 28px;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6), 0 0 80px rgba(0, 212, 255, 0.1);
}

.ticket-modal.open .ticket-modal-content {
    transform: translateY(0) scale(1);
}

.ticket-modal-header {
    padding: 24px 28px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.15));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ticket-modal-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ticket-modal-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.ticket-modal-close:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: rotate(90deg);
}

/* ============================================
   TICKET FORM
   ============================================ */
.ticket-form {
    padding: 28px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.15);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300d4ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.form-group select option {
    background: #0d0d1a;
    color: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Priority Selector */
.priority-selector {
    display: flex;
    gap: 12px;
}

.priority-option {
    flex: 1;
    cursor: pointer;
}

.priority-option input {
    display: none;
}

.priority-badge {
    display: block;
    padding: 12px;
    text-align: center;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.priority-badge.low {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.priority-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.priority-badge.high {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.priority-option input:checked + .priority-badge.low {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.3);
}

.priority-option input:checked + .priority-badge.medium {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.priority-option input:checked + .priority-badge.high {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* Submit Button */
.ticket-submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #00d4ff, #a855f7);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s;
    margin-top: 10px;
}

.ticket-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 212, 255, 0.4);
}

.ticket-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ticket-submit-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .pkm-chatbot {
        bottom: 15px;
        right: 15px;
    }

    .chatbot-bubble {
        width: 55px;
        height: 55px;
    }

    .chatbot-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .ticket-modal-content {
        margin: 15px;
        max-height: calc(100vh - 30px);
        border-radius: 20px;
    }
}
