/* ========================================
   Crawlr.pro - Custom Styles
   ======================================== */

/* ========================================
   Emoji Font Fallback for Cross-Browser Flag Support
   Ensures language flags display correctly on Windows + Chrome
   ======================================== */

/* Language dropdown flags */
#lang-menu [data-lang] span:first-child {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
    font-variant-emoji: emoji;
    display: inline-block;
}

/* General flag emoji class */
.flag-emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
    font-variant-emoji: emoji;
    display: inline-block;
}

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-primary: #00d4aa;
    --accent-secondary: #6366f1;
    --border-color: #27272a;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Selection */
::selection {
    background-color: var(--accent-primary);
    color: var(--bg-primary);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Background Patterns */
.bg-grid-pattern {
    background-image: radial-gradient(circle at 1px 1px, var(--border-color) 1px, transparent 0);
    background-size: 40px 40px;
}

.bg-gradient-radial {
    background: radial-gradient(ellipse at center, var(--accent-primary) 0%, transparent 70%);
    opacity: 0.1;
}

/* Code Tabs */
.code-tab {
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.code-tab:hover {
    color: var(--text-primary);
}

.code-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.code-tab:focus {
    outline: none;
}

/* Code Panels */
.code-panel {
    display: none;
}

.code-panel.active {
    display: block;
}

/* Code Blocks */
pre {
    margin: 0;
    padding: 0;
}

code {
    font-family: 'JetBrains Mono', monospace;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%) translateX(-50%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0) translateX(-50%);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* Focus States */
input:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Remove focus outline from navigation links and buttons */
nav a:focus,
nav button:focus,
.desktop-menu a:focus {
    outline: none;
}

/* Form Styles */
input::placeholder {
    color: var(--text-secondary);
}

/* Card Hover Effects */
.feature-card {
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
}

/* Glow Effect */
.glow {
    box-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    z-index: 100;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--accent-primary);
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: visible;
    transition: max-height 0.3s ease;
    position: relative;
    z-index: 50;
    background-color: var(--bg-secondary);
}

#mobile-menu.open {
    max-height: 500px;
}

/* Responsive Typography */
@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.5rem;
    }

    pre {
        font-size: 0.75rem;
    }
}

/* Desktop Navigation Menu - responsive display */
.desktop-menu {
    display: none;
}

@media (min-width: 768px) {
    .desktop-menu {
        display: flex;
    }
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Smooth transitions for all interactive elements */
a, button {
    transition: all 0.2s ease;
}

/* Ensure code blocks don't break layout */
pre code {
    white-space: pre;
    word-wrap: normal;
    overflow-x: auto;
    display: block;
}

/* Better mobile touch targets */
@media (max-width: 640px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Print styles */
@media print {
    nav,
    footer,
    #cta,
    .animate-bounce {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}

/* ========================================
   Emoji Font Fallback for Cross-Browser Flag Support
   ======================================== */

/* Language dropdown flags */
#lang-menu [data-lang] span:first-child {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
    font-variant-emoji: emoji;
    display: inline-block;
}

/* General flag emoji class (for future use) */
.flag-emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
    font-variant-emoji: emoji;
    display: inline-block;
}
