/* Custom Styles for AI-Powered Fractional CFO Website */

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

body {
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom animations and transitions */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Navigation enhancements */
nav {
    transition: all 0.3s ease;
}

nav.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Hero section animations */
.hero-animate {
    animation: fadeInUp 0.8s ease-out;
}

.hero-animate:nth-child(2) {
    animation-delay: 0.2s;
}

.hero-animate:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Enhanced gradients */
.gradient-text {
    background: linear-gradient(135deg, #1e40af, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    background: linear-gradient(45deg, #1e40af, #f59e0b, #1e40af);
    background-size: 200% 200%;
    animation: gradient-shift 4s ease infinite;
    padding: 2px;
    border-radius: 12px;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-border-content {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
    transform-origin: center;
}

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

/* Button enhancements */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

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

/* Section animations */
.section-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.section-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* AI-themed elements */
.ai-glow {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
    animation: pulse 2s infinite;
}

.ai-grid {
    background-image: 
        linear-gradient(rgba(30, 64, 175, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 64, 175, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
}

.ai-grid:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
}

/* Performance metrics styling */
.metric-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.metric-card:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transform: translateY(-5px);
}

/* Form enhancements */
.form-input {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.form-input:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    transform: translateY(-2px);
}

.form-input:valid {
    border-color: #10b981;
}

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

.btn-loading:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: currentColor;
    animation: spin 1s ease infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success/Error states */
.success-message {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    animation: slideInRight 0.5s ease;
}

.error-message {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    animation: slideInRight 0.5s ease;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .hero-text {
        font-size: 2.5rem;
    }
    
    .section-padding {
        padding: 3rem 0;
    }
    
    .card-hover:hover {
        transform: none;
    }
    
    .gradient-border {
        padding: 1px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gradient-text {
        -webkit-text-fill-color: initial;
        color: #1e40af;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-color: #f1f5f9;
        --card-bg: #1e293b;
    }
}

/* Print styles */
@media print {
    nav, footer {
        display: none;
    }
    
    .bg-gradient-to-br {
        background: white !important;
        color: black !important;
    }
    
    .text-white {
        color: black !important;
    }
}

/* Accessibility enhancements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #1e40af;
    outline-offset: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #1e40af;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

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

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

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

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

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

/* Selection styling */
::selection {
    background: rgba(245, 158, 11, 0.3);
    color: #1e40af;
}

/* Utility classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur-strong {
    backdrop-filter: blur(20px);
}

.transition-all {
    transition: all 0.3s ease;
}

/* Component-specific styles */
.testimonial-quote {
    font-size: 1.125rem;
    line-height: 1.7;
    position: relative;
}

.testimonial-quote:before {
    content: '"';
    font-size: 4rem;
    color: rgba(245, 158, 11, 0.3);
    position: absolute;
    top: -1rem;
    left: -1rem;
    font-family: Georgia, serif;
}

/* Statistics counter animation */
.counter {
    font-weight: 700;
    font-size: 2rem;
    display: inline-block;
}

/* Interactive elements */
.interactive-card {
    cursor: pointer;
    user-select: none;
}

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

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

/* Advanced grid layouts */
.masonry-grid {
    column-count: 3;
    column-gap: 1.5rem;
    column-fill: balance;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

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

/* Enhanced tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: #1e40af;
    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;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Progressive enhancement */
.js .enhanced-only {
    display: block;
}

.no-js .enhanced-only {
    display: none;
}

/* Modern CSS features */
@supports (backdrop-filter: blur(10px)) {
    .modern-backdrop {
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.8);
    }
}

/* CSS Grid fallback */
@supports not (display: grid) {
    .grid-fallback {
        display: flex;
        flex-wrap: wrap;
    }
    
    .grid-fallback > * {
        flex: 1 1 300px;
        margin: 0.5rem;
    }
}

/* Container queries (future-proofing) */
@container (min-width: 400px) {
    .card-responsive {
        display: flex;
        align-items: center;
    }
}