/* ???????????????????????????????????????????????????????????????
   INVESTMENT MODAL ? Add Investment
   Terminal aesthetic ? no gradients, no excess rounding, no glow
   ??????????????????????????????????????????????????????????????? */

/* ??? Overlay ????????????????????????????????????????????????? */
.investment-modal {
    display: none;
    position: fixed;
    z-index: 900;
    inset: 0;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(4px);
    transition: background 0.2s, backdrop-filter 0.2s;
}
.investment-modal.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
}

/* ??? Content ????????????????????????????????????????????????? */
.investment-modal-content {
    background: var(--bg-1);
    margin: 32px auto;
    border: 1px solid var(--border-2);
    border-radius: var(--r-sm);
    width: min(860px, 94vw);
    max-height: calc(100vh - 64px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(-12px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.investment-modal.show .investment-modal-content {
    transform: translateY(0);
    opacity: 1;
}
.investment-modal-content.no-transform {
    transform: none !important;
}

/* ??? Header ?????????????????????????????????????????????????? */
.investment-modal-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-0);
    position: sticky;
    top: 0;
    z-index: 5;
}
.investment-modal-header h2 {
    margin: 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-1);
}
.investment-close-modal {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--r-xs);
    transition: color 0.15s;
}
.investment-close-modal:hover { color: var(--text-1); }

/* ??? Body ???????????????????????????????????????????????????? */
.investment-modal-body {
    padding: 14px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.investment-modal-body .investment-item-gallery,
.investment-item-gallery {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
}

/* ??? Search ?????????????????????????????????????????????????? */
.investment-search-section {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.investment-search-container {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.investment-search-container input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 36px 7px 12px;
    background: var(--bg-0);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    color: var(--text-1);
    font-size: 0.82rem;
    transition: border-color 0.15s;
}
.investment-search-container input:focus {
    outline: none;
    border-color: var(--accent);
}
.investment-search-container .investment-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 14px;
    pointer-events: none;
}
.investment-search-filters {
    display: flex;
    gap: 8px;
}
.investment-search-filters select {
    padding: 7px 10px;
    background: var(--bg-0);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    color: var(--text-1);
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.15s;
}
.investment-search-filters select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ??? Gallery ????????????????????????????????????????????????? */
.investment-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
    margin-bottom: 6px;
    min-height: 160px;
}
.investment-gallery-item {
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 8px 8px 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: center;
}
.investment-gallery-item:hover {
    border-color: var(--border-2);
    background: var(--bg-2);
}
.investment-gallery-item.selected {
    border-color: var(--accent);
    background: var(--bg-2);
}
.investment-gallery-item-image {
    width: 100%;
    height: 60px;
    object-fit: contain;
    margin-bottom: 5px;
}
.investment-gallery-item-name {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-1);
    margin-bottom: 2px;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.investment-gallery-item-type {
    font-size: 0.66rem;
    color: var(--text-3);
    margin-bottom: 0;
}
.investment-gallery-item-rarity {
    display: none;
}
.investment-gallery-loading {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-3);
    font-size: 0.82rem;
}

/* ??? Selected item form ?????????????????????????????????????? */
.investment-selected-item-form {
    background: var(--bg-0);
    border: 1px solid var(--accent);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    position: sticky;
    bottom: 0;
    z-index: 4;
}
.investment-selected-item-info {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 0 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}
.investment-selected-item-info img {
    width: 44px;
    height: 34px;
    object-fit: contain;
    border-radius: var(--r-xs);
    background: var(--bg-2);
}
.investment-selected-item-details h3 {
    color: var(--text-0);
    margin: 0 0 4px;
    font-size: 0.82rem;
    font-weight: 600;
}
.investment-selected-item-details p {
    color: var(--text-3);
    margin: 0 4px 0 0;
    font-size: 0.66rem;
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.04em;
}

/* ??? Form layout ????????????????????????????????????????????? */
.investment-form .investment-form-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 6px 8px;
    margin-bottom: 6px;
    align-items: end;
}
.investment-form .col-2 { grid-column: span 2; }
.investment-form .col-3 { grid-column: span 3; }
.investment-form .col-4 { grid-column: span 4; }
.investment-form .col-6 { grid-column: span 6; }
.investment-form .col-8 { grid-column: span 8; }
.investment-form .col-12 { grid-column: span 12; }

/* ??? Form groups ????????????????????????????????????????????? */
.investment-form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.investment-form-group label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.investment-form-group input,
.investment-form-group select,
.investment-form-group textarea {
    padding: 6px 9px;
    background: var(--bg-1);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    color: var(--text-1);
    font-size: 0.82rem;
    font-family: inherit;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.investment-form-group input:focus,
.investment-form-group select:focus,
.investment-form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.investment-form-group input:-webkit-autofill,
.investment-form-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px var(--bg-1) inset !important;
    -webkit-text-fill-color: var(--text-1) !important;
    transition: background-color 9999s ease !important;
}
.investment-form-group textarea {
    resize: vertical;
    min-height: 44px;
}

/* ??? StatTrak / Souvenir toggle ?????????????????????????????? */
.investment-form-group .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 33px;
    padding: 0 2px;
}
.investment-form-group .checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}
.investment-form-group .checkbox-row label {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--text-2);
    cursor: pointer;
    margin: 0;
}

/* ??? Sticker craft ??????????????????????????????????????????? */
.sticker-craft-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.sticker-craft-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.sticker-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-1);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    padding: 6px;
    min-height: 72px;
    width: 72px;
    flex-shrink: 0;
    position: relative;
}
.sticker-field:hover { border-color: var(--accent); }
.sticker-field input {
    width: 100%;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-1);
    font-size: 0.72rem;
    padding: 2px;
}
.sticker-field input:focus { outline: none; }
.sticker-preview {
    width: 36px;
    height: 36px;
    background: var(--bg-2);
    border-radius: var(--r-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-3);
    text-align: center;
    line-height: 1.2;
}
.sticker-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sticker-add-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    background: var(--bg-1);
    border: 1px dashed var(--border-2);
    border-radius: var(--r-xs);
    padding: 6px;
    cursor: pointer;
    width: 72px;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.sticker-add-slot:hover { border-color: var(--accent); }
.sticker-add-slot .add-icon {
    font-size: 18px;
    color: var(--accent);
    margin-bottom: 2px;
}
.sticker-add-slot .add-text {
    font-size: 0.65rem;
    color: var(--text-3);
    text-align: center;
}
.sticker-remove-btn {
    background: var(--negative);
    border: none;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: 2px;
    right: 2px;
    transition: opacity 0.15s;
}
.sticker-remove-btn:hover { opacity: 0.8; }
.sticker-add-btn {
    background: var(--bg-1);
    border: 1px dashed var(--border-2);
    color: var(--text-3);
    padding: 8px 14px;
    border-radius: var(--r-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    transition: border-color 0.15s, color 0.15s;
}
.sticker-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ??? Form actions ???????????????????????????????????????????? */
.investment-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 6px;
}
.investment-form-actions button {
    padding: 7px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--r-xs);
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, border-color 0.15s;
    font-family: 'IBM Plex Sans', sans-serif;
}
.investment-form-actions button:first-child {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border-2);
}
.investment-form-actions button:first-child:hover {
    border-color: var(--text-3);
    color: var(--text-1);
}
.investment-form-actions button:last-child {
    background: var(--accent);
    color: #000;
}
.investment-form-actions button:last-child:hover { opacity: 0.88; }

/* ??? Mobile ?????????????????????????????????????????????????? */
@media (max-width: 768px) {
    .investment-modal { align-items: flex-end; }
    .investment-modal-content {
        width: 100%;
        margin: 0;
        border-radius: var(--r-sm) var(--r-sm) 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        max-height: 94vh;
    }
    .investment-modal-body { padding: 12px 14px; }
    .investment-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
    .investment-form .investment-form-row { grid-template-columns: 1fr 1fr; }
    .investment-form .col-4,
    .investment-form .col-6 { grid-column: span 1; }
    .investment-form .col-12,
    .investment-form .col-8 { grid-column: span 2; }
    .investment-form-actions { flex-direction: column-reverse; }
    .investment-form-actions button { width: 100%; padding: 11px; }
    .investment-search-section { flex-wrap: wrap; }
    .investment-search-container { min-width: 100%; }
    .investment-search-filters { width: 100%; }
    .investment-search-filters select { flex: 1; }
    .investment-selected-item-form { position: static; }
}
@media (max-width: 480px) {
    .investment-gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------
   STICKER CRAFT ? new positional UI
   --------------------------------------------------------------- */
.sc-container {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sc-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.sc-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
}
.sc-hint {
    font-size: 0.72rem;
    color: var(--text-3);
}

/* Weapon image + slot row */
.sc-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 8px 12px;
}
.sc-weapon-img {
    height: 48px;
    width: 90px;
    object-fit: contain;
    flex-shrink: 0;
}
.sc-slots {
    display: flex;
    gap: 8px;
    flex: 1;
}

/* Individual slot ? 5 slots, flex-shrink so they fit */
.sc-slot {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    background: var(--bg-1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}
.sc-slot:hover { border-color: var(--text-3); }
.sc-slot.active {
    border-color: var(--accent);
    background: var(--bg-2);
    box-shadow: 0 0 0 2px rgba(0,230,118,0.15);
}
.sc-slot.has-sticker .sc-slot-empty { display: none; }
.sc-slot:not(.has-sticker) .sc-slot-remove { display: none; }
.sc-slot:not(.has-sticker) .sc-slot-img { display: none; }

.sc-slot-n {
    position: absolute;
    top: 3px;
    left: 5px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--text-3);
    pointer-events: none;
}
.sc-slot-empty {
    font-size: 1.2rem;
    color: var(--text-3);
    pointer-events: none;
}
.sc-slot-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    pointer-events: none;
}
.sc-slot-remove {
    position: absolute;
    top: 1px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: var(--negative);
    border: none;
    border-radius: 2px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 2;
}
.sc-slot-remove:hover { opacity: 0.8; }

/* Gallery section */
.sc-gallery-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sc-search {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 12px;
    background: var(--bg-0);
    border: 1px solid var(--border-2);
    border-radius: var(--r-xs);
    color: var(--text-1);
    font-size: 0.875rem;
}
.sc-search:focus { outline: none; border-color: var(--accent); }
.sc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 4px;
    max-height: 170px;
    overflow-y: auto;
}
.sc-gallery-loading {
    grid-column: 1 / -1;
    padding: 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 0.8rem;
}
.sc-sticker-item {
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 6px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.12s, background 0.12s;
}
.sc-sticker-item:hover {
    border-color: var(--accent);
    background: var(--bg-2);
}
.sc-sticker-item img {
    width: 48px;
    height: 36px;
    object-fit: contain;
    display: block;
    margin: 0 auto 3px;
}
.sc-sticker-item-name {
    font-size: 0.66rem;
    color: var(--text-3);
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
@media (max-width: 600px) {
    .sc-preview { flex-direction: column; align-items: flex-start; }
    .sc-weapon-img { width: 100%; height: 50px; }
    .sc-slots { flex-wrap: wrap; }
    .sc-gallery { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); max-height: 160px; }
}
