/* ============================================
   BUYMATE E-commerce - Enhanced UI Components
   ============================================ */

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    z-index: 9999;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: var(--foreground);
}

.notification-success {
    border-left: 4px solid #10b981;
}

.notification-error {
    border-left: 4px solid var(--destructive);
}

.notification-info {
    border-left: 4px solid #3b82f6;
}

.notification-warning {
    border-left: 4px solid #f59e0b;
}

/* Cart Icon Bounce Animation */
@keyframes bounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.1); }
}

.cart-icon.bounce {
    animation: bounce 0.6s ease;
}

/* Dropdown Menus */
.dropdown-container {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: var(--foreground);
    text-decoration: none;
}

.dropdown-item:hover {
    background-color: var(--muted);
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-top: 1px solid var(--border);
}

/* Mini Cart Popup */
.mini-cart {
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mini-cart .last\:border-b-0:last-child {
    border-bottom: 0 !important;
}

.cart-container:hover .mini-cart {
    display: block !important;
}

/* Image Gallery */
.image-gallery {
    position: relative;
}

.main-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    object-fit: cover;
}

.thumbnail {
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.15s ease;
    border: 2px solid transparent;
    border-radius: var(--radius);
}

.thumbnail:hover {
    opacity: 1;
}

.thumbnail.active {
    opacity: 1;
    border-color: var(--primary);
}

.gallery-prev,
.gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.gallery-prev:hover,
.gallery-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

/* Modal/Dialog */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-dialog {
    background: var(--card);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-dialog {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
}

.modal-close:hover {
    background: var(--muted);
    color: var(--foreground);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Tabs */
.tabs {
    width: 100%;
}

.tab-list {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
    overflow-x: auto;
}

.tab-trigger {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    color: var(--muted-foreground);
    font-weight: 500;
}

.tab-trigger:hover {
    color: var(--foreground);
}

.tab-trigger.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    padding: 1.5rem 0;
}

.tab-content.active {
    display: block;
}

/* Accordion */
.accordion {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-trigger {
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
    font-weight: 500;
}

.accordion-trigger:hover {
    background: var(--muted);
}

.accordion-trigger::after {
    content: '+';
    font-size: 1.5rem;
    transition: transform 0.15s ease;
}

.accordion-trigger.active::after {
    transform: rotate(45deg);
}

.accordion-content {
    display: none;
    padding: 0 1.5rem 1rem;
    color: var(--muted-foreground);
}

/* Quantity Controls */
.quantity-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.quantity-decrease,
.quantity-increase {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.quantity-decrease:hover,
.quantity-increase:hover {
    background: var(--accent);
}

.quantity-input {
    width: 60px;
    height: 36px;
    border: none;
    text-align: center;
    font-weight: 500;
    background: var(--background);
}

.quantity-input:focus {
    outline: none;
}

/* Badge/Counter */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--primary);
    color: var(--primary-foreground);
}

.badge-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.badge-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-sm {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
}

/* Product Card Enhancements */
.product-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.15s ease;
}

.product-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-sale {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.badge-new {
    background: #10b981;
    color: white;
}

.badge-featured {
    background: #3b82f6;
    color: white;
}

/* Wishlist Button */
.wishlist-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.wishlist-button:hover {
    background: white;
    transform: scale(1.1);
}

.wishlist-button.active {
    color: var(--destructive);
}

/* Sticky Header Enhancement */
.header.scroll-down {
    transform: translateY(-100%);
}

.header.scroll-up {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form Validation States */
.is-invalid {
    border-color: var(--destructive) !important;
}

.is-valid {
    border-color: #10b981 !important;
}

.invalid-feedback {
    display: none;
    color: var(--destructive);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Lazy Loading Images */
img[data-src] {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

img[data-src].loaded {
    filter: blur(0);
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .dropdown-menu {
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .modal-dialog {
        width: 95%;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .btn,
    .notification {
        display: none !important;
    }
}
