/**
 * Game Flavor CSS - Ragnarok Frontier
 * Job class badges, stat grids, map names, and other game-specific styling.
 */

/* ==================== Job Class Badges ==================== */

.job-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

/* Swordsman family: warm red */
.job-swordsman {
    background: #fef2f2;
    color: #b91c1c;
}

/* Mage family: blue */
.job-mage {
    background: #eff6ff;
    color: #1d4ed8;
}

/* Archer family: green */
.job-archer {
    background: #f0fdf4;
    color: #15803d;
}

/* Acolyte family: yellow/gold */
.job-acolyte {
    background: #fefce8;
    color: #a16207;
}

/* Merchant family: brown/amber */
.job-merchant {
    background: #fef3c7;
    color: #92400e;
}

/* Thief family: purple */
.job-thief {
    background: #faf5ff;
    color: #7e22ce;
}

/* Special classes */
.job-novice {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

.job-taekwon {
    background: #fdf4ff;
    color: #a21caf;
}

.job-gunslinger {
    background: #f5f5f4;
    color: #57534e;
}

.job-ninja {
    background: #0f172a;
    color: #e2e8f0;
}

/* Dark theme adjustments */
[data-theme="dark"] .job-swordsman {
    background: rgba(185, 28, 28, 0.15);
    color: #fca5a5;
}

[data-theme="dark"] .job-mage {
    background: rgba(29, 78, 216, 0.15);
    color: #93c5fd;
}

[data-theme="dark"] .job-archer {
    background: rgba(21, 128, 61, 0.15);
    color: #86efac;
}

[data-theme="dark"] .job-acolyte {
    background: rgba(161, 98, 7, 0.15);
    color: #fde68a;
}

[data-theme="dark"] .job-merchant {
    background: rgba(146, 64, 14, 0.15);
    color: #fcd34d;
}

[data-theme="dark"] .job-thief {
    background: rgba(126, 34, 206, 0.15);
    color: #d8b4fe;
}

[data-theme="dark"] .job-novice {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

[data-theme="dark"] .job-taekwon {
    background: rgba(162, 28, 175, 0.15);
    color: #f0abfc;
}

[data-theme="dark"] .job-gunslinger {
    background: rgba(87, 83, 78, 0.15);
    color: #d6d3d1;
}

[data-theme="dark"] .job-ninja {
    background: rgba(15, 23, 42, 0.4);
    color: #94a3b8;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .job-swordsman {
        background: rgba(185, 28, 28, 0.15);
        color: #fca5a5;
    }
    :root:not([data-theme="light"]) .job-mage {
        background: rgba(29, 78, 216, 0.15);
        color: #93c5fd;
    }
    :root:not([data-theme="light"]) .job-archer {
        background: rgba(21, 128, 61, 0.15);
        color: #86efac;
    }
    :root:not([data-theme="light"]) .job-acolyte {
        background: rgba(161, 98, 7, 0.15);
        color: #fde68a;
    }
    :root:not([data-theme="light"]) .job-merchant {
        background: rgba(146, 64, 14, 0.15);
        color: #fcd34d;
    }
    :root:not([data-theme="light"]) .job-thief {
        background: rgba(126, 34, 206, 0.15);
        color: #d8b4fe;
    }
    :root:not([data-theme="light"]) .job-novice {
        background: rgba(255, 255, 255, 0.06);
        color: var(--text-secondary);
    }
    :root:not([data-theme="light"]) .job-taekwon {
        background: rgba(162, 28, 175, 0.15);
        color: #f0abfc;
    }
    :root:not([data-theme="light"]) .job-gunslinger {
        background: rgba(87, 83, 78, 0.15);
        color: #d6d3d1;
    }
    :root:not([data-theme="light"]) .job-ninja {
        background: rgba(15, 23, 42, 0.4);
        color: #94a3b8;
    }
}

/* ==================== Item Type Badges ==================== */

.item-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.item-type-weapon { background: #fef2f2; color: #b91c1c; }
.item-type-armor { background: #eff6ff; color: #1d4ed8; }
.item-type-consumable, .item-type-heal { background: #f0fdf4; color: #15803d; }
.item-type-card { background: #faf5ff; color: #7e22ce; }
.item-type-usable { background: #fefce8; color: #a16207; }
.item-type-special { background: #fdf4ff; color: #a21caf; }
.item-type-etc, .item-type-ammo, .item-type-pet_egg, .item-type-pet_equip {
    background: var(--bg-muted); color: var(--text-secondary);
}

[data-theme="dark"] .item-type-weapon { background: rgba(185, 28, 28, 0.15); color: #fca5a5; }
[data-theme="dark"] .item-type-armor { background: rgba(29, 78, 216, 0.15); color: #93c5fd; }
[data-theme="dark"] .item-type-consumable, [data-theme="dark"] .item-type-heal { background: rgba(21, 128, 61, 0.15); color: #86efac; }
[data-theme="dark"] .item-type-card { background: rgba(126, 34, 206, 0.15); color: #d8b4fe; }
[data-theme="dark"] .item-type-usable { background: rgba(161, 98, 7, 0.15); color: #fde68a; }
[data-theme="dark"] .item-type-special { background: rgba(162, 28, 175, 0.15); color: #f0abfc; }
[data-theme="dark"] .item-type-etc, [data-theme="dark"] .item-type-ammo,
[data-theme="dark"] .item-type-pet_egg, [data-theme="dark"] .item-type-pet_equip {
    background: rgba(255, 255, 255, 0.06); color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .item-type-weapon { background: rgba(185, 28, 28, 0.15); color: #fca5a5; }
    :root:not([data-theme="light"]) .item-type-armor { background: rgba(29, 78, 216, 0.15); color: #93c5fd; }
    :root:not([data-theme="light"]) .item-type-consumable, :root:not([data-theme="light"]) .item-type-heal { background: rgba(21, 128, 61, 0.15); color: #86efac; }
    :root:not([data-theme="light"]) .item-type-card { background: rgba(126, 34, 206, 0.15); color: #d8b4fe; }
    :root:not([data-theme="light"]) .item-type-usable { background: rgba(161, 98, 7, 0.15); color: #fde68a; }
    :root:not([data-theme="light"]) .item-type-special { background: rgba(162, 28, 175, 0.15); color: #f0abfc; }
    :root:not([data-theme="light"]) .item-type-etc, :root:not([data-theme="light"]) .item-type-ammo,
    :root:not([data-theme="light"]) .item-type-pet_egg, :root:not([data-theme="light"]) .item-type-pet_equip {
        background: rgba(255, 255, 255, 0.06); color: var(--text-secondary);
    }
}

/* ==================== Stat Grid ==================== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 8px 0;
}

.stat-cell {
    background: var(--bg-muted);
    border-radius: var(--radius);
    padding: 8px 10px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* ==================== Map Name ==================== */

.map-name {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-muted);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ==================== Level Display ==================== */

.level-display {
    color: var(--primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.level-separator {
    color: var(--text-muted);
    font-weight: 400;
    margin: 0 2px;
}

/* ==================== Character Detail Page ==================== */

.char-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) 0 var(--space-4);
    flex-wrap: wrap;
}

.char-detail-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
}

.char-sprite-container {
    flex-shrink: 0;
    width: 56px;
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: visible;
}

.char-sprite-container img {
    image-rendering: pixelated;
    max-width: 56px;
    height: auto;
}

.char-detail-identity {
    min-width: 0;
}

.char-detail-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.char-detail-name {
    font-size: 24px;
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-detail-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-1);
}

.char-detail-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 20px;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    background: none;
}

.char-detail-back-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    text-decoration: none;
}

.char-detail-gid {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-muted);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.char-detail-level {
    font-size: 14px;
    color: var(--text-secondary);
}

.char-detail-zeny {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.char-detail-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Info grid — 2-column key/value grid below the character header */
.char-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    overflow: hidden;
}

.char-info-grid .info-item {
    background: var(--bg-surface);
    padding: var(--space-3) var(--space-4);
}

.char-info-grid .info-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
}

.char-info-grid .info-value {
    font-size: 14px;
    color: var(--text-primary);
}

/* Compact card body for overview tab */
.card-body-compact {
    padding: var(--space-4);
}

/* Character detail sub-tabs — pinned in panel header */
.char-detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 0 var(--space-6);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.char-detail-tabs::-webkit-scrollbar { display: none; }

.char-tab {
    padding: var(--space-3) var(--space-3);
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 13px;
    min-height: 44px;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.char-tab:hover {
    color: var(--text-primary);
}

.char-tab.active {
    color: var(--text-primary);
    font-weight: 500;
    border-bottom-color: var(--primary);
}

.char-tab-content {
    display: none;
}

.char-tab-content.active {
    display: block;
}

/* Panel header row: sprite + identity */
.char-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.char-panel-header img {
    image-rendering: pixelated;
    height: 64px;
    width: auto;
    flex-shrink: 0;
}

.char-panel-identity {
    min-width: 0;
}

.char-panel-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 2px;
}

.char-panel-name {
    font-size: 16px;
    font-weight: 600;
}

.char-panel-meta {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
}

/* Panel info grid (2x2 in slide-out) */
.char-panel-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.char-panel-info-cell {
    background: var(--bg-surface);
    padding: var(--space-2) var(--space-3);
}

/* Panel admin actions row */
.char-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

/* Panel section header row */
.char-panel-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.char-panel-section-spacer {
    margin-top: var(--space-3);
}

/* HP/SP progress bars */
.char-progress-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.char-progress-bar {
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    height: 18px;
    overflow: hidden;
    position: relative;
}

.char-progress-fill {
    height: 100%;
    transition: width 0.3s;
}

.char-progress-fill-hp { background: var(--error); }
.char-progress-fill-sp { background: var(--info); }

.char-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Overview stat pairs (EXP, points) */
.char-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.char-overview-value {
    font-size: 14px;
}

.char-overview-value.has-points {
    color: var(--primary);
    font-weight: 600;
}

/* Skill points label in panel */
.char-skill-points-label {
    font-size: 12px;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .char-detail-header {
        flex-direction: column;
        align-items: stretch;
    }

    .char-detail-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .char-info-grid {
        grid-template-columns: 1fr;
    }
}
