
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism */
.glass {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.72);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .glass {
    background: rgba(28, 28, 30, 0.72);
}

/* Scrolled Header Effect */
.glass.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.dark .glass.scrolled {
    background: rgba(28, 28, 30, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Code Font */
.code-font {
    font-family: 'Fira Code', monospace;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* PrismJS Overrides */
pre[class*="language-"] {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

code[class*="language-"] {
    background: transparent !important;
    text-shadow: none !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.line-numbers .line-numbers-rows {
    border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding-right: 12px !important;
}

.dark .line-numbers .line-numbers-rows {
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding-right: 12px !important;
}

/* Utilities */
.card-shadow {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

/* ========================================
   PHASE 1: NAVIGATION & HOVER EFFECTS
   ======================================== */

/* Enhanced Navigation Pills */
header nav a {
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header nav a:hover {
    background: rgba(0, 122, 255, 0.1);
    transform: translateY(-1px);
}

.dark header nav a:hover {
    background: rgba(0, 122, 255, 0.15);
}

/* Active Page Indicator */
header nav a.active,
.mobile-menu nav a.active {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white !important;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    padding: 5rem 2rem;
}

.dark .mobile-menu {
    background: rgba(0, 0, 0, 0.98);
}

.mobile-menu.open {
    right: 0;
}

.mobile-menu nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-menu nav a {
    font-size: 1.5rem;
    padding: 1rem;
    text-align: center;
}

/* Hide mobile menu on desktop */
@media (min-width: 768px) {
    .mobile-menu {
        display: none !important;
    }
}

/* Hamburger Icon */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: currentColor;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
}

/* Desktop Navigation - Show on medium screens and above */
@media (min-width: 768px) {
    header nav {
        display: flex !important;
    }
}

/* Card Hover Effects */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.dark .hover-lift:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Button Animations */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 122, 255, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Icon Glow Effect */
.icon-glow {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-glow:hover {
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    transform: scale(1.1) rotate(5deg);
}

/* ========================================
   PHASE 2: ANIMATIONS & POLISH
   ======================================== */

/* Fade In Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.slide-in-right {
    animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger Delays */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* Scroll Reveal */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Pulse Animation */
@keyframes pulse-custom {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }
}

.animate-pulse-custom {
    animation: pulse-custom 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    border: 2px solid rgba(0, 122, 255, 0.1);
    border-top-color: #007AFF;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.6s linear infinite;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.dark .toast {
    background: #1C1C1E;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid #34C759;
}

.toast.error {
    border-left: 4px solid #FF3B30;
}

/* Enhanced FAQ Accordion */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    padding: 0 1rem;
}

.accordion-content.open {
    max-height: 500px;
    opacity: 1;
    padding: 1rem;
}

.accordion-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-btn.active .accordion-icon {
    transform: rotate(180deg);
}

/* Search Bar Enhancements */
#url-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.input-wrapper {
    position: relative;
}

.clear-btn {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.input-wrapper:hover .clear-btn,
.clear-btn.show {
    opacity: 1;
}

/* ========================================
   PHASE 3: ADVANCED FEATURES
   ======================================== */

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Focus Visible States */
*:focus-visible {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to Content Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #007AFF;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transition: top 0.3s ease;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.15) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.dark .skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.06) 25%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Additional UI Helpers */
/* Use a unique utility name to avoid clashing with Tailwind's `.hidden` */
.u-hidden {
    display: none !important;
}

/* Smooth Page Transitions */
.page-transition {
    opacity: 0;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Hover Underline Animation */
.hover-underline {
    position: relative;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-underline:hover::after {
    width: 100%;
}