/* Enhanced Responsive CSS for Dokan E-commerce */

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Smooth Transitions */
* {
    transition: all 0.3s ease;
}

/* Enhanced Button Styles */
.btn-enhanced {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.btn-enhanced:hover::before {
    left: 100%;
}

/* Enhanced Card Hover Effects */
.card-hover-effect {
    position: relative;
    overflow: hidden;
}

.card-hover-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.card-hover-effect:hover::after {
    transform: translateX(100%);
}

/* Responsive Typography */
@media (max-width: 575.98px) {
    .display-1 { font-size: 2.5rem; }
    .display-2 { font-size: 2rem; }
    .display-3 { font-size: 1.75rem; }
    .display-4 { font-size: 1.5rem; }
    .display-5 { font-size: 1.25rem; }
    .display-6 { font-size: 1rem; }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.9rem; }
}

/* Enhanced Mobile Navigation */
.mobile-nav-drawer {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-drawer.show {
    transform: translateX(0);
}

.mobile-nav-item {
    position: relative;
}

.mobile-nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(to right, transparent, #e9ecef, transparent);
}

/* Category Grid Enhancements */
.category-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 575.98px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 375px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Enhanced Search Bar */
.search-container {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-suggestion-item:hover {
    background-color: #f8f9fa;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

/* Product Grid Masonry Effect */
.product-masonry {
    column-count: 5;
    column-gap: 20px;
}

.product-masonry .product-item {
    break-inside: avoid;
    margin-bottom: 20px;
}

@media (max-width: 1199.98px) {
    .product-masonry {
        column-count: 4;
    }
}

@media (max-width: 991.98px) {
    .product-masonry {
        column-count: 3;
    }
}

@media (max-width: 767.98px) {
    .product-masonry {
        column-count: 2;
    }
}

@media (max-width: 575.98px) {
    .product-masonry {
        column-count: 1;
    }
}

/* Enhanced Product Cards */
.product-card-enhanced {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.product-card-enhanced:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.product-image-container {
    position: relative;
    overflow: hidden;
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

.product-badge.discount {
    background: #ff4757;
}

.product-badge.new {
    background: #2ed573;
}

.product-badge.featured {
    background: #ffa502;
}

/* Quick View Overlay */
.quick-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.product-card-enhanced:hover .quick-view-overlay {
    opacity: 1;
    visibility: visible;
}

.quick-view-btn {
    background: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.product-card-enhanced:hover .quick-view-btn {
    transform: translateY(0);
}

/* Responsive Spacing */
.spacing-xs { margin: 0.25rem; }
.spacing-sm { margin: 0.5rem; }
.spacing-md { margin: 1rem; }
.spacing-lg { margin: 1.5rem; }
.spacing-xl { margin: 3rem; }

.spacing-y-xs { margin-top: 0.25rem; margin-bottom: 0.25rem; }
.spacing-y-sm { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.spacing-y-md { margin-top: 1rem; margin-bottom: 1rem; }
.spacing-y-lg { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.spacing-y-xl { margin-top: 3rem; margin-bottom: 3rem; }

.spacing-x-xs { margin-left: 0.25rem; margin-right: 0.25rem; }
.spacing-x-sm { margin-left: 0.5rem; margin-right: 0.5rem; }
.spacing-x-md { margin-left: 1rem; margin-right: 1rem; }
.spacing-x-lg { margin-left: 1.5rem; margin-right: 1.5rem; }
.spacing-x-xl { margin-left: 3rem; margin-right: 3rem; }

/* Mobile-First Responsive Utilities */
@media (max-width: 575.98px) {
    .spacing-xs { margin: 0.125rem; }
    .spacing-sm { margin: 0.25rem; }
    .spacing-md { margin: 0.5rem; }
    .spacing-lg { margin: 1rem; }
    .spacing-xl { margin: 2rem; }

    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Enhanced Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out;
}

.animate-slide-in-bottom {
    animation: slideInFromBottom 0.4s ease-out;
}

/* Staggered Animation Delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Enhanced Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: #1e7e34;
}

/* Focus States for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(38, 161, 99, 0.25);
    border-color: var(--primary-color);
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
}

.skip-link:focus {
    top: 6px;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    .container {
        max-width: none !important;
    }

    .product-card-enhanced {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .product-card-enhanced {
        border: 2px solid #000;
    }

    .btn-primary {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Considerations */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #1a1a1a;
        --text-color: #e0e0e0;
        --card-background: #2d2d2d;
        --border-color: #404040;
    }
}

/* Enhanced Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 80%;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 16px;
    margin-bottom: 16px;
    min-width: 300px;
    transform: translateX(100%);
    animation: slideInFromRight 0.3s ease-out forwards;
}

.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;
}

@keyframes slideInFromRight {
    to {
        transform: translateX(0);
    }
}

/* Responsive Image Utilities */
.img-responsive {
    max-width: 100%;
    height: auto;
}

.img-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.img-contain {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* Utility Classes */
.text-overflow {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Aspect Ratio Utilities */
.aspect-ratio-1-1 {
    aspect-ratio: 1 / 1;
}

.aspect-ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

/* Enhanced Interactive States */
.interactive {
    cursor: pointer;
    user-select: none;
}

.interactive:hover {
    opacity: 0.8;
}

.interactive:active {
    transform: scale(0.98);
}

/* Mobile Touch Targets */
@media (max-width: 767.98px) {
    .btn,
    .nav-link,
    .dropdown-item,
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
