/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS v3.0 - Header, Navigation, Buttons, Cards, Modal, Toast
   ENFORCER MINI APP 🔫
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   HEADER - Profile access on left, stats on right
   ═══════════════════════════════════════════════════════════════════ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 100;
}

/* Left side - Avatar + Name (clickable to profile) */
.h-left {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px;
    margin: -6px;
    border-radius: var(--radius-lg);
    transition: background 0.2s var(--ease);
}

.h-left:active {
    background: var(--bg-card);
}

.h-avatar {
    width: 38px;
    height: 38px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid var(--border);
    transition: border-color 0.2s;
    overflow: hidden;
}

.h-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.h-avatar-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.h-left:active .h-avatar {
    border-color: var(--accent);
}

.h-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.h-name {
    font-weight: 700;
    font-size: 14px;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-name.vip-name {
    background: linear-gradient(90deg, #ffd700, #ffec4d, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.h-level {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}

/* Right side - Streak + Seeds */
.h-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.h-streak {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    padding: 6px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border: 1px solid var(--border);
}

.h-streak:active {
    transform: scale(0.95);
}

.h-streak.hot {
    background: var(--gradient-fire);
    border-color: transparent;
    color: white;
    animation: glow 2s ease-in-out infinite;
    --accent-glow: rgba(239, 68, 68, 0.4);
}

.h-cash {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border: 1px solid var(--border);
}

.h-cash:active {
    transform: scale(0.95);
    border-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════
   NAVIGATION - 4 tabs at bottom
   ═══════════════════════════════════════════════════════════════════ */

.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    position: relative;
}

.nav-icon {
    font-size: 24px;
    transition: transform 0.2s var(--bounce);
}

.nav-label {
    font-size: 10px;
    transition: color 0.2s;
}

.nav-btn.active {
    color: var(--accent);
}

.nav-btn.active .nav-icon {
    transform: scale(1.15);
}

.nav-btn:active {
    transform: scale(0.9);
}

/* Nav indicator dot */
.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════ */

.main {
    padding: calc(var(--header-h) + 12px) 14px 20px;
    max-width: 480px;
    margin: 0 auto;
    min-height: calc(100vh - var(--nav-h));
    min-height: calc(100dvh - var(--nav-h));
}

.page {
    display: none;
    animation: fadeIn 0.25s var(--ease);
}

.page.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════ */

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    flex: 1;
    min-width: fit-content;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.tab:active {
    transform: scale(0.96);
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* ═══════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s var(--ease);
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:active {
    transform: scale(0.98);
    border-color: var(--accent);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Button variants */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.btn-primary:active {
    background: var(--accent-dim);
}

.btn-gold {
    background: var(--gradient-gold);
    border-color: var(--gold);
    color: var(--bg);
}

.btn-danger {
    background: var(--negative);
    border-color: var(--negative);
    color: white;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
}

.btn-ghost:active {
    background: var(--accent-bg);
}

/* Button sizes */
.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
}

.btn-lg {
    padding: 16px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* Action button (full width with icon) */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.action-btn:active {
    transform: scale(0.98);
    border-color: var(--accent);
}

.action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* ═══════════════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════════════ */

.input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s var(--ease);
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
}

.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Number input with +/- buttons */
.input-number-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-number {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
}

.input-adj {
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.input-adj:active {
    transform: scale(0.9);
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

/* Game Modal (RPG) */
#game-modal {
    display: none;
    background: rgba(0, 0, 0, 0.9);
}

#game-modal.show {
    display: flex;
}

#game-modal .modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalPop 0.25s var(--ease);
}

#game-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#game-modal .modal-header h2 {
    font-size: 18px;
    margin: 0;
}

#game-modal .modal-close {
    position: static;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: none;
    border-radius: 50%;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
}

.modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    animation: fadeInBg 0.2s var(--ease);
}

.modal-box {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 100%;
    max-width: 340px;
    max-height: 85vh;
    overflow-y: auto;
    text-align: center;
    animation: modalPop 0.25s var(--ease);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: none;
    border-radius: 50%;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}

.modal-sub {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 14px;
    z-index: 300;
    animation: toastSlide 0.3s var(--ease);
    max-width: calc(100% - 40px);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.toast.hidden {
    display: none;
}

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

.toast.error {
    border-color: var(--negative);
    color: var(--negative);
}

.toast.warning {
    border-color: var(--warning);
    color: var(--warning);
}

/* ═══════════════════════════════════════════════════════════════════
   PLAYER MODAL
   ═══════════════════════════════════════════════════════════════════ */

.pm-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    text-align: left;
}

.pm-avatar {
    position: relative;
    width: 56px;
    height: 56px;
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.pm-level {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--accent);
    color: var(--bg);
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    min-width: 20px;
}

.pm-info {
    flex: 1;
    min-width: 0;
}

.pm-name {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-user {
    font-size: 12px;
    color: var(--text-dim);
}

.pm-title {
    font-size: 11px;
    margin-top: 2px;
}

.pm-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.pm-stat {
    text-align: center;
}

.pm-stat span:first-child {
    display: block;
    font-size: 18px;
    font-weight: 800;
}

.pm-stat span:last-child {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}

.pm-extra {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    text-align: left;
}

.pm-extra-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

.pm-extra-item span:first-child {
    font-size: 14px;
}

.pm-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.pm-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.pm-btn:active {
    transform: scale(0.92);
}

.pm-btn.pos {
    background: var(--positive);
    color: white;
}

.pm-btn.neg {
    background: var(--negative);
    color: white;
}

.pm-btn.fun {
    background: var(--bg-elevated);
    color: var(--text);
}

.pm-btn.duel {
    background: var(--gradient-gold);
    color: var(--bg);
}

/* ═══════════════════════════════════════════════════════════════════
   SCROLL CONTAINER (horizontal scroll)
   ═══════════════════════════════════════════════════════════════════ */

.scroll-x {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   LIST ITEMS
   ═══════════════════════════════════════════════════════════════════ */

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.list-item:active {
    transform: scale(0.98);
    border-color: var(--accent);
}

.list-item:last-child {
    margin-bottom: 0;
}

.list-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.list-info {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-size: 14px;
    font-weight: 600;
}

.list-sub {
    font-size: 12px;
    color: var(--text-dim);
}

.list-value {
    font-size: 14px;
    font-weight: 700;
    text-align: right;
}

.list-arrow {
    color: var(--text-dim);
    font-size: 18px;
}

/* ═══════════════════════════════════════════════════════════════════
   STAT GRID
   ═══════════════════════════════════════════════════════════════════ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stat-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.stat-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
}
