/**
 * Stock Validation Styles
 *
 * Visual components for stock validation feedback
 * Provides clear, intuitive UX for stock availability
 */

/* Stock Badge (Product Page) */
.stock-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.stock-badge.stock-available {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.stock-badge.stock-low {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.stock-badge.stock-out {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.stock-badge.stock-error {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Inline Status (Cart Items) */
.stock-status-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.stock-status-inline.stock-low,
.stock-status-inline.stock-out {
    background-color: #fff3cd;
    color: #856404;
    border-left: 3px solid #ffc107;
}

.stock-status-inline.stock-out {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 3px solid #dc3545;
}

.stock-status-inline i {
    font-size: 14px;
    flex-shrink: 0;
}

/* Notification System */
.stock-notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.stock-notification {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    margin-bottom: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: #fff;
    animation: slideIn 0.3s ease;
    position: relative;
}

.stock-notification i:first-child {
    font-size: 20px;
    flex-shrink: 0;
}

.stock-notification span {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.stock-notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.stock-notification-close:hover {
    opacity: 1;
}

/* Notification Types */
.stock-notification-success {
    border-left: 4px solid #28a745;
}

.stock-notification-success i:first-child {
    color: #28a745;
}

.stock-notification-warning {
    border-left: 4px solid #ffc107;
    background-color: #fffbf0;
}

.stock-notification-warning i:first-child {
    color: #ffc107;
}

.stock-notification-error {
    border-left: 4px solid #dc3545;
    background-color: #fff5f5;
}

.stock-notification-error i:first-child {
    color: #dc3545;
}

.stock-notification-info {
    border-left: 4px solid #17a2b8;
}

.stock-notification-info i:first-child {
    color: #17a2b8;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.stock-notification.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

/* Loading Spinner */
.stock-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: #6c757d;
    font-size: 14px;
}

.stock-loader .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Cart Item Validation */
.cart-item.invalid-stock {
    border-left: 3px solid #dc3545;
    background-color: #fff5f5;
}

.cart-item.invalid-stock .product-name {
    color: #721c24;
}

/* Checkout Validation Alert */
.checkout-stock-alert {
    padding: 16px;
    margin-bottom: 20px;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    background-color: #f8d7da;
    color: #721c24;
}

.checkout-stock-alert h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

.checkout-stock-alert ul {
    margin: 0;
    padding-left: 20px;
}

.checkout-stock-alert li {
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .stock-notifications-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .stock-badge {
        display: block;
        margin: 10px 0;
        text-align: center;
    }
}
