/* ==========================================================
   GENSHIN MARKET — dark purple theme
   ========================================================== */

:root {
    --bg: #0e0b16;
    --bg-soft: #14101f;
    --surface: #1a1526;
    --surface-2: #211a32;
    --border: #2c2440;
    --text: #e9e6f5;
    --text-dim: #a49bc4;
    --text-faint: #786f96;
    --primary: #8b5cf6;
    --primary-dark: #6d3ff0;
    --primary-light: #a78bfa;
    --accent: #4f46e5;
    --success: #34d399;
    --danger: #f87171;
    --role-helper: #fbbf24; /* yellow nick — хелпер */
    --role-admin: #f87171;  /* red (readable) nick — админ */
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --max-width: 1180px;

    /* Elemental accent palette (decorative only — original, not game assets) */
    --pyro: #ff6b4a;
    --hydro: #4fc3f7;
    --electro: #c084fc;
    --cryo: #7dd3fc;
    --anemo: #5eead4;
    --geo: #fbbf24;
    --dendro: #86efac;

    --vh: 1vh;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at top, #1b1330 0%, var(--bg) 55%);
    color: var(--text);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* ---------- AMBIENT BACKGROUND DECORATION ---------- */
/* Purely decorative, original CSS shapes — no external artwork. */

.bg-decor {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-decor .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.28;
    animation: drift 22s ease-in-out infinite;
}

.orb-pyro { width: 320px; height: 320px; background: var(--pyro); top: -80px; left: -60px; animation-delay: 0s; }
.orb-hydro { width: 280px; height: 280px; background: var(--hydro); top: 30%; right: -100px; animation-delay: -6s; }
.orb-electro { width: 260px; height: 260px; background: var(--electro); bottom: -80px; left: 15%; animation-delay: -12s; }
.orb-dendro { width: 220px; height: 220px; background: var(--dendro); bottom: 10%; right: 10%; animation-delay: -18s; opacity: 0.18; }

@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -25px) scale(1.08); }
}

.bg-decor .sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-light);
    border-radius: 50%;
    box-shadow: 0 0 8px 2px rgba(167, 139, 250, 0.8);
    animation: twinkle 3.5s ease-in-out infinite;
}

.s1 { top: 12%; left: 20%; animation-delay: 0s; }
.s2 { top: 22%; left: 78%; animation-delay: 0.6s; }
.s3 { top: 55%; left: 45%; animation-delay: 1.2s; }
.s4 { top: 70%; left: 85%; animation-delay: 1.8s; }
.s5 { top: 40%; left: 8%; animation-delay: 2.4s; }

@keyframes twinkle {
    0%, 100% { opacity: 0; transform: scale(0.6); }
    50% { opacity: 1; transform: scale(1.4); }
}

.site-header, .page, .site-footer { position: relative; z-index: 1; }

@media (max-width: 600px) {
    .bg-decor .orb { filter: blur(50px); opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
    .bg-decor .orb, .bg-decor .sparkle { animation: none; }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- HEADER ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(14, 11, 22, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.logo-badge {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.55);
}

.logo-text span { color: var(--primary-light); }

.header-search {
    flex: 1;
    display: flex;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.header-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    padding: 10px 16px;
    font-size: 14px;
}

.header-search button {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.nav-link {
    font-size: 14px;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-link:hover { color: var(--text); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    white-space: nowrap;
}

.avatar-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    line-height: 1.5;
}

.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
}

.burger span {
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 10px 20px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-search {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.mobile-search input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
}

.mobile-search button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 16px;
    cursor: pointer;
}

/* ---------- BUTTONS ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 999px;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--primary); }

.btn-danger {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

.btn-small { padding: 8px 16px; font-size: 13px; }
.btn-large { padding: 14px 28px; font-size: 15px; width: 100%; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- PAGE / HERO ---------- */

.page { padding: 28px 20px 60px; min-height: 60vh; }

.hero {
    text-align: center;
    padding: 30px 0 10px;
}

.hero-elements {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.elem-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-dot 2.6s ease-in-out infinite;
}

.elem-dot.pyro { background: var(--pyro); box-shadow: 0 0 8px var(--pyro); }
.elem-dot.hydro { background: var(--hydro); box-shadow: 0 0 8px var(--hydro); animation-delay: 0.2s; }
.elem-dot.electro { background: var(--electro); box-shadow: 0 0 8px var(--electro); animation-delay: 0.4s; }
.elem-dot.cryo { background: var(--cryo); box-shadow: 0 0 8px var(--cryo); animation-delay: 0.6s; }
.elem-dot.anemo { background: var(--anemo); box-shadow: 0 0 8px var(--anemo); animation-delay: 0.8s; }
.elem-dot.geo { background: var(--geo); box-shadow: 0 0 8px var(--geo); animation-delay: 1s; }
.elem-dot.dendro { background: var(--dendro); box-shadow: 0 0 8px var(--dendro); animation-delay: 1.2s; }

@keyframes pulse-dot {
    0%, 100% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.15); }
}

.hero h1 {
    font-size: clamp(24px, 4vw, 36px);
    margin: 0 0 10px;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p { color: var(--text-dim); margin: 0; }

.page-title { font-size: 24px; margin: 0 0 20px; }

/* ---------- CATEGORY TABS (каталог: все / аккаунты / услуги) ---------- */

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.category-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

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

.category-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
}

.category-tab.type-service.active {
    background: linear-gradient(135deg, var(--success), #10b981);
}

.tab-count {
    background: rgba(255, 255, 255, 0.12);
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
}

.category-tab:not(.active) .tab-count { background: var(--surface-2); color: var(--text-faint); }

/* ---------- TYPE BADGE (аккаунт / услуга) ---------- */

.type-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-light);
    border: 1px solid rgba(139, 92, 246, 0.35);
}

.type-badge.service {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.35);
}

.type-badge-large { font-size: 11px; padding: 4px 12px; margin-bottom: 10px; }

/* Type badge positioned over the product image on catalog cards. */
.product-image .type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(20, 16, 31, 0.85);
}

.product-image .type-badge.service { background: rgba(20, 16, 31, 0.85); }

/* Generic (non-elemental) accent for services, since the elemental dots
   are a Genshin-account-specific touch and don't fit a cleaning service. */
.product-card.elem-service { border-top-color: var(--success); }
.product-card.elem-service:hover { box-shadow: 0 10px 30px -10px var(--success); }

.search-status {
    color: var(--text-dim);
    margin: 20px 0;
    font-size: 14px;
}

.clear-search { color: var(--primary-light); margin-left: 10px; }

.empty-state {
    text-align: center;
    color: var(--text-faint);
    padding: 60px 20px;
}

/* ---------- FLASH MESSAGES ---------- */

.flash-wrap { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    border: 1px solid var(--border);
}

.flash-error { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); color: #fca5a5; }
.flash-success { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); color: #6ee7b7; }

/* ---------- PRODUCT GRID ---------- */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.product-card.elem-pyro { border-top-color: var(--pyro); }
.product-card.elem-hydro { border-top-color: var(--hydro); }
.product-card.elem-electro { border-top-color: var(--electro); }
.product-card.elem-cryo { border-top-color: var(--cryo); }
.product-card.elem-anemo { border-top-color: var(--anemo); }
.product-card.elem-geo { border-top-color: var(--geo); }
.product-card.elem-dendro { border-top-color: var(--dendro); }

.product-card.elem-pyro:hover { box-shadow: 0 10px 30px -10px var(--pyro); }
.product-card.elem-hydro:hover { box-shadow: 0 10px 30px -10px var(--hydro); }
.product-card.elem-electro:hover { box-shadow: 0 10px 30px -10px var(--electro); }
.product-card.elem-cryo:hover { box-shadow: 0 10px 30px -10px var(--cryo); }
.product-card.elem-anemo:hover { box-shadow: 0 10px 30px -10px var(--anemo); }
.product-card.elem-geo:hover { box-shadow: 0 10px 30px -10px var(--geo); }
.product-card.elem-dendro:hover { box-shadow: 0 10px 30px -10px var(--dendro); }

.product-image {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--surface-2);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-faint);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #211a32, #14101f);
}

.no-image svg { color: var(--primary-light); opacity: 0.7; }
.no-image.large { aspect-ratio: 4/3; border-radius: var(--radius); font-size: 14px; }

.stock-flag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(20, 16, 31, 0.85);
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.stock-flag.out { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }

.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.product-title { font-size: 15px; margin: 0; line-height: 1.35; }
.product-title a:hover { color: var(--primary-light); }

.product-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin: 0;
    flex: 1;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.price { font-weight: 700; font-size: 16px; color: var(--primary-light); }

/* ---------- PRODUCT DETAIL ---------- */

.breadcrumbs { color: var(--text-faint); font-size: 13px; margin-bottom: 16px; }
.breadcrumbs a { color: var(--text-dim); }

.product-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.product-detail-image img,
.product-detail-image .no-image {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
}

.product-detail-info h1 { margin: 0 0 12px; font-size: 26px; }

.product-detail-desc {
    color: var(--text-dim);
    line-height: 1.6;
    white-space: pre-line;
}

.product-detail-meta {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin: 18px 0;
}

.meta-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.meta-label { color: var(--text-faint); }
.price-large { font-size: 20px; font-weight: 700; color: var(--primary-light); }
.in-stock { color: var(--success); }
.out-stock { color: var(--danger); }
.funpay-note { color: var(--text-faint); font-size: 12px; margin-top: 14px; }

/* ---------- AUTH ---------- */

.auth-wrap { display: flex; justify-content: center; padding: 30px 0; }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

input, textarea, select {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    width: 100%;
}

input:focus, textarea:focus, select:focus { border-color: var(--primary); }

.auth-switch { text-align: center; font-size: 13px; color: var(--text-faint); }
.auth-switch a { color: var(--primary-light); }

/* ---------- PROFILE ---------- */

.profile-card {
    max-width: 420px;
    margin: 30px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.avatar-large {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-card h1 { margin: 0; font-size: 20px; }
.profile-meta { color: var(--text-faint); font-size: 13px; margin: 0 0 10px; }
.profile-id { font-family: monospace; letter-spacing: 0.3px; }

/* ---------- USERS SEARCH / LIST ---------- */

.inline-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 480px;
}

.inline-search input { flex: 1; }

.user-list, .conversation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row, .conversation-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: border-color 0.15s ease;
}

.user-row:hover, .conversation-row:hover { border-color: var(--primary); }

.user-row-name { flex: 1; font-size: 14px; }
.user-row-id { color: var(--text-faint); font-size: 12px; font-family: monospace; }
.user-row-action { color: var(--text-faint); font-size: 13px; }

.conversation-row.unread { border-color: var(--primary); }
.conversation-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conversation-name { font-size: 14px; font-weight: 600; }
.conversation-preview {
    font-size: 13px;
    color: var(--text-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conversation-time { font-size: 11px; color: var(--text-faint); }

.messages-toolbar { margin-bottom: 16px; }

/* ---------- CHAT ---------- */

.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
    height: calc((var(--vh, 1vh) * 100) - 220px);
    min-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.back-link { color: var(--text-dim); font-size: 14px; }
.chat-header-user { display: flex; align-items: center; gap: 10px; font-weight: 600; flex: 1; min-width: 0; }
.chat-header-user-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chat-header-name { line-height: 1.2; }
.chat-header-status { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.chat-header-status.online { color: #4ade80; }
.chat-header-actions { margin-left: auto; }

.block-banner {
    margin: 0 18px;
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fca5a5;
    font-size: 13px;
    text-align: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-bubble {
    position: relative;
    max-width: 72%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 14px;
    align-self: flex-start;
    font-size: 14px;
}

.bubble-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-faint);
    font-size: 13px;
    padding: 0;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chat-bubble:hover .bubble-delete,
.bubble-delete:active { opacity: 1; }
.bubble-delete:hover { color: #fca5a5; border-color: #fca5a5; }

.chat-bubble.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
}

.bubble-author { font-size: 11px; font-weight: 700; color: var(--primary-light); margin-bottom: 2px; }
.chat-bubble.mine .bubble-author { color: rgba(255,255,255,0.85); }
.bubble-author-link { color: inherit; text-decoration: none; }
.bubble-author-link:hover { text-decoration: underline; }
.bubble-body { word-wrap: break-word; white-space: pre-wrap; }
.bubble-time { font-size: 10px; color: var(--text-faint); margin-top: 4px; text-align: right; }
.chat-bubble.mine .bubble-time { color: rgba(255,255,255,0.7); }
.bubble-id { font-weight: 400; color: var(--text-faint); }

/* Role colors — used for chat nicknames and profile/user-list badges.
   Role 1 = helper (yellow), role 2 = admin (red, still readable). */
.bubble-author.role-1, .chat-bubble.mine .bubble-author.role-1 { color: var(--role-helper); }
.bubble-author.role-2, .chat-bubble.mine .bubble-author.role-2 { color: var(--role-admin); }

.chat-system {
    align-self: center;
    max-width: 90%;
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 999px;
    padding: 6px 16px;
}

.mute-banner {
    margin: 0 18px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fca5a5;
    font-size: 13px;
}

.role-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid currentColor;
}
.role-badge.role-1 { color: var(--role-helper); }
.role-badge.role-2 { color: var(--role-admin); }

.role-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.role-form label { font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 4px; }
.role-form select { padding: 8px 10px; }

.chat-input-row {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.chat-input-row input {
    flex: 1;
    border-radius: 999px;
    padding: 12px 18px;
}

.chat-input-row button { border-radius: 999px; }

/* ---------- ADMIN ---------- */

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.admin-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.admin-stat:hover { border-color: var(--primary); transform: translateY(-2px); }
.admin-stat.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.admin-stat.type-service.active { border-color: var(--success); box-shadow: 0 0 0 1px var(--success) inset; }

.admin-stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.admin-stat-label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-stat.type-account .admin-stat-value { color: var(--primary-light); }
.admin-stat.type-service .admin-stat-value { color: var(--success); }

.admin-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
}

.admin-form-card, .admin-table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.admin-form-card h2, .admin-table-card h2 { margin: 0 0 16px; font-size: 16px; }

.admin-form-card form { display: flex; flex-direction: column; gap: 14px; }

.field-label { font-size: 13px; color: var(--text-dim); margin-bottom: -6px; }

.type-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.type-switch-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.type-switch-option input { accent-color: var(--primary); margin: 0; }

.type-switch-option:has(input:checked) {
    color: var(--text);
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.12);
}

.type-switch-option.service:has(input:checked) {
    border-color: var(--success);
    background: rgba(52, 211, 153, 0.12);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.admin-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.admin-table-head h2 { margin: 0; }

.admin-filter-tabs { display: flex; gap: 6px; }

.admin-filter-tab {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.admin-filter-tab:hover { color: var(--text); }
.admin-filter-tab.active { color: #fff; background: var(--primary); border-color: transparent; }

.admin-hint {
    font-size: 12px;
    color: var(--text-faint);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 0 0 16px;
    line-height: 1.5;
}

.funpay-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-faint);
    border: 1px solid var(--border);
}

.funpay-status.ok { color: var(--success); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.1); }
.funpay-status.missing { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.1); }
.funpay-status.error { color: var(--role-helper); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.1); }

.form-actions { display: flex; gap: 10px; }

.admin-current-image {
    width: 100%;
    max-width: 160px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.admin-table-wrap { overflow-x: auto; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.admin-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.admin-thumb.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    background: var(--surface-2);
}

.admin-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.admin-actions form { display: inline; }

/* ---------- ERROR PAGE ---------- */

.error-page {
    text-align: center;
    padding: 80px 20px;
}

.error-page h1 { font-size: 72px; margin: 0; color: var(--primary-light); }
.error-page p { color: var(--text-dim); margin: 10px 0 26px; }

/* ---------- FOOTER ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 22px 0;
    color: var(--text-faint);
    font-size: 12px;
    text-align: center;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 900px) {
    .product-detail { grid-template-columns: 1fr; }
    .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .header-search { display: none; }
    .header-nav { display: none; }
    .burger { display: flex; }
    .form-row { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 520px) {
    .admin-stats { grid-template-columns: 1fr; }
    .admin-table-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
    .container { padding: 0 14px; }
    .page { padding: 20px 14px 50px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .product-body { padding: 10px 12px 12px; }
    .hero h1 { font-size: 22px; }
    .auth-card { padding: 24px 18px; }
    .chat-page { height: calc(100vh - 180px); height: calc((var(--vh, 1vh) * 100) - 180px); border-radius: var(--radius-sm); }
    .chat-bubble { max-width: 88%; font-size: 13px; }
    .admin-table th:nth-child(1), .admin-table td:nth-child(1) { display: none; }
    .hero-elements { gap: 7px; }
    .elem-dot { width: 8px; height: 8px; }
    .product-detail-info h1 { font-size: 21px; }
    .profile-card { padding: 30px 18px; margin: 16px auto; }
    .avatar-large { width: 68px; height: 68px; font-size: 26px; }
    .chat-input-row { padding: 10px; gap: 8px; }
    .chat-input-row input { padding: 10px 14px; font-size: 14px; }
}

@media (max-width: 390px) {
    .logo-text { font-size: 14px; }
    .btn { padding: 10px 16px; font-size: 13px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
    .hero-elements { flex-wrap: wrap; }
}

/* Prevent iOS zoom-on-focus by keeping form fields at 16px+ */
@media (max-width: 600px) {
    input, textarea, select { font-size: 16px; }
}

/* ---------- CONFIRM MODAL ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.modal-message {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
