/* Custom CSS for Free Trade Compliance Helper */

:root {
    --primary-color: #0066cc;
    --secondary-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-gray: #f8f9fa;
    --border-radius: 8px;
}

/* Typography */
.fw-bold {
    font-weight: 700 !important;
}

/* Hero Section with Professional Background */
.hero-section {
    background: 
        linear-gradient(135deg, rgba(0, 102, 204, 0.85) 0%, rgba(0, 68, 153, 0.85) 100%),
        url('https://images.unsplash.com/photo-1578662996442-48f60103fc96?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 60vh;
    position: relative;
}

/* Fallback gradient if image doesn't load */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #004499 100%);
    z-index: -1;
}

.min-vh-50 {
    min-height: 50vh;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004499 100%);
}

/* About Section Background */
.about-section {
    background: 
        linear-gradient(rgba(248, 249, 250, 0.95), rgba(248, 249, 250, 0.95)),
        url('https://images.unsplash.com/photo-1521791136064-7986c2920216?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: scroll;
}

/* Features Section Background */
.features-section {
    background: 
        linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),
        url('https://images.unsplash.com/photo-1554224155-6726b3ff858f?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
}

/* Process Section Background */
.process-section {
    background: 
        linear-gradient(rgba(248, 249, 250, 0.98), rgba(248, 249, 250, 0.98)),
        url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
}

/* Pricing Section Background */
.pricing-section {
    background: 
        linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)),
        url('https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
}

/* CTA Section Background */
.cta-section {
    background: 
        linear-gradient(135deg, rgba(0, 102, 204, 0.9) 0%, rgba(0, 68, 153, 0.9) 100%),
        url('https://images.unsplash.com/photo-1601584115197-04ecc0da31d7?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.role-card, .country-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.role-card:hover, .country-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.role-card.border-primary, .country-card.border-primary {
    border-color: var(--primary-color) !important;
    background-color: rgba(0, 102, 204, 0.05);
}

/* Feature Cards */
.feature-icon {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Process Steps */
.process-step {
    position: relative;
}

.step-number {
    font-size: 1.5rem;
    width: 60px;
    height: 60px;
    margin: 0 auto;
}

/* Pricing Cards */
.price-display {
    font-size: 2.5rem;
    line-height: 1;
}

.flag-icon {
    font-size: 4rem;
    line-height: 1;
}

/* Security badges */
.security-badge {
    transition: transform 0.2s ease;
}

.security-badge:hover {
    transform: scale(1.05);
}

/* Payment form */
#card-element {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 10px;
    background-color: white;
}

#card-element.StripeElement--focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Progress bar */
.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1.1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Navigation */
.navbar-brand {
    font-size: 1.3rem;
    font-weight: 700;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-soft {
    box-shadow: 0 2px 20px rgba(0,0,0,0.1) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        min-height: 40vh;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .price-display {
        font-size: 2rem;
    }
    
    .flag-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

/* Loading States */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Form Validation */
.is-invalid {
    border-color: #dc3545;
}

.is-valid {
    border-color: #28a745;
}

/* Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #ffffff;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.6s ease-out;
}

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

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #004499;
}


/* === PERFORMANCE OPTIMIZATIONS (Added after memory leak fixes) === */

/* Hardware acceleration for smoother animations */
.country-card,
.service-card, 
.pricing-card,
.btn {
    will-change: auto;
    backface-visibility: hidden;
}

/* Optimized hover effects */
.country-card:hover {
    transform: translateY(-5px);
    transition: transform 0.2s ease;
}

.service-card:hover {
    transform: translateY(-3px);
    transition: transform 0.2s ease;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .country-card:hover,
    .service-card:hover,
    .pricing-card:hover {
        transform: none;
    }
    
    /* Optimize background images */
    .hero-section,
    .features-section,
    .cta-section {
        background-attachment: scroll !important;
    }
    
    /* Improve text readability */
    .display-4 {
        font-size: 2rem;
    }
    
    .price-display {
        font-size: 2rem;
    }
}

/* Accessibility improvements */
.btn:focus,
.card:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* 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;
    }
}

/* Print optimizations */
@media print {
    .hero-section {
        background: #f8f9fa !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
    }
    
    .card {
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
    
    .btn {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
}

/* Loading optimizations */
.hero-section {
    opacity: 0;
    animation: fadeInSection 0.6s ease-out 0.1s forwards;
}

@keyframes fadeInSection {
    to {
        opacity: 1;
    }
}

/* Fallback colors for gradients */
.hero-section {
    background-color: #0066cc; /* Fallback */
}

.pricing-card.featured {
    background-color: #0066cc; /* Fallback */
}

.service-icon {
    background-color: #0066cc; /* Fallback */
}


/* === PERFORMANCE OPTIMIZATIONS === */
/* Performance Optimized CSS Additions */

/* Add hardware acceleration for smoother animations */
.country-card,
.service-card,
.pricing-card,
.btn {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize animations for 60fps */
.country-card:hover {
    transform: translate3d(0, -10px, 0) scale3d(1.02, 1.02, 1);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Add fallback colors for gradients */
.hero-section {
    background-color: #0066cc; /* Fallback */
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.85) 0%, rgba(0, 68, 153, 0.85) 100%);
}

/* Improve mobile performance */
@media (max-width: 768px) {
    /* Disable heavy animations on mobile */
    .country-card:hover,
    .service-card:hover,
    .pricing-card:hover {
        transform: none;
        transition: none;
    }
    
    /* Optimize background attachments */
    .hero-section,
    .features-section,
    .cta-section {
        background-attachment: scroll !important;
    }
}

/* Fix accessibility issues */
.btn:focus,
.card:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Improve print styles */
@media print {
    .hero-section {
        background: #f8f9fa !important;
        color: #000 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
}

/* Loading states to prevent layout shift */
.hero-section {
    min-height: 60vh;
    opacity: 0;
    animation: fadeInHero 0.8s ease-out forwards;
}

@keyframes fadeInHero {
    to {
        opacity: 1;
    }
}

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


/* === PERFORMANCE OPTIMIZATIONS === */
/* Performance Optimized CSS Additions */

/* Add hardware acceleration for smoother animations */
.country-card,
.service-card,
.pricing-card,
.btn {
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize animations for 60fps */
.country-card:hover {
    transform: translate3d(0, -10px, 0) scale3d(1.02, 1.02, 1);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Add fallback colors for gradients */
.hero-section {
    background-color: #0066cc; /* Fallback */
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.85) 0%, rgba(0, 68, 153, 0.85) 100%);
}

/* Improve mobile performance */
@media (max-width: 768px) {
    /* Disable heavy animations on mobile */
    .country-card:hover,
    .service-card:hover,
    .pricing-card:hover {
        transform: none;
        transition: none;
    }
    
    /* Optimize background attachments */
    .hero-section,
    .features-section,
    .cta-section {
        background-attachment: scroll !important;
    }
}

/* Fix accessibility issues */
.btn:focus,
.card:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Improve print styles */
@media print {
    .hero-section {
        background: #f8f9fa !important;
        color: #000 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
}

/* Loading states to prevent layout shift */
.hero-section {
    min-height: 60vh;
    opacity: 0;
    animation: fadeInHero 0.8s ease-out forwards;
}

@keyframes fadeInHero {
    to {
        opacity: 1;
    }
}

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