/**
 * ENNU Unified Order Service Styles
 * Consistent styling for order operations across all modes
 */

/* Loading States */
.unified-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.unified-loading-overlay.active {
    display: flex;
}

.unified-loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading state for displays */
.ennu-order-display.loading,
.treatment-products-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Unified Notifications */
.unified-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    background: #333;
    color: white;
    font-size: 14px;
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999998;
}

.unified-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.unified-notification.success {
    background: #28a745;
}

.unified-notification.error {
    background: #dc3545;
}

.unified-notification.warning {
    background: #ffc107;
    color: #333;
}

/* Consistent button styles for add to order */
.btn-add-to-order,
.add-service-btn,
.btn-add-treatment {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-add-to-order:hover,
.add-service-btn:hover,
.btn-add-treatment:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.btn-add-to-order:disabled,
.add-service-btn:disabled,
.btn-add-treatment:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Product card states during operations */
.treatment-product-card.adding,
.ennu-service-card.adding {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.treatment-product-card.adding::after,
.ennu-service-card.adding::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #0073aa;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Order item actions */
.order-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.quantity-controls button {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.quantity-controls button:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.quantity-controls input {
    width: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px;
}

/* Quick add product form */
.quick-add-product {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.quick-add-product h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.quick-add-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.quick-add-form .form-group {
    flex: 1;
}

.quick-add-form label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.quick-add-form input,
.quick-add-form select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Instant update indicators */
.order-update-indicator {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: #28a745;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.order-update-indicator.show {
    opacity: 1;
    transform: translateX(0) translateY(-50%);
}

/* Sync status indicator */
.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    margin-left: 10px;
}

.sync-status .sync-icon {
    width: 14px;
    height: 14px;
    border: 2px solid #28a745;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.sync-status.synced .sync-icon {
    animation: none;
    border-color: #28a745;
    position: relative;
}

.sync-status.synced .sync-icon::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #28a745;
    font-size: 10px;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .unified-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .quick-add-form {
        flex-direction: column;
    }
    
    .quick-add-form .form-group {
        width: 100%;
    }
}
