/* Custom animations and styles for ISAR Door Factory */

/* Floating animation for background elements */
@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: translateY(0px) rotate(360deg);
        opacity: 0.7;
    }
}

.floating-element {
    animation: float 6s ease-in-out infinite;
}

/* Fade in up animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Feature card hover effect */
.feature-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.feature-card::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;
}

.feature-card:hover::before {
    left: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Product card animation */
.product-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* Button pulse effect */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.btn-pulse {
    animation: pulse 2s infinite;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Gradient text animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #6366f1, #a855f7);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #4f46e5, #9333ea);
}

/* Image hover effects */
.image-zoom {
    transition: transform 0.3s ease;
    overflow: hidden;
}

.image-zoom:hover {
    transform: scale(1.05);
}

/* Text reveal animation */
@keyframes textReveal {
    0% {
        width: 0;
    }

    100% {
        width: 100%;
    }
}

.text-reveal {
    position: relative;
    overflow: hidden;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    background: white;
    animation: textReveal 0.8s ease-in-out;
}

/* Door icon animations */
@keyframes doorOpen {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(-45deg);
    }

    100% {
        transform: rotateY(0deg);
    }
}

.door-animate:hover {
    animation: doorOpen 1s ease-in-out;
}

/* Particles background */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: particleFloat 8s infinite linear;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .floating-element {
        display: none;
    }

    .feature-card {
        margin-bottom: 1rem;
    }

    .product-card:hover {
        transform: translateY(-5px) scale(1.01);
    }
}

/* Focus states for accessibility */
button:focus,
a:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Loading states */
.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #6366f1;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success/Error states */
.success {
    border-color: #10b981 !important;
    background-color: #ecfdf5;
}

.error {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #1f2937;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ISAR Doors - Custom Styles */

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Gradient backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-bg-alt {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Hover effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Image optimization */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.lazy-image.loaded {
    opacity: 1;
    animation: none;
    background: none;
}

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

    100% {
        background-position: 200% 0;
    }
}

/* Image placeholder */
.image-placeholder {
    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;
    }
}

/* Product card optimizations */
.product-card {
    will-change: transform;
    backface-visibility: hidden;
}

.product-card img {
    transition: transform 0.3s ease;
    background-color: #f8fafc;
    will-change: transform;
    transform: translateZ(0);
}

.product-card:hover img {
    transform: scale(1.05) translateZ(0);
}

/* Pagination styles */
.pagination button {
    transition: all 0.2s ease;
}

.pagination button:hover {
    transform: translateY(-1px);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Responsive image optimization */
@media (max-width: 768px) {
    .product-card img {
        height: 280px;
    }

    .modal-main-image {
        height: 400px !important;
    }

    .color-option {
        width: 16px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .product-card img {
        height: 240px;
    }

    .modal-main-image {
        height: 300px !important;
    }
}

/* Performance optimizations */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

    .pagination button {
        border: 1px solid #000;
    }
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Language Switcher */
.language-switcher .lang-btn {
    transition: all 0.3s ease;
}

.language-switcher .lang-btn.active {
    background-color: #1f2937;
    color: white;
}

.language-switcher .lang-btn:not(.active) {
    background-color: #e5e7eb;
    color: #374151;
}

/* Cart Styles */
.cart {
    transition: transform 0.3s ease;
}

.cart.cart-open {
    transform: translateX(0);
}

.cart-container {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.cart-container::-webkit-scrollbar {
    width: 6px;
}

.cart-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.cart-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.cart-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.cart-container img {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* Modal Styles */
.modal-overlay {
    backdrop-filter: blur(4px);
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Product Card Hover Effects */
.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.product-card img {
    transition: transform 0.3s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

/* Lazy Loading */
.lazy-image:not([data-src]) {
    opacity: 1;
}

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

/* Category Filters */
.category-filter {
    transition: all 0.3s ease;
}

.category-filter:hover {
    transform: translateY(-2px);
}

/* Pagination */
.page-btn {
    transition: all 0.3s ease;
}

.page-btn:hover {
    transform: translateY(-1px);
}

/* Notification */
.notification {
    animation: slideInDown 0.3s ease-out;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px) translateX(-50%);
    }

    to {
        opacity: 1;
        transform: translateY(0) translateX(-50%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart {
        width: 100%;
    }

    .modal-content {
        max-width: 90vw;
        max-height: 85vh;
        margin: 1rem;
        border: 2px solid #e5e7eb;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }

    .models-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .color-option {
        width: 58px !important;
        height: 72px !important;
    }

    .modal-main-image {
        object-fit: contain !important;
        object-position: center !important;
    }
}

@media (max-width: 640px) {
    .models-grid {
        grid-template-columns: 1fr;
    }

    .category-filters {
        flex-direction: column;
        align-items: center;
    }

    .category-filter {
        width: 100%;
        max-width: 200px;
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Button Hover Effects */
.btn-primary {
    background: linear-gradient(135deg, #1f2937, #111827);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #111827, #0f172a);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(31, 41, 55, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #374151, #1f2937);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #1f2937, #111827);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(55, 65, 81, 0.3);
}

/* Card Animations */
.product-card {
    animation: fadeInUp 0.6s ease-out;
}

.product-card:nth-child(1) {
    animation-delay: 0.1s;
}

.product-card:nth-child(2) {
    animation-delay: 0.2s;
}

.product-card:nth-child(3) {
    animation-delay: 0.3s;
}

.product-card:nth-child(4) {
    animation-delay: 0.4s;
}

.product-card:nth-child(5) {
    animation-delay: 0.5s;
}

.product-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus States */
button:focus,
a:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Print Styles */
@media print {

    .cart,
    .modal-overlay,
    .category-filters,
    .pagination {
        display: none !important;
    }

    .product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Modal Image Optimization */
.modal-main-image {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.color-option {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.color-option:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

/* Modal Size Adjustments */
@media (max-width: 1024px) {
    .modal-content {
        max-width: 85vw;
        max-height: 88vh;
    }
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 90vw;
        max-height: 85vh;
    }

    .color-option {
        width: 58px !important;
        height: 72px !important;
    }

    .modal-main-image {
        object-fit: contain !important;
        object-position: center !important;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-height: 80vh;
        margin: 0.5rem;
        border: 2px solid #e5e7eb;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }

    .color-option {
        width: 58px !important;
        height: 72px !important;
    }

    .modal-main-image {
        object-fit: contain !important;
        object-position: center !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Removed dark theme styles to keep cards white */
}