﻿#loading {
    position: fixed;
    z-index: 50000;
    background-image: url('/images/loader.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.9); /* Adjusted opacity for better mobile performance */
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    margin: 0 auto;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    transform: translateZ(0); /* Enable hardware acceleration */
}

.dark #loading {
    background-color: #020617;
}

#loading.hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

/* Mobile-specific improvements for auth pages */
@media (max-width: 768px) {
    /* Ensure proper viewport handling on mobile */
    .auth-container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Improve touch targets */
    button, .btn, a[role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better input handling on mobile */
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Improve modal positioning on mobile */
    .modal-mobile {
        padding: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Testimonial Scroller Styles */
.testimonial-container {
    max-width: 100vw;
    overflow: hidden;
}

.testimonial-track {
    display: flex;
    width: calc(200% + 64px); /* Double width plus gap compensation for seamless loop */
    gap: 0; /* Remove gap here since we're using mx-4 */
}

.testimonial-item {
    width: 420px;
    max-width: 420px;
    flex-shrink: 0;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-50% - 32px)); /* Adjust for margin compensation */
    }
}

.animate-scroll {
    animation: scroll 40s linear infinite;
}

.testimonial-track:hover {
    animation-play-state: paused;
}

/* Enhanced modern styling */
.testimonial-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.testimonial-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .testimonial-item {
        width: 320px;
        max-width: 320px;
    }
    
    .animate-scroll {
        animation: scroll 35s linear infinite;
    }
    
    /* Disable hover effects on mobile for better performance */
    .testimonial-item:hover {
        transform: none;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 480px) {
    .testimonial-item {
        width: 280px;
        max-width: 280px;
        padding: 1rem;
    }
    
    .testimonial-item p {
        font-size: 0.8rem;
    }
    
    .animate-scroll {
        animation: scroll 30s linear infinite;
    }
}

/* Line clamp utility for text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile-specific landing page improvements */
@media (max-width: 768px) {
    /* Ensure proper spacing on mobile landing page */
    .landing-hero {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* Better button sizing on mobile */
    .landing-buttons {
        gap: 1rem;
    }
    
    .landing-buttons a {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Forex rates mobile layout */
    .forex-rates-mobile {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .forex-rate-card {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

/* Mobile login page improvements */
@media (max-width: 1024px) {
    /* Tab styling for mobile */
    .mobile-tabs {
        border-bottom: 1px solid #e5e7eb;
    }
    
    .mobile-tab {
        transition: all 0.2s ease;
    }
    
    .mobile-tab.active {
        background-color: white;
        border-bottom: 2px solid #09315c;
        color: #09315c;
    }
    
    .mobile-tab:not(.active) {
        color: #6b7280;
        background-color: transparent;
    }
}

/* Improve form usability on mobile */
@media (max-width: 768px) {
    .form-input {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .form-button {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        min-height: 44px;
    }
}

/* Safe area handling for newer mobile devices */
@supports (padding: max(0px)) {
    .safe-area-inset {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Mobile Carousel Styles */
.mobile-carousel {
    touch-action: pan-y pinch-zoom;
}

.carousel-track {
    will-change: transform;
}

.carousel-dot {
    cursor: pointer;
    transition: all 0.2s ease;
    width: 6px !important;
    height: 6px !important;
    min-width: 6px;
    min-height: 6px;
    border: none;
    outline: none;
}

.carousel-dot:hover {
    transform: scale(1.3);
}

.carousel-dot.active {
    background-color: white !important;
    transform: scale(1.2);
}

/* Carousel navigation buttons */
.carousel-nav-btn {
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.carousel-nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.6);
    transform: scale(1.1);
}

/* Improve carousel performance on mobile */
@media (max-width: 768px) {
    .carousel-track {
        transform: translateZ(0); /* Enable hardware acceleration */
    }
    
    /* Ensure proper touch handling */
    .mobile-carousel {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    
    /* Better spacing for mobile carousel */
    .carousel-slide {
        padding: 0 0.5rem;
    }
    
    /* Improve carousel article sizing on mobile */
    .carousel-article {
        min-height: 200px;
        max-height: 280px;
    }
    
    .carousel-article .article-image {
        height: 60%;
        min-height: 120px;
    }
    
    .carousel-article .article-content {
        height: 40%;
        min-height: 80px;
    }
}

/* Forex rates padding improvement */
@media (max-width: 768px) {
    .forex-rates-container {
        padding-right: 1rem;
    }
    
    .forex-rate-item {
        margin-right: 0.5rem;
    }
}
