/* Bottom panel styles - Optimized viewport adaptation */
.bottom-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    /* Ensure bottom panel does not exceed viewport */
    max-height: 20vh; /* Limit maximum height to 20% of viewport height */
    overflow: hidden;
    /* Add top edge gradient mask - Outward blur */
    mask: linear-gradient(to top, 
        rgba(0, 0, 0, 1) 0%, 
        rgba(0, 0, 0, 0.9) 80%, 
        rgba(0, 0, 0, 0.3) 96%, 
        rgba(0, 0, 0, 0) 100%);
}

.bottom-panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    /* Ensure content does not overflow */
    min-height: 0;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    position: relative;
    /* Limit input container height */
    max-height: 48px;
}

.message-input {
    flex: 1;
    background-color: rgba(128, 128, 128, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 5px 10px; /* Modify padding to 5px top/bottom, 10px left/right */
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    height: 48px;
    box-sizing: border-box;
    width: 140px; /* Set width to 140px */
    /* Ensure input box does not become too large */
    max-height: 48px;
}

.message-input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.message-input:focus {
    background-color: rgba(128, 128, 128, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

.send-button {
    display: none; /* Hide send button */
}

/* Active state - Blue when content is present */
.send-button.active {
    background-color: rgba(0, 123, 255, 0.8);
    color: #ffffff;
}

.send-button.active:hover {
    background-color: rgba(0, 123, 255, 0.9);
    transform: translateY(-50%) scale(1.02);
}

.send-button:hover {
    background-color: rgba(96, 96, 96, 0.2);
    transform: translateY(-50%) scale(1.02);
}

.send-button:active {
    transform: translateY(-50%) scale(0.98);
}

.send-button:disabled {
    background-color: rgba(64, 64, 64, 0.5);
    cursor: not-allowed;
    transform: translateY(-50%);
}

/* Function icon area */
.function-icons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    /* Ensure icon area does not become too large */
    max-height: 50px;
}

.function-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    background-color: rgba(128, 128, 128, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    /* Ensure icons do not become too large */
    max-width: 50px;
    max-height: 50px;
}

.function-icon:hover {
    transform: scale(1.1);
    background-color: rgba(160, 160, 160, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.function-icon:active {
    transform: scale(0.95);
}

.function-icon img {
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
    /* Ensure icon images do not become too large */
    max-width: 40px;
    max-height: 40px;
}

/* Remove special styles, uniformly use gray background */
.shop-icon,
.gift-icon,
.customer-service-icon {
    background-color: rgba(128, 128, 128, 0.8);
}

.shop-icon:hover,
.gift-icon:hover,
.customer-service-icon:hover {
    background-color: rgba(160, 160, 160, 0.9);
}

/* Responsive design - Optimized for small screen adaptation */
@media (max-width: 480px) {
    .bottom-panel-row {
        gap: 10px;
    }
    
    .input-container {
        max-width: 180px; /* Keep 180px */
        max-height: 44px; /* Reduce height */
    }
    
    .message-input {
        font-size: 13px;
        padding: 5px 10px; /* Keep padding */
        height: 44px; /* Reduce height */
        width: 140px; /* Keep 140px */
        max-height: 44px; /* Limit maximum height */
    }
    
    .send-button {
        display: none; /* Keep hidden */
    }
    
    .function-icon {
        width: 45px;
        height: 45px;
        max-width: 45px;
        max-height: 45px;
    }
    
    .function-icon img {
        width: 35px;
        height: 35px;
        max-width: 35px;
        max-height: 35px;
    }
}

/* New: Optimization for extra small screens */
@media (max-height: 600px) {
    .bottom-panel {
        padding: 4px;
        max-height: 15vh; /* Further limit height */
    }
    
    .message-input {
        height: 40px;
        max-height: 40px;
        font-size: 12px;
    }
    
    .function-icon {
        width: 40px;
        height: 40px;
        max-width: 40px;
        max-height: 40px;
    }
    
    .function-icon img {
        width: 30px;
        height: 30px;
        max-width: 30px;
        max-height: 30px;
    }
}

/* New: Optimization for landscape mode */
@media (orientation: landscape) and (max-height: 480px) {
    .bottom-panel {
        padding: 3px;
        max-height: 12vh; /* Further limit height in landscape mode */
    }
    
    .message-input {
        height: 36px;
        max-height: 36px;
        font-size: 11px;
    }
    
    .function-icon {
        width: 36px;
        height: 36px;
        max-width: 36px;
        max-height: 36px;
    }
    
    .function-icon img {
        width: 28px;
        height: 28px;
        max-width: 28px;
        max-height: 28px;
    }
}

/* Animation effects */
.bottom-panel {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input state */
.message-input.typing {
    border-color: rgba(0, 123, 255, 0.5);
}

/* Send state */
.send-button.sending {
    background-color: rgba(255, 193, 7, 0.8);
    pointer-events: none;
    transform: translateY(-50%);
}

.send-button.sending::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 5px;
}

/* Error state */
.message-input.error {
    border-color: rgba(255, 107, 107, 0.5);
}

/* Success state */
.message-input.success {
    border-color: rgba(40, 167, 69, 0.5);
}
