/* Tailwind base imports (for Vite/PostCSS) */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Enhanced styles to complement Tailwind CSS */

/* Advanced Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

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

.animate-slide-left {
    animation: slideInLeft 0.8s ease-out;
}

.animate-slide-right {
    animation: slideInRight 0.8s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Animation Delays */
.animation-delay-100 {
    animation-delay: 0.1s;
    animation-fill-mode: both;
}

.animation-delay-200 {
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.animation-delay-300 {
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

.animation-delay-400 {
    animation-delay: 0.4s;
    animation-fill-mode: both;
}

.animation-delay-500 {
    animation-delay: 0.5s;
    animation-fill-mode: both;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

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

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

::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8, #64748b);
}

/* Enhanced Extension Cards */
.extension-card {
    position: relative;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.extension-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: -1;
}

.extension-card:hover::before {
    opacity: 1;
}

/* Store Button Enhancements */
.store-btn {
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.store-btn::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;
}

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

.store-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.store-btn:active {
    transform: translateY(-1px) scale(1.02);
}

/* Enhanced Focus Styles for Accessibility */
.focus\:ring-2:focus {
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}

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

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mobile Menu Improvements */
#mobile-menu {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
}

/* Loading Spinner Improvements */
.loading-spinner {
    border-color: #e5e7eb #e5e7eb #e5e7eb #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Image Improvements */
img {
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

img:hover {
    filter: brightness(1.05) contrast(1.05);
}

/* Enhanced Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .extension-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #374151 !important;
    }
    
    .bg-gray-50 {
        background-color: #f9fafb !important;
    }
    
    .border-gray-200 {
        border-color: #6b7280 !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-spin {
        animation: none !important;
    }
    
    .animate-float {
        animation: none !important;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    :root {
        --tw-bg-opacity: 1;
        --tw-text-opacity: 1;
    }
    
    .extension-card {
        /* background-color: #1f2937; */
        /* border-color: #374151; */
    }
    
    .extension-card:hover {
        /* background-color: #111827; */
    }
}

/* Extension Grid Improvements */
.extensions-grid .extension-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.extensions-grid .extension-card:nth-child(1) { animation-delay: 0.1s; }
.extensions-grid .extension-card:nth-child(2) { animation-delay: 0.2s; }
.extensions-grid .extension-card:nth-child(3) { animation-delay: 0.3s; }
.extensions-grid .extension-card:nth-child(4) { animation-delay: 0.4s; }
.extensions-grid .extension-card:nth-child(5) { animation-delay: 0.5s; }
.extensions-grid .extension-card:nth-child(6) { animation-delay: 0.6s; }

/* Interactive Elements */
button, a {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

button:disabled, a:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Navigation Backdrop Blur */
.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Fallback for Older Browsers */
@supports not (backdrop-filter: blur(12px)) {
    .backdrop-blur-md {
        background-color: rgba(255, 255, 255, 0.95);
    }
}

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

.text-shadow-lg {
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}

/* Performance Optimizations */
.transform {
    transform: translateZ(0);
    will-change: transform;
}

/* Safari-specific Fixes */
@supports (-webkit-appearance: none) {
    .rounded-full {
        -webkit-border-radius: 50%;
        border-radius: 50%;
    }
    
    input[type="button"], input[type="submit"], button {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Firefox-specific Fixes */
@-moz-document url-prefix() {
    .extension-card {
        transform: translateZ(0);
    }
}

/* Enhanced Button Styles */
.btn-primary {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::before {
    width: 300px;
    height: 300px;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Micro-interactions */
.micro-bounce:hover {
    animation: micro-bounce 0.3s ease-in-out;
}

@keyframes micro-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Layout Improvements */
.container-fluid {
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Enhanced Responsive Design */
@media (max-width: 640px) {
    .extension-card {
        margin-bottom: 1rem;
    }
    
    .store-btn {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

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

/* Smooth Transitions */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Typography Enhancements */
.font-display {
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1, 'ss01' 1;
}

/* Selection Styles */
::selection {
    background-color: #3b82f6;
    color: white;
}

::-moz-selection {
    background-color: #3b82f6;
    color: white;
}

/* Specific fixes for recommendation badge */
.recommended-badge {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    padding: 8px 24px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(251, 191, 36, 0.4);
    white-space: nowrap;
}

/* Ensure parent container allows overflow for badges */
.pricing-card-container {
    overflow: visible !important;
    margin-top: 2rem;
}

/* Fix any z-index conflicts */
.tier-card {
    position: relative;
    z-index: 1;
}

.tier-card .recommended-badge {
    z-index: 10;
}

/* Enhanced Extension Cards */
.extension-card {
    position: relative;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.extension-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: -1;
}

.extension-card:hover::before {
    opacity: 1;
}

/* Store Button Enhancements */
.store-btn {
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.store-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Extension grid enhancements */
.extensions-grid {
    perspective: 1000px;
}

.extension-card {
    transform-style: preserve-3d;
    will-change: transform;
}

/* Enhanced animations for extension cards */
@keyframes cardFloatIn {
    0% {
        opacity: 0;
        transform: translateY(30px) rotateX(10deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.extension-card {
    animation: cardFloatIn 0.6s ease-out forwards;
}

/* Staggered animation delays */
.extension-card:nth-child(1) { animation-delay: 0.1s; }
.extension-card:nth-child(2) { animation-delay: 0.2s; }
.extension-card:nth-child(3) { animation-delay: 0.3s; }
.extension-card:nth-child(4) { animation-delay: 0.4s; }
.extension-card:nth-child(5) { animation-delay: 0.5s; }
.extension-card:nth-child(6) { animation-delay: 0.6s; }

/* Button ripple effect */
.store-btn {
    overflow: hidden;
    position: relative;
}

.store-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.store-btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(25, 25);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* Enhanced Background Animations */
@keyframes blob {
    0% {
        transform: translate(0px, 0px) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

.animate-blob {
    animation: blob 7s infinite;
}

/* Enhanced section backgrounds */
#extensions {
    position: relative;
    overflow: hidden;
}

#extensions::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    animation: floatBackground 20s ease-in-out infinite;
}

@keyframes floatBackground {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(-5%, -10%) rotate(1deg);
    }
    66% {
        transform: translate(5%, 5%) rotate(-1deg);
    }
}

/* Enhanced card hover effects */
.extension-card:hover {
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
    .animate-blob,
    #extensions::before {
        animation: none;
    }
    
    .extension-card {
        will-change: auto;
    }
}
