/* CoreVoice - Cyber Dark Theme Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5.5rem;
}

/* Lenis Smooth Inertia Scroll Standards */
html.lenis, html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-scrolling iframe {
    pointer-events: none;
}


:root {
    --bg-dark: #07090E;
    --card-bg: rgba(15, 23, 42, 0.75);
    --border-color: rgba(51, 65, 85, 0.6);
    --accent-emerald: #10B981;
    --accent-cyan: #06B6D4;
    --accent-purple: #8B5CF6;
}

html {
    overflow-x: clip;
    max-width: 100vw;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: #F1F5F9;
    overflow-x: clip;
    max-width: 100vw;
    position: relative;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Background Gradients & Glows */
.bg-grid-pattern {
    background-size: 40px 40px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.glow-emerald {
    box-shadow: 0 0 35px -5px rgba(16, 185, 129, 0.25);
}

.glow-cyan {
    box-shadow: 0 0 35px -5px rgba(6, 182, 212, 0.25);
}

.glow-purple {
    box-shadow: 0 0 35px -5px rgba(139, 92, 246, 0.25);
}

/* Glassmorphism Cards - Stable, smooth & non-jittery */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.25s ease;
}

.glass-card:hover {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 14px 35px -10px rgba(0, 0, 0, 0.6), 
                0 0 25px -5px rgba(16, 185, 129, 0.12);
}

/* Dropdown Menus (100% Solid Opaque Background - Zero Transparency Bleed) */
.dropdown-menu-panel,
header .group > div.absolute {
    background-color: #0c101c !important;
    background: #0c101c !important;
    border: 1px solid rgba(51, 65, 85, 0.9) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.95), 0 0 25px -5px rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    z-index: 50 !important;
}

/* Invisible bridge: covers the gap between button and dropdown menu so hovering does not break */
.dropdown-menu-panel::before,
header .group > div.absolute::before {
    content: '';
    position: absolute;
    top: -24px;
    left: -15px;
    right: -15px;
    height: 26px;
    background: transparent;
    pointer-events: auto;
    z-index: 1;
}

/* Maintain hover state and support click toggle and focus-within */
.group:hover > .dropdown-menu-panel,
.group:hover > div.absolute,
.group:focus-within > .dropdown-menu-panel,
.group:focus-within > div.absolute,
.group.is-open > .dropdown-menu-panel,
.group.is-open > div.absolute,
.dropdown-menu-panel.is-open {
    display: block !important;
}

.group.is-open svg.group-hover\:rotate-180 {
    transform: rotate(180deg);
}

header .group > div.absolute a:hover,
header .group > div.absolute button:hover {
    background-color: #172033 !important;
}

.dropdown-menu-panel a,
.dropdown-menu-panel button,
header .group > div.absolute a,
header .group > div.absolute button {
    position: relative;
    z-index: 2;
}

/* Custom Cyber Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 9999px;
    background: #1E293B;
    outline: none;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #10B981;
    cursor: pointer;
    border: 3px solid #07090E;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
    transition: all 0.15s ease-in-out;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #34D399;
    box-shadow: 0 0 20px rgba(16, 185, 129, 1);
}

input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #10B981;
    cursor: pointer;
    border: 3px solid #07090E;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
    transition: all 0.15s ease-in-out;
}

/* Custom Checkbox */
.custom-checkbox:checked {
    background-color: #10B981;
    border-color: #10B981;
}

/* Smooth modal transitions & mobile scrolling */
.modal-overlay {
    transition: opacity 0.25s ease-out;
}

.modal-content {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Custom scrollbars for modals & overflow containers */
.modal-content::-webkit-scrollbar,
.overflow-x-auto::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.modal-content::-webkit-scrollbar-track,
.overflow-x-auto::-webkit-scrollbar-track {
    background: #0B0F19;
}

.modal-content::-webkit-scrollbar-thumb,
.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #1E293B;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #10B981;
}

/* Table Responsive Handling */
.overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

/* Pulsing badge */
@keyframes ping-slow {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0.4; }
    100% { transform: scale(1); opacity: 0.8; }
}

.animate-ping-slow {
    animation: ping-slow 2.5s infinite;
}



/* Subtle Scroll Reveal & Motion (Compositor Thread: opacity + transform) */
.reveal-init {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal-init.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Subtle Interactive Button Hover */
.btn-motion {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                filter 0.2s ease;
}

.btn-motion:hover {
    transform: scale(1.02);
    filter: brightness(1.06);
}

/* Accessibility: Respect Reduced Motion Preferences */
@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;
    }
}


/* ==========================================================================
   MODAL DIALOGS - 100% SOLID OPAQUE HIGH-CONTRAST (Native <dialog> + Legacy)
   ========================================================================== */
dialog.cv-dialog:not([open]) {
    display: none !important;
}

dialog.cv-dialog {
    background: transparent !important;
    border: none !important;
    padding: 1rem;
    margin: auto;
    max-width: min(96vw, 38rem);
    max-height: 94vh;
    width: 100%;
    color: #F1F5F9;
    overflow: visible;
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    transition: opacity 0.18s ease-out, transform 0.18s ease-out, overlay 0.18s ease-out allow-discrete, display 0.18s ease-out allow-discrete;
}

dialog.cv-dialog.cv-dialog-md {
    max-width: min(96vw, 28rem);
}

dialog.cv-dialog[open] {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@starting-style {
    dialog.cv-dialog[open] {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }
}

dialog.cv-dialog:modal {
    overscroll-behavior: contain;
}

dialog.cv-dialog::backdrop {
    background-color: rgba(3, 5, 10, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    overscroll-behavior: contain;
}

dialog.cv-dialog > .cv-dialog-box {
    background: #0B0F19 !important;
    background-color: #0B0F19 !important;
    border: 1px solid #1E293B !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.95), 0 0 35px rgba(0, 0, 0, 0.9) !important;
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    opacity: 1 !important;
}

.modal-overlay,
.fixed.inset-0.z-50,
#modal-how-to-connect:not(dialog),
#modal-custom-item:not(dialog),
#modal-server-settings:not(dialog),
#modal-boss-kill:not(dialog),
#modal-alliance-settings:not(dialog),
#modal-add-member:not(dialog),
#extend-modal:not(dialog),
#token-modal:not(dialog),
#order-modal:not(dialog),
#portal-modal:not(dialog) {
    background-color: rgba(3, 5, 10, 0.92) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
}

.modal-content,
.modal-dialog-box {
    background: #0B0F19 !important;
    background-color: #0B0F19 !important;
    border: 1px solid #1E293B !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.95), 0 0 35px rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
}

/* Modal Inner Step Boxes & Inputs (Solid Opaque Contrast) */
#modal-how-to-connect .bg-dark-950\/80,
#modal-how-to-connect .p-3\.5,
#modal-how-to-connect .p-4,
.modal-step-box {
    background: #06080D !important;
    background-color: #06080D !important;
    border: 1px solid #1E293B !important;
}

/* Keyboard accessibility focus ring */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid #10B981;
    outline-offset: 2px;
}

/* Visually hidden utility keeping nodes in the accessibility tree */
.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Accessible validation feedback (post-interaction :user-invalid or explicit aria-invalid) */
:is(input, textarea, select):is(:user-invalid, [aria-invalid="true"]) {
    border-color: #F43F5E !important;
    box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.35);
}

/* Universal Dark Background Utility Classes (Fallback for Tailwind CDN) */
.bg-dark-950 { background-color: #07090E !important; }
.bg-dark-900 { background-color: #0B0F19 !important; }
.bg-dark-800 { background-color: #111827 !important; }
.bg-dark-700 { background-color: #1E293B !important; }
.bg-dark-600 { background-color: #334155 !important; }

.border-dark-950 { border-color: #07090E !important; }
.border-dark-900 { border-color: #0B0F19 !important; }
.border-dark-800 { border-color: #111827 !important; }
.border-dark-700 { border-color: #1E293B !important; }
.border-dark-600 { border-color: #334155 !important; }

/* No-Prices Quote Mode: Hide Currency Switchers */
html[data-show-prices="false"] #currency-usd,
html[data-show-prices="false"] #currency-eur,
html[data-show-prices="false"] #currency-uah,
html[data-show-prices="false"] #page-curr-usd,
html[data-show-prices="false"] #page-curr-eur,
html[data-show-prices="false"] #page-curr-uah,
html[data-show-prices="false"] .bg-dark-900:has(#currency-usd),
html[data-show-prices="false"] .bg-dark-900:has(#page-curr-usd) {
    display: none !important;
}
