/* Custom styles for enhanced SEO and performance */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

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

/* Enhanced focus states for accessibility */
input:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Custom animations for better UX */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Responsive typography */
@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Print styles for better SEO */
@media print {
    .no-print {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Highlight updated results */
.highlight {
    background-color: #fef3c7;
    transition: background-color 0.3s ease;
}

/* Error states */
.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* Success states */
.success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    input, select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Performance optimizations */
.container {
    contain: layout style;
}

/* Critical rendering path optimization */
above-the-fold {
    contain: layout;
}

/* Professional Ad Styling */
.header-ad-space, .sidebar-ad-space, .bottom-ad-space {
    transition: all 0.3s ease;
}

.header-ad-space:hover, .sidebar-ad-space:hover, .bottom-ad-space:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.ad-placeholder {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e0;
    transition: all 0.3s ease;
}

.ad-placeholder:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

/* SEO-optimized content styling */
.seo-highlight {
    background: linear-gradient(120deg, #fef3c7 0%, #fde68a 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Enhanced CTA buttons */
.cta-button {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* USA flag accent styling */
.usa-accent {
    background: linear-gradient(45deg, #ef4444 0%, #ffffff 33%, #ffffff 66%, #3b82f6 100%);
    background-size: 20px 20px;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced result cards */
.result-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #10b981, #f59e0b, #ef4444);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.result-card:hover::before {
    transform: scaleX(1);
}

/* Mobile-first ad responsive design */
@media (max-width: 768px) {
    .header-ad-space .ad-placeholder {
        height: 60px;
        font-size: 12px;
    }
    
    .sidebar-ad-space {
        margin-bottom: 1rem;
    }
    
    .bottom-ad-space .ad-placeholder {
        height: 80px;
    }
}

/* Print-friendly styles for SEO */
@media print {
    .header-ad-space, .sidebar-ad-space, .bottom-ad-space {
        display: none;
    }
    
    .calculator-section {
        page-break-inside: avoid;
    }
}
