/* Inventory Page Styles */
.page-container {
    padding: 40px 0;
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.inventory-header h1 {
    margin: 0;
    font-size: 32px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.inventory-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.action-button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.3s;
}

.action-button:hover {
    background-color: #e04700;
}

.search-container {
    position: relative;
}

.search-container input {
    padding: 8px 15px;
    padding-right: 35px;
    border: none;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light);
    width: 200px;
}

.search-container i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

.filter-container {
    display: flex;
    gap: 10px;
}

.filter-container select {
    padding: 8px 10px;
    border: none;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light);
    cursor: pointer;
}

/* Inventory Stats */
.inventory-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--secondary);
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

/* Inventory Grid */
.inventory-container {
    position: relative;
    min-height: 400px;
}

.inventory-loading, .inventory-empty {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.inventory-empty {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.inventory-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--primary);
}

.inventory-empty h3 {
    margin-bottom: 10px;
}

.inventory-empty p {
    margin-bottom: 20px;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.inventory-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, background-color 0.3s;
    cursor: pointer;
}

.inventory-item:hover {
    transform: translateY(-5px);
    background-color: rgba(255, 255, 255, 0.08);
}

.item-image {
    aspect-ratio: 1;
    width: 100%;
    background-color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

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

.item-rarity {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.item-rarity.consumer { background-color: #b0c3d9; }
.item-rarity.industrial { background-color: #5e98d9; }
.item-rarity.mil-spec { background-color: #4b69ff; }
.item-rarity.restricted { background-color: #8847ff; }
.item-rarity.classified { background-color: #d32ce6; }
.item-rarity.covert { background-color: #eb4b4b; }
.item-rarity.contraband { background-color: #e4ae39; }

/* Fix inventory item details styles */
.inventory-item .item-details {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.inventory-item .item-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    height: auto;
    margin-bottom: 4px;
}

.inventory-item .item-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.inventory-item .item-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.inventory-item .item-trend {
    font-size: 11px;
    margin-left: auto;
}

.item-trend.positive { color: #4cd137; }
.item-trend.negative { color: #eb4b4b; }
.item-trend.neutral { color: #f5f5f5; }

.price-na {
    color: #777;
    font-style: italic;
    font-weight: normal;
}

/* Pagination */
.inventory-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 5px;
}

.page-button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.page-button:hover, .page-button.active {
    background-color: var(--primary);
}

.page-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Item Details Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
}

.modal-content {
    background-color: var(--dark);
    margin: 5% auto;
    border-radius: 8px;
    max-width: 900px;
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--light);
}

/* Modal item details styles (different from grid item details) */
.modal .item-details {
    display: flex;
    flex-direction: row;
    padding: 30px;
    gap: 30px;
    height: auto;
}

.item-image-container {
    flex: 0 0 300px;
    background-color: var(--gray);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.item-info {
    flex: 1;
}

.item-info h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--light);
}

.item-properties {
    margin-bottom: 20px;
}

.property {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.property-label {
    color: rgba(255, 255, 255, 0.7);
}

.property-value {
    font-weight: 600;
}

.item-description {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

.item-actions {
    display: flex;
    gap: 10px;
}

/* Collectibles checkbox styling */
.collectibles-toggle {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.toggle-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background-color: #333;
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    margin: 0;
    margin-right: 8px;
}

.toggle-checkbox:checked {
    background-color: #f77f00;
    border-color: #f77f00;
}

.toggle-checkbox:checked::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    top: 1px;
    left: 5px;
    transform: rotate(45deg);
}

.toggle-label {
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

/* Empty message styling */
.inventory-empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.inventory-empty-message i {
    font-size: 32px;
    margin-bottom: 15px;
    color: #f77f00;
}

.inventory-empty-message p {
    margin-bottom: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .inventory-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .inventory-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .modal .item-details {
        flex-direction: column;
    }
    
    .item-image-container {
        flex: 0 0 auto;
        margin-bottom: 20px;
    }
}

.sticker-section {
    margin-top: 15px;
    background-color: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 4px;
}

.sticker-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.sticker-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sticker-item {
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.sticker-item:hover {
    transform: scale(1.1);
    z-index: 1;
}

.sticker-item img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.sticker-item.empty {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    cursor: default;
}

.sticker-item.empty:hover {
    transform: none;
}

.sticker-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    z-index: 10;
}

.sticker-item:hover .sticker-tooltip {
    opacity: 1;
}

/* Add to Portfolio Modal Styles */
#add-portfolio-modal .modal-content {
    background-color: var(--dark);
    padding: 30px;
    max-width: 500px;
}

#add-portfolio-modal h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
}

/* Item preview styling */
.item-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.item-preview img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background-color: var(--gray);
    border-radius: 4px;
}

.item-preview #add-portfolio-item-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--light);
}

/* Form group styling */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.7);
}

.form-group input {
    width: 100%;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--light);
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Form actions styling */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.action-button {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.action-button:hover {
    background-color: #e04700;
}

.cancel-button {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-weight: 600;
    cursor: pointer;
}

.cancel-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Form validation styles */
.form-group.error input {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.form-group.error .error-message {
    display: block;
}

/* Disabling incompatible input formats in Firefox */
input[type="number"] {
    appearance: textfield;
}

/* Removing spinners in Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Item quantity indicator */
.item-quantity {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #f77f00;
    color: white;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none; /* Ensure it doesn't interfere with clicks */
}

/* Modal item details with quantity support */
.modal .item-details .property.quantity-property {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.property-value .each-value {
    font-size: 14px;
    opacity: 0.8;
    margin-left: 5px;
}

/* Quantity field in portfolio modal */
#add-quantity-container {
    position: relative;
}

#add-quantity-input {
    text-align: center;
}

#add-quantity-input::-webkit-inner-spin-button,
#add-quantity-input::-webkit-outer-spin-button {
    opacity: 1;
    height: 24px;
}

/* Highlight available quantity */
.quantity-note {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
    font-style: italic;
}

/* Collection dropdown styling */
#add-collection-select {
    width: 100%;
    padding: 8px 10px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    appearance: auto; /* Ensures dropdown arrow appears */
}

#add-collection-select:focus {
    outline: none;
    border-color: var(--primary);
}

#add-collection-select option {
    background-color: var(--dark);
    color: var(--light);
}