/**
 * Toast Notification Styles
 * Provides custom styling for Bootstrap toast notifications
 */

/* Toast Container Positioning */
.toast-container {
    z-index: 10000 !important;
}

.toast-container.bottom-right {
    bottom: 1rem;
    right: 1rem;
}

.toast-container.bottom-left {
    bottom: 1rem;
    left: 1rem;
}

.toast-container.top-right {
    top: 1rem;
    right: 1rem;
}

.toast-container.top-left {
    top: 1rem;
    left: 1rem;
}

.toast-container.top-center {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

.toast-container.bottom-center {
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

/* Toast Styling */
.toast {
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    margin-bottom: 0.5rem;
}

.toast-body {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
}

/* Toast Types */
.toast.success {
    border-left: 4px solid #28a745;
}

.toast.error {
    border-left: 4px solid #dc3545;
}

.toast.warning {
    border-left: 4px solid #ffc107;
}

.toast.info {
    border-left: 4px solid #17a2b8;
}

/* Toast Icons */
.toast .bi {
    font-size: 16px;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Close Button */
.toast .btn-close {
    font-size: 12px;
    margin: 4px 8px 4px 0;
}

/* Animation */
.toast {
    animation: slideInRight 0.3s ease-out;
}

.toast.hide {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .toast-container {
        left: 1rem !important;
        right: 1rem !important;
        transform: none !important;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6f61;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cart and Wishlist Button States */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Wishlist Button States */
.wishlist-btn.in-wishlist {
    color: #ff6f61 !important;
}

.wishlist-btn.in-wishlist .bi-heart {
    display: none;
}

.wishlist-btn.in-wishlist .bi-heart-fill {
    display: inline-block;
}

.wishlist-btn .bi-heart-fill {
    display: none;
}

/* Quantity Controls */
.qty-controls {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.qty-controls .qty-btn {
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.qty-controls .qty-btn:hover:not(:disabled) {
    background-color: #f8f9fa;
}

.qty-controls .qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-controls .qty-input {
    border: none;
    padding: 8px 12px;
    width: 60px;
    text-align: center;
    font-size: 14px;
    background: transparent;
}

.qty-controls .qty-input:focus {
    outline: none;
}

/* Search Suggestions */
.search-suggestions {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: white;
}

.search-suggestions a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.search-suggestions a:hover {
    background-color: #f8f9fa;
}

.search-suggestions a:last-child {
    border-bottom: none;
}

.search-suggestions img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-suggestions .suggestion-content {
    flex: 1;
    min-width: 0;
}

.search-suggestions .suggestion-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggestions .suggestion-description {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Email Validation States */
.email-loader {
    display: flex;
    align-items: center;
}

.email-feedback {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
}

.email-feedback.valid-feedback {
    color: #28a745;
}

.email-feedback.invalid-feedback {
    color: #dc3545;
}

.email-feedback a {
    color: inherit;
}

/* Form Validation */
.form-control.is-valid {
    border-color: #28a745;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.46.52-.4.41-.86-.9zm2.86-2.73-.96.93-.94-.94-.46.46.94.94-.88.88.46.46.88-.88.88.88.46-.46-.88-.88.94-.94z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 1.4 1.4M8.2 7.4l-1.4-1.4m0 0L5.8 7.4M7.8 6l1.4-1.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Hover Effects */
.hover-bg-light:hover {
    background-color: #f8f9fa !important;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .loading-spinner,
    .btn.loading::before {
        animation: none;
    }
}
