/* 
 * ITEMS DATABASE - ULTRA PREMIUM STYLES 
 */

:root {
    --item-bg-dark: #0a0a0a;
    --item-card-light: #f5f3e7;
    /* Cream background from image */
    --item-border: rgba(255, 255, 255, 0.1);
    --gold: #fbc02d;

    /* Rarity Palettes */
    --c-common: #9e9e9e;
    --c-uncommon: #2ecc71;
    --c-rare: #3498db;
    --c-epic: #9b59b6;
    --c-legendary: #f39c12;
}

.items-db-wrapper {
    background: var(--item-bg-dark);
    min-height: 100vh;
    color: #fff;
    padding-bottom: 50px;
}

/* HERO & FILTER BAR */
.items-hero-section {
    padding: 60px 0 40px;
    background: radial-gradient(circle at 50% 0%, rgba(255, 107, 53, 0.1) 0%, transparent 70%);
}

.hero-title {
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -1px;
    margin-bottom: 10px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }
}

.hero-subtitle {
    color: var(--text-muted);
    text-align: center;
    max-width: 600px;
    margin: 0 auto 40px;
}

.premium-filter-bar {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid var(--item-border);
    padding: 8px;
    border-radius: 16px;
    gap: 12px;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    padding-left: 20px;
}

.search-box i {
    color: #666;
    margin-right: 15px;
}

.search-box input {
    background: none;
    border: none;
    color: #fff;
    width: 100%;
    height: 44px;
    font-size: 1rem;
    outline: none;
}

.select-group {
    display: flex;
    gap: 8px;
}

.custom-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-select-wrapper select {
    background: #1a1a1a;
    /* Solid dark background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px 35px 10px 15px;
    /* Added right padding for arrow */
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    line-height: 1.2;
}

.custom-select-wrapper::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    font-size: 0.8rem;
    color: #666;
    pointer-events: none;
}

.custom-select-wrapper select:hover {
    background: #252525;
    border-color: rgba(255, 255, 255, 0.2);
}

.custom-select-wrapper select option {
    background: #111;
    /* Solid dark background for all platforms */
    color: #fff;
    padding: 10px;
}

/* Specific styling for browser dropdowns */
select:-webkit-autofill,
select:focus {
    background-color: #1a1a1a !important;
    color: #fff !important;
}

.clear-filters-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent-primary);
    border-radius: 12px;
    text-decoration: none;
}

/* TABLE VIEW (DESKTOP) */
.desktop-view {
    display: block;
}

/* Enhanced Desktop Table Column Handling */
@media (min-width: 1025px) {
    .premium-table {
        table-layout: auto;
    }

    .col-icon {
        width: 80px;
    }

    .col-name {
        min-width: 260px;
        width: 32%;
    }

    .col-desc {
        min-width: 300px;
    }

    .col-rarity {
        width: 140px;
    }

    .col-stats {
        width: 180px;
    }

    .col-type {
        width: 140px;
    }

    .name-box {
        display: block;
        width: 100%;
    }

    .premium-table .item-name {
        display: block;
        white-space: normal;
        word-break: normal;
        overflow-wrap: break-word;
        line-height: 1.3;
        font-weight: 700;
        font-size: 1.1rem;
    }
}

.mobile-view {
    display: none;
}

.items-table-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--item-border);
    border-radius: 20px;
    overflow: hidden;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
}

.premium-table th {
    text-align: left;
    padding: 20px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #666;
    border-bottom: 1px solid var(--item-border);
}

.premium-table td {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.item-interactive-row {
    transition: background 0.2s;
    cursor: pointer;
}

.item-interactive-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.item-square {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.item-square img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Handled by media query for desktop, but keeping base styles */
.items-db-wrapper .item-name,
.premium-modal .item-name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
}

.desc-text {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rarity-glow-badge {
    padding: 0;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    background: none !important;
    background-color: transparent !important;
}

.stat-pair {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.stat-pair .divider {
    color: #333;
}

.text-gold {
    color: var(--gold);
}

/* MOBILE CARD GRID */
@media (max-width: 1024px) {
    .desktop-view {
        display: none;
    }

    .mobile-view {
        display: block;
    }

    .premium-filter-bar {
        flex-direction: column;
        padding: 15px;
        border-radius: 20px;
    }

    .search-box {
        width: 100%;
        padding: 0;
    }

    .select-group {
        width: 100%;
    }

    .custom-select-wrapper {
        flex: 1;
    }

    .custom-select-wrapper select {
        width: 100%;
    }
}

.item-grid-mobile {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.mobile-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--item-border);
    border-radius: 16px;
    padding: 15px;
}

.card-top {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    align-items: center;
}

.card-title-area {
    display: flex;
    flex-direction: column;
}

.m-item-name {
    font-weight: 800;
    font-size: 1.1rem;
}

.m-item-type {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.m-stat {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.m-rarity {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    background: transparent !important;
    /* Force transparent */
}

.items-db-wrapper .rarity-common,
.premium-modal .rarity-common {
    color: var(--c-common);
}

.items-db-wrapper .rarity-uncommon,
.premium-modal .rarity-uncommon {
    color: var(--c-uncommon);
}

.items-db-wrapper .rarity-rare,
.premium-modal .rarity-rare {
    color: var(--c-rare);
}

.items-db-wrapper .rarity-epic,
.premium-modal .rarity-epic {
    color: var(--c-epic);
}

.items-db-wrapper .rarity-legendary,
.premium-modal .rarity-legendary {
    color: var(--c-legendary);
}

.items-db-wrapper .rarity-common,
.items-db-wrapper .rarity-uncommon,
.items-db-wrapper .rarity-rare,
.items-db-wrapper .rarity-epic,
.items-db-wrapper .rarity-legendary,
.premium-modal .rarity-common,
.premium-modal .rarity-uncommon,
.premium-modal .rarity-rare,
.premium-modal .rarity-epic,
.premium-modal .rarity-legendary {
    background: none !important;
    background-color: transparent !important;
}

/* RARITY ICON TINTS */
.item-square.rarity-uncommon {
    background: rgba(46, 204, 113, 0.1);
    border-color: rgba(46, 204, 113, 0.3);
}

.item-square.rarity-rare {
    background: rgba(52, 152, 219, 0.1);
    border-color: rgba(52, 152, 219, 0.3);
}

.item-square.rarity-epic {
    background: rgba(155, 89, 182, 0.1);
    border-color: rgba(155, 89, 182, 0.3);
}

.item-square.rarity-legendary {
    background: rgba(241, 196, 15, 0.1);
    border-color: rgba(241, 196, 15, 0.3);
}

/* CLEAN TEXT OVERRIDES */
.items-db-wrapper .rarity-glow-badge.rarity-uncommon,
.items-db-wrapper .item-name.rarity-uncommon,
.items-db-wrapper .m-item-name.rarity-uncommon {
    color: var(--c-uncommon);
}

.items-db-wrapper .rarity-glow-badge.rarity-rare,
.items-db-wrapper .item-name.rarity-rare,
.items-db-wrapper .m-item-name.rarity-rare {
    color: var(--c-rare);
}

.items-db-wrapper .rarity-glow-badge.rarity-epic,
.items-db-wrapper .item-name.rarity-epic,
.items-db-wrapper .m-item-name.rarity-epic {
    color: var(--c-epic);
}

.items-db-wrapper .rarity-glow-badge.rarity-legendary,
.items-db-wrapper .item-name.rarity-legendary,
.items-db-wrapper .m-item-name.rarity-legendary {
    color: var(--c-legendary);
}

.rarity-glow-badge,
.item-name,
.m-item-name,
.m-rarity,
.rarity-common,
.rarity-uncommon,
.rarity-rare,
.rarity-epic,
.rarity-legendary {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    padding: 0;
}

.card-tag {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Pagination handled by Unified Design in style.css */

/* MODAL STYLES */
.premium-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.premium-modal.active {
    display: flex;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    /* Allow it to be taller but scroll internally less often */
    background: var(--item-card-light);
    border-radius: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    color: #111;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    animation: modalPop 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes modalPop {
    from {
        transform: scale(0.8) translateY(40px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-body-container {
    height: 100%;
}

/* ITEM CARD DESIGN (Inside Modal) */
.item-card-hero {
    height: 110px;
    /* Thinner header */
    background: #104020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 5px;
    position: relative;
    overflow: hidden;
}

.item-card-hero.type-blueprint {
    background:
        linear-gradient(to right, rgba(1, 171, 244, 0.4) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(1, 171, 244, 0.4) 1px, transparent 1px),
        linear-gradient(135deg, #1a4d7a, #0d3a5f) !important;
    background-size: 15px 15px, 15px 15px, 100% 100% !important;
}

.item-card-hero::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 5px;
    /* Tiny curve to save space */
    background: var(--item-card-light);
    border-radius: 5px 5px 0 0;
}

.hero-large-img {
    max-width: 70%;
    max-height: 70%;
    object-fit: contain;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
}

.item-card-inner {
    padding: 0 20px 20px;
    /* Reduced inner padding */
}

.tag-row {
    display: flex;
    gap: 6px;
    margin: -18px 0 6px;
    /* Optimized pull-up */
}

.card-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    line-height: 1;
    color: #fff !important;
    /* White text on tag backgrounds */
    border: none;
}

.card-title {
    font-size: 1.6rem;
    font-weight: 900;
    margin: 5px 0 10px;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: #000;
}

.card-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

.card-divider {
    height: 1px;
    background: #ccc;
    margin: 0 0 10px;
}

.card-alert {
    background: #f0f0f0;
    border-radius: 4px;
    padding: 6px 10px;
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    /* Tight */
    align-items: flex-start;
}

.card-alert i {
    font-size: 1rem;
    color: #111;
    margin-top: 2px;
}

.card-alert p {
    margin: 0;
    font-weight: 800;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #111;
}

.card-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
    font-weight: 600;
    color: #111;
}

.cs-val {
    font-weight: 700;
}

.metadata-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 15px;
}

.meta-tag {
    background: #cfd8dc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #455a64;
    text-transform: uppercase;
}

.currency-icon {
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1;
    margin-right: 4px;
}

/* PROGRESS STATS (Weapons) */
.progress-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    /* Reduced grid gap */
    margin-top: 15px;
}

.pg-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #666;
}

.pg-num {
    color: #111;
}

.pg-bar-bg {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.pg-bar-fill {
    height: 100%;
    background: #222;
    border-radius: 3px;
}

/* MODAL FOOTER */
.item-card-summary {
    display: flex;
    border-top: 1.5px solid #ddd;
    margin: 25px -20px -20px;
    /* More space at bottom */
    background: rgba(0, 0, 0, 0.02);
}

.summary-box {
    flex: 1;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.1rem;
    color: #111;
}

.summary-box i {
    font-size: 1.2rem;
}

.summary-box:first-child {
    border-right: 1px solid #ddd;
}

/* MODAL CLOSE */
.modal-x {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 34px;
    height: 34px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 17px;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

.modal-x:hover {
    transform: rotate(90deg);
    background: #ff6b35;
}

/* Loader */
.modal-loader {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Body Lock */
body.modal-open {
    overflow: hidden !important;
    padding-right: 15px;
}

/* Force blueprint grid background on item squares */
.items-db-wrapper .item-square.type-blueprint,
.mobile-item-card .item-square.type-blueprint {
    background:
        linear-gradient(to right, rgba(1, 171, 244, 0.4) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(1, 171, 244, 0.4) 1px, transparent 1px),
        linear-gradient(135deg, #1a4d7a, #0d3a5f) !important;
    background-size: 10px 10px, 10px 10px, 100% 100% !important;
    border-color: #01abf4 !important;
    box-shadow: 0 0 8px rgba(1, 171, 244, 0.5) !important;
}

@media (max-width: 768px) {
    .modal-x {
        background: rgba(0, 0, 0, 0.7) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        width: 38px !important;
        height: 38px !important;
        line-height: 38px !important;
        border-radius: 10px !important;
        top: 10px !important;
        right: 10px !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5) !important;
    }
}