/* Items Page Styles */
.items-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin: 0;
}

.page-subtitle {
    color: var(--text-secondary, #888);
    margin-top: 0.5rem;
}

/* Controls */
.items-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 8px;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.subcategory-filters {
    width: 100%;
    display: flex;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, #333);
    margin-top: 0.5rem;
}

.subcat-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.subcat-btn {
    padding: 0.35rem 0.7rem;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #444);
    border-radius: 3px;
    color: var(--text-primary, #ddd);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.subcat-btn:hover {
    background: var(--bg-hover, #333);
    border-color: var(--accent, #4a9eff);
    color: #fff;
}

.subcat-btn.active {
    background: var(--accent, #4a9eff);
    border-color: var(--accent, #4a9eff);
    color: #fff;
}

.subcat-btn .count {
    opacity: 0.7;
    font-size: 0.65rem;
    margin-left: 0.2rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    color: var(--text-primary, #fff);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--bg-hover, #333);
}

.filter-btn.active {
    background: var(--accent, #4a9eff);
    border-color: var(--accent, #4a9eff);
}

.filter-btn .count {
    opacity: 0.6;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.view-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-input {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    color: var(--text-primary, #fff);
    width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent, #4a9eff);
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    padding: 0.5rem;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    color: var(--text-secondary, #888);
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover,
.view-btn.active {
    background: var(--accent, #4a9eff);
    color: #fff;
    border-color: var(--accent, #4a9eff);
}

/* Grid View */
.items-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.grid-view .item-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.grid-view .item-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent, #4a9eff);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.grid-view .item-icon {
    width: 100%;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #252525);
    padding: 0.5rem;
    position: relative;
}

.grid-view .item-icon img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.grid-view .item-info {
    padding: 0.5rem 0.6rem;
}

.grid-view .item-name {
    font-size: 0.8rem;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-view .item-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.65rem;
}

.grid-view .item-desc {
    font-size: 0.7rem;
    color: var(--text-secondary, #888);
    margin: 0.25rem 0 0 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List View */
.items-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.list-view .item-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.list-view .item-card:hover {
    background: var(--bg-tertiary, #252525);
    border-color: var(--accent, #4a9eff);
}

.list-view .item-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #252525);
    border-radius: 4px;
    padding: 2px;
    position: relative;
}

.list-view .item-icon .item-type {
    display: none;
}

.list-view .item-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.list-view .item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.list-view .item-name {
    font-size: 0.95rem;
    margin: 0;
}

.list-view .item-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.list-view .item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    margin: 0.25rem 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Rarity Colors */
.rarity-common { color: #9d9d9d; }
.rarity-uncommon { color: #1eff00; }
.rarity-rare { color: #0070dd; }
.rarity-epic { color: #a335ee; }
.rarity-legendary { color: #ff8000; }
.rarity-exotic { color: #e6cc80; }

.item-icon.rarity-common { border-bottom: 3px solid #9d9d9d; }
.item-icon.rarity-uncommon { border-bottom: 3px solid #1eff00; }
.item-icon.rarity-rare { border-bottom: 3px solid #0070dd; }
.item-icon.rarity-epic { border-bottom: 3px solid #a335ee; }
.item-icon.rarity-legendary { border-bottom: 3px solid #ff8000; }
.item-icon.rarity-exotic { border-bottom: 3px solid #e6cc80; }

.no-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #252525);
    border-radius: 4px;
    color: var(--text-secondary, #666);
    font-size: 1.5rem;
}

.item-type {
    color: var(--text-secondary, #888);
    text-transform: capitalize;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary, #121212);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary, #fff);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary, #1a1a1a);
    border-bottom: 3px solid var(--border-color, #333);
}

.modal-header.rarity-common { border-bottom-color: #9d9d9d; }
.modal-header.rarity-uncommon { border-bottom-color: #1eff00; }
.modal-header.rarity-rare { border-bottom-color: #0070dd; }
.modal-header.rarity-epic { border-bottom-color: #a335ee; }
.modal-header.rarity-legendary { border-bottom-color: #ff8000; }
.modal-header.rarity-exotic { border-bottom-color: #e6cc80; }

.modal-icon {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #252525);
    border-radius: 8px;
}

.modal-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-title h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.modal-details {
    padding: 1.5rem;
}

.modal-desc {
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.modal-flavor {
    font-style: italic;
    color: var(--text-secondary, #888);
    margin: 0 0 1rem 0;
}

.modal-stats {
    background: var(--bg-secondary, #1a1a1a);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-label {
    width: 70px;
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}

.stat-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary, #252525);
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #4a9eff), #67b8ff);
    border-radius: 4px;
    transition: width 0.3s;
}

.stat-value {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
}

.modal-source {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    margin: 0;
}

.modal-vendor {
    background: var(--bg-secondary, #1a1a1a);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 3px solid var(--accent, #4a9eff);
}

.modal-vendor p {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}

.modal-vendor p:last-child {
    margin-bottom: 0;
}

.modal-vendor .vendor-name {
    color: var(--accent, #4a9eff);
}

.modal-vendor .vendor-cost strong {
    color: #ffc864;
}

/* Responsive */
@media (max-width: 768px) {
    .items-page {
        padding: 1rem;
    }

    .items-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .category-filters {
        justify-content: center;
    }

    .view-controls {
        justify-content: center;
    }

    .search-input {
        width: 100%;
    }

    .items-container.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Weapon Info */
.weapon-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary, #1a1a1a);
    border-radius: 6px;
    font-size: 0.85rem;
}

.weapon-info span {
    color: var(--text-secondary, #888);
}

.weapon-info .weapon-class {
    color: var(--accent, #4a9eff);
    text-transform: capitalize;
    font-weight: 600;
}

/* Sort Select */
.sort-select {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary, #252525);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    color: var(--text-primary, #fff);
    cursor: pointer;
    font-size: 0.85rem;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent, #4a9eff);
}

/* Item Stats (inline) */
.item-stats {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.list-view .item-stats {
    margin: 0;
}

.item-stats .stat {
    font-size: 0.7rem;
    color: var(--text-secondary, #888);
    background: var(--bg-tertiary, #252525);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* List view weapon - all inline */
.list-view .item-card.is-weapon {
    display: flex;
}

.list-view .item-card.is-weapon .item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-view .item-card.is-weapon .item-title-row {
    display: contents;
    gap: 1rem;
}

.list-view .item-card.is-weapon .item-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 0;
}

.list-view .item-card.is-weapon .item-stats .stat {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    min-width: 60px;
    text-align: center;
}

/* Grid view stats */
.grid-view .item-stats {
    margin-top: 0.25rem;
}

.grid-view .item-stats .stat {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
}

/* Item Title Row - name + type inline */
.item-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.list-view .item-title-row .item-type-inline {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.grid-view .item-type-inline {
    display: none;
}

.grid-view .item-title-row {
    flex-direction: row;
    gap: 0.35rem;
    align-items: baseline;
}

.grid-view .item-icon .item-type {
    position: absolute;
    top: 0.3rem;
    left: 0.3rem;
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #ddd;
}

/* Better stat colors */
.item-stats .stat {
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.3);
    color: #ccc;
}

.item-stats .stat b {
    color: var(--accent, #4a9eff);
    font-weight: 600;
}

.item-stats .stat.dmg {
    background: rgba(255, 100, 100, 0.15);
    border-color: rgba(255, 100, 100, 0.3);
}

.item-stats .stat.dmg b {
    color: #ff6464;
}

.item-stats .stat.acc {
    background: rgba(100, 255, 150, 0.15);
    border-color: rgba(100, 255, 150, 0.3);
}

.item-stats .stat.acc b {
    color: #64ff96;
}

.item-stats .stat.rng {
    background: rgba(255, 200, 100, 0.15);
    border-color: rgba(255, 200, 100, 0.3);
}

.item-stats .stat.rng b {
    color: #ffc864;
}

.item-stats .stat.mag {
    background: rgba(180, 130, 255, 0.15);
    border-color: rgba(180, 130, 255, 0.3);
}

.item-stats .stat.mag b {
    color: #b482ff;
}
