/* Unified Dex UI — Pokedex, Movedex, Abilitydex, Itemdex */

.dex-shell {
    padding: 7.5rem 0 4rem;
    min-height: 100vh;
}

.dex-header {
    position: static;
    width: auto;
    z-index: auto;
    padding: 0;
    margin-bottom: 2rem;
}

.dex-header h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    text-transform: none;
    color: #fff;
    margin-bottom: 0.5rem;
}

.dex-header h1 em {
    font-style: normal;
    color: var(--primary-red);
}

.dex-header p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 56ch;
    line-height: 1.65;
}

.dex-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.dex-nav-link {
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.55);
    transition: var(--transition);
}

.dex-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.dex-nav-link.active {
    color: #fff;
    background: var(--primary-red);
    box-shadow: 0 4px 16px rgba(255, 62, 62, 0.35);
}

.dex-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    backdrop-filter: blur(12px);
}

.dex-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.dex-search {
    flex: 1;
    min-width: 200px;
    padding: 0.85rem 1.15rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.dex-search:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(255, 62, 62, 0.15);
}

.dex-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.dex-label {
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

.dex-select {
    padding: 0.55rem 2rem 0.55rem 0.85rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ffffff55' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
}

.dex-select option {
    background: #14141c;
    color: #fff;
}

.dex-check {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.dex-check input {
    accent-color: var(--primary-red);
    width: 14px;
    height: 14px;
}

.dex-results-meta {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 1rem;
    letter-spacing: 0.04em;
}

.dex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.dex-grid.compact {
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

.dex-group-header {
    grid-column: 1 / -1;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary-red);
    padding: 0.75rem 0 0.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.5rem;
}

.dex-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 1.35rem;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dex-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 62, 62, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.dex-card.compact {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
}

.dex-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.dex-card-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
}

.dex-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.dex-card-sprite-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 96px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    border-radius: 16px;
}

.dex-sprite {
    width: 88px;
    height: 88px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

.dex-sprite-mini {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.dex-type-row {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.dex-type-icon {
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.dex-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 0.5rem;
}

.dex-meta-cell {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    text-align: center;
}

.dex-meta-cell strong {
    display: block;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.15rem;
}

.dex-meta-cell span {
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
}

.dex-desc {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.72);
}

.dex-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dex-badge {
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dex-badge.champ {
    background: linear-gradient(90deg, rgba(255, 100, 100, 0.25), rgba(255, 180, 100, 0.2));
    border-color: rgba(255, 150, 80, 0.35);
    color: #ffd0a0;
}

.dex-dmg-badge {
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dex-dmg-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dex-dmg-icon {
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
    flex-shrink: 0;
}

.dex-card-type-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.dex-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dex-dmg-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.25rem;
    padding: 0.35rem 0.65rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dex-dmg-legend__text {
    font-size: 0.62rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.55);
    margin-right: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dex-detail-category-row {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.dex-dmg-physical { background: rgba(238, 129, 48, 0.2); color: #f5b87a; border: 1px solid rgba(238, 129, 48, 0.35); }
.dex-dmg-special  { background: rgba(99, 144, 240, 0.2); color: #9eb8f8; border: 1px solid rgba(99, 144, 240, 0.35); }
.dex-dmg-status   { background: rgba(180, 180, 180, 0.14); color: #ccc; border: 1px solid rgba(180, 180, 180, 0.28); }

.dex-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.dex-tag-chip {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(106, 176, 245, 0.12);
    border: 1px solid rgba(106, 176, 245, 0.25);
    color: #9ec8f0;
    letter-spacing: 0.03em;
}

.dex-sprite-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.dex-sprite-cell {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dex-sprite-more {
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    padding: 0 0.5rem;
}

.dex-stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
}

.dex-stat-label {
    width: 28px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.45);
}

.dex-stat-bar {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.dex-stat-fill {
    height: 100%;
    border-radius: 3px;
}

.dex-stat-val {
    width: 26px;
    text-align: right;
    font-weight: 800;
    color: #fff;
}

.dex-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dex-item-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.dex-empty {
    grid-column: 1 / -1;
    padding: 3rem 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.02);
}

.dex-sentinel {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
}

/* Detail modal extensions */
.dex-detail-modal .modal-content {
    max-width: 1060px;
    padding: 2rem;
}

.dex-detail-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(300px, 1.4fr);
    gap: 2rem;
}

.dex-detail-side {
    text-align: center;
}

.dex-detail-sprite-box {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 1.25rem;
}

.dex-detail-sprite-box .dex-sprite {
    width: 140px;
    height: 140px;
}

.dex-detail-name {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 0.35rem;
}

.dex-detail-section {
    margin-top: 1.5rem;
}

.dex-detail-section h3 {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.75rem;
}

.dex-move-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 420px;
    overflow-y: auto;
}

.dex-move-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    padding: 0.85rem 1rem;
}

.dex-move-item-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.dex-move-item-name {
    font-weight: 800;
    color: #fff;
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    .dex-shell { padding-top: 6.5rem; }
    .dex-detail-grid { grid-template-columns: 1fr; }
    .dex-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

@media (max-width: 640px) {
    .dex-toolbar { padding: 1rem; }
    .dex-filters-row { flex-direction: column; align-items: stretch; }
    .dex-select { width: 100%; }
    .dex-grid { grid-template-columns: 1fr; }
    .dex-card.compact { flex-direction: column; align-items: flex-start; }
}
