/* ========================================
   GLOBAL RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global smooth transitions for interactive elements */
button, a, input, textarea, select, 
.btn, .modal, .card, .prompt-card, 
[role="button"], [tabindex]:not([tabindex="-1"]) {
    transition: background-color var(--transition-normal),
                color var(--transition-normal),
                border-color var(--transition-normal),
                opacity var(--transition-normal),
                transform var(--transition-normal),
                box-shadow var(--transition-normal);
}

/* ========================================
   HTML & BODY - PWA Fullscreen Support
   ======================================== */
html {
    height: 100%;
    height: 100dvh;
    background: hsl(240 8% 10%);
    /* Цвет за пределами safe area */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, hsl(240 8% 12%) 0%, hsl(240 8% 10%) 50%, hsl(240 8% 12%) 100%);
    background-attachment: fixed;
    color: hsl(var(--foreground));
    min-height: 100%;
    min-height: 100dvh;
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-feature-settings: "rlig" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Performance optimizations */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    /* НЕ добавляем padding для safe areas на body - это делается в компонентах */
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, hsl(25 85% 55% / 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, hsl(195 75% 65% / 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Prevent pull-to-refresh on mobile */
html, body {
    overscroll-behavior: none;
}

/* ========================================
   SCROLLBAR STYLES
   ======================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted-foreground) / 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: hsl(var(--muted-foreground) / 0.3);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: hsl(var(--muted-foreground) / 0.5);
}

/* Hide scrollbar on mobile */
@media (max-width: 767px) {
    *::-webkit-scrollbar {
        display: none;
    }
    
    * {
        scrollbar-width: none;
    }
}

/* ========================================
   TEXT SELECTION
   ======================================== */
::selection {
    background-color: hsl(var(--selection));
}

::-moz-selection {
    background-color: hsl(var(--selection));
}

/* ========================================
   ACCESSIBILITY & FOCUS
   ======================================== */
button, a, input, textarea, select {
    -webkit-tap-highlight-color: transparent;
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}

/* Remove focus outline on mouse/touch */
:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   SMOOTH SCROLLING
   ======================================== */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
