/* ==========================================================================
   Come4Play — custom layer над Tailwind
   1. Токени
   2. База
   3. Фонови текстури
   4. Форми / clip-path
   5. Панели (HUD)
   6. Бутони
   7. Навигация
   8. Заглавия
   9. Hero
   10. Компоненти
   11. Анимации при скрол
   12. Достъпност / reduced motion
   ========================================================================== */

/* 1. Токени ------------------------------------------------------------- */
:root {
    --ink: #07080a;
    --panel: #0d0f13;
    --panel-2: #121519;
    --line: #23272f;
    --brand: #ff7a18;
    --brand-soft: rgba(255, 122, 24, 0.14);
    --brand-line: rgba(255, 122, 24, 0.32);
    --nav-h: 72px;
}

/* 2. База --------------------------------------------------------------- */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
    background-color: var(--ink);
    font-family: 'Barlow', system-ui, sans-serif;
    font-weight: 500;
}

h1, h2, h3, h4, .font-display {
    font-family: 'Chakra Petch', system-ui, sans-serif;
    letter-spacing: 0.01em;
}

::selection {
    background: var(--brand);
    color: #0b0b0b;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0b0e;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand), #8a360a);
    border: 2px solid #0a0b0e;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff9130, var(--brand));
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: 2px;
}

/* 3. Фонови текстури ---------------------------------------------------- */
.bg-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 64px 64px;
    background-position: center;
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 35%, transparent 78%);
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 35%, transparent 78%);
}

.bg-noise::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

.hazard {
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255, 122, 24, 0.55) 0 10px,
        transparent 10px 20px
    );
}

.scanlines::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0 3px,
        rgba(0, 0, 0, 0.22) 3px 4px
    );
    mix-blend-mode: multiply;
}

/* 4. Форми / clip-path -------------------------------------------------- */
.clip-tag {
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.clip-tag-sm {
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.clip-slash {
    clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}

/* 5. Панели (HUD) ------------------------------------------------------- */
.hud {
    position: relative;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 45%),
        var(--panel);
    border: 1px solid var(--line);
    transition: border-color .35s ease, transform .35s ease, box-shadow .35s ease;
}

.hud:hover {
    transform: translateY(-4px);
}

/* Ъглови "скоби" като в игрален HUD */
.hud-corners::before,
.hud-corners::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--brand-line);
    transition: border-color .35s ease;
    pointer-events: none;
}

.hud-corners::before {
    top: -1px;
    left: -1px;
    border-right: 0;
    border-bottom: 0;
}

.hud-corners::after {
    right: -1px;
    bottom: -1px;
    border-left: 0;
    border-top: 0;
}

.group:hover .hud-corners::before,
.group:hover .hud-corners::after {
    border-color: var(--brand);
}

/* 6. Бутони ------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .95rem 1.6rem;
    font-family: 'Chakra Petch', system-ui, sans-serif;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: transform .2s ease, background-color .25s ease, border-color .25s ease, box-shadow .25s ease, color .25s ease;
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.btn:active {
    transform: translateY(1px) scale(.99);
}

.btn-primary {
    background: linear-gradient(120deg, #ff8a24, #e85f06);
    color: #120801;
    box-shadow: 0 0 0 1px rgba(255, 160, 80, .35), 0 14px 40px -18px rgba(255, 122, 24, .9);
}

.btn-primary:hover {
    background: linear-gradient(120deg, #ffa03d, #ff7a18);
    box-shadow: 0 0 0 1px rgba(255, 190, 130, .5), 0 18px 50px -16px rgba(255, 122, 24, 1);
    transform: translateY(-2px);
}

.btn-ghost {
    background: rgba(255, 255, 255, .035);
    border: 1px solid var(--line);
    color: #e8eaee;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, .07);
    border-color: var(--brand-line);
    color: #fff;
    transform: translateY(-2px);
}

/* Малки "чип" линкове (форум, VIP, банлист…) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1rem;
    font-family: 'Chakra Petch', system-ui, sans-serif;
    font-weight: 600;
    font-size: .8rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #b9bec8;
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--line);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: color .25s ease, border-color .25s ease, background-color .25s ease, transform .25s ease;
}

.chip:hover {
    color: #fff;
    border-color: var(--brand-line);
    background: var(--brand-soft);
    transform: translateY(-2px);
}

.chip i {
    color: var(--brand);
    font-size: 1rem;
}

/* 7. Навигация ---------------------------------------------------------- */
.nav-link {
    position: relative;
    font-family: 'Chakra Petch', system-ui, sans-serif;
    font-weight: 600;
    font-size: .875rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #9aa1ad;
    padding: .35rem 0;
    transition: color .25s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    height: 2px;
    width: 0;
    background: var(--brand);
    transition: width .3s cubic-bezier(.16, 1, .3, 1);
}

.nav-link:hover {
    color: #fff;
}

.nav-link:hover::after {
    width: 100%;
}

#site-nav {
    transition: background-color .35s ease, border-color .35s ease, box-shadow .35s ease;
}

#site-nav.is-scrolled {
    background-color: rgba(7, 8, 10, .92);
    border-color: var(--line);
    box-shadow: 0 18px 40px -30px rgba(0, 0, 0, 1);
}

/* Хамбургер */
.burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--brand);
    transition: transform .3s ease, opacity .2s ease;
}

.burger.is-open .burger-1 {
    transform: translateY(7px) rotate(45deg);
}

.burger.is-open .burger-2 {
    opacity: 0;
}

.burger.is-open .burger-3 {
    transform: translateY(-7px) rotate(-45deg);
}

/* 8. Заглавия ----------------------------------------------------------- */
.section-kicker {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--brand);
}

.title-outline {
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, .45);
}

.title-glow {
    text-shadow: 0 0 60px rgba(255, 122, 24, .45);
}

/* 9. Hero --------------------------------------------------------------- */
.hero-fade {
    background: linear-gradient(
        90deg,
        var(--ink) 0%,
        var(--ink) 26%,
        rgba(7, 8, 10, .92) 42%,
        rgba(7, 8, 10, .55) 60%,
        rgba(7, 8, 10, .1) 82%,
        rgba(7, 8, 10, 0) 100%
    );
}

@media (max-width: 1023px) {
    .hero-fade {
        background: linear-gradient(
            180deg,
            rgba(7, 8, 10, .88) 0%,
            rgba(7, 8, 10, .82) 45%,
            rgba(7, 8, 10, .96) 100%
        );
    }
}

.hero-title {
    font-weight: 700;
    line-height: .92;
    letter-spacing: -.01em;
}

/* Тънка вертикална линия-акцент вляво от hero текста */
.rail {
    background: linear-gradient(180deg, transparent, var(--brand) 20%, var(--brand) 80%, transparent);
}

/* 10. Компоненти -------------------------------------------------------- */
.stat-value {
    font-family: 'Chakra Petch', system-ui, sans-serif;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* Прогрес бар за играчи */
.slots-track {
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
}

.slots-fill {
    transition: width .8s cubic-bezier(.16, 1, .3, 1);
}

/* Списък с играчи – собствен скролбар */
.players-list {
    scrollbar-width: thin;
    scrollbar-color: var(--brand) transparent;
}

.players-list::-webkit-scrollbar {
    width: 6px;
}

.players-list::-webkit-scrollbar-thumb {
    background: var(--brand-line);
    border: 0;
}

/* Плавно отваряне/затваряне */
.collapsible {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .35s cubic-bezier(.16, 1, .3, 1);
}

.collapsible.is-open {
    grid-template-rows: 1fr;
}

.collapsible > div {
    overflow: hidden;
    min-height: 0;
}

.chevron {
    transition: transform .35s ease;
}

.is-open-btn .chevron {
    transform: rotate(180deg);
}

/* Мигаща точка за онлайн статус */
.pulse-dot {
    position: relative;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: inherit;
    animation: pulse-ring 2.2s cubic-bezier(0, 0, .2, 1) infinite;
}

@keyframes pulse-ring {
    0%        { transform: scale(1);   opacity: .75; }
    70%, 100% { transform: scale(2.6); opacity: 0; }
}

/* 11. Анимации при скрол ------------------------------------------------ */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s cubic-bezier(.16, 1, .3, 1), transform .7s cubic-bezier(.16, 1, .3, 1);
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* 12. Достъпност -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* 13. Форми ------------------------------------------------------------- */
.form-label {
    display: block;
    margin-bottom: .5rem;
    font-family: 'Chakra Petch', system-ui, sans-serif;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #8b93a1;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: .8rem 1rem;
    background: #0a0c0f;
    border: 1px solid var(--line);
    color: #e8eaee;
    font-family: 'Barlow', system-ui, sans-serif;
    font-size: .95rem;
    font-weight: 500;
    transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #4b5261;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand);
    background: #0c0e12;
    box-shadow: 0 0 0 1px rgba(255, 122, 24, .35), 0 0 30px -12px rgba(255, 122, 24, .8);
}

.form-input:disabled,
.form-select:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.form-textarea {
    min-height: 140px;
    resize: vertical;
    line-height: 1.6;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ff7a18'%3E%3Cpath d='M8 11.5 3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.form-hint {
    margin-top: .45rem;
    font-size: .75rem;
    color: #6b7280;
}

.form-error {
    margin-top: .45rem;
    font-size: .75rem;
    color: #fca5a5;
}

.form-check {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    accent-color: var(--brand);
    cursor: pointer;
}

/* Мрежа за форми */
.form-grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 14. Активен навигационен линк ----------------------------------------- */
.nav-link.is-active {
    color: #fff;
}

.nav-link.is-active::after {
    width: 100%;
}

/* 15. Таблици ----------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table thead th {
    padding: .85rem 1rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #6b7280;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table tbody td {
    padding: .95rem 1rem;
    border-bottom: 1px solid rgba(35, 39, 47, .6);
    color: #c9ced8;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background-color .2s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, .025);
}

/* 16. Бадж -------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    border: 1px solid;
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

/* 17. Потребителски панел ------------------------------------------------ */
.panel-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .65rem .85rem;
    font-family: 'Chakra Petch', system-ui, sans-serif;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #8b93a1;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
    border-left: 2px solid transparent;
}

.panel-link i {
    font-size: 1rem;
    color: #4b5261;
    transition: color .2s ease;
}

.panel-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .035);
}

.panel-link:hover i {
    color: var(--brand);
}

.panel-link.is-active {
    color: #fff;
    background: var(--brand-soft);
    border-left-color: var(--brand);
}

.panel-link.is-active i {
    color: var(--brand);
}

/* 18. Избор на бууст ------------------------------------------------------ */
.boost-option:hover {
    border-color: var(--brand-line);
    background: rgba(255, 122, 24, .05);
}

.boost-option:has(input:checked) {
    border-color: var(--brand);
    background: rgba(255, 122, 24, .1);
    box-shadow: 0 0 0 1px rgba(255, 122, 24, .3);
}

/* Резерва за браузъри без :has() – акцентът остава при hover */
@supports not selector(:has(*)) {
    .boost-option input:checked {
        outline: 2px solid var(--brand);
        outline-offset: 2px;
    }
}

/* 19. Админ действия ------------------------------------------------------ */
.admin-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: #6b7280;
    border: 1px solid transparent;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

.admin-action:hover {
    color: var(--brand);
    border-color: var(--brand-line);
    background: var(--brand-soft);
}

.admin-action.is-danger:hover {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, .4);
    background: rgba(239, 68, 68, .1);
}
