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

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

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

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

.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;
    text-decoration: none;
}

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

.action-button.danger {
    background-color: #e74c3c;
}

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

.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);
}

.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;
}

/* Portfolio Summary */
.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s, background-color 0.3s;
}

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

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.total-value .card-icon {
    color: var(--secondary);
}

.total-cost .card-icon {
    color: #f39c12;
}

.total-profit .card-icon {
    color: #2ecc71;
}

.best-performer .card-icon {
    color: #9b59b6;
}

.card-content {
    flex: 1;
}

.card-title {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
}

.card-change {
    font-size: 14px;
    font-weight: 600;
}

.card-change.positive {
    color: #2ecc71;
}

.card-change.negative {
    color: #e74c3c;
}

/* Portfolio Chart */
.portfolio-chart-container {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

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

.chart-header h2 {
    margin: 0;
    font-size: 20px;
}

.chart-tabs {
    display: flex;
    gap: 10px;
}

.chart-tab {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    color: var(--light);
    cursor: pointer;
    transition: background-color 0.3s;
}

.chart-tab.active {
    background-color: var(--primary);
}

.portfolio-chart {
    height: 300px;
    position: relative;
}

/* Timeframe Selector */
.timeframe-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 5px;
}

.timeframe-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 5px;
}

.timeframe-btn {
    background: none;
    border: none;
    color: var(--light);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.timeframe-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.timeframe-btn.active {
    background-color: var(--primary);
}

/* Collections */
.collections-container {
    margin-bottom: 30px;
}

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

.collections-header h2 {
    margin: 0;
    font-size: 24px;
}

.collections-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    flex-wrap: wrap;
    max-width: 100%;
}

.collection-tab {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    color: var(--light);
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.collection-tab.active {
    background-color: var(--primary);
}

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

.portfolio-loading, .portfolio-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); }
}

.portfolio-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

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

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

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

.portfolio-empty .add-item-tile {
    margin-top: 20px;
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.portfolio-empty .add-item-tile:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.portfolio-empty .add-item-tile i {
    font-size: 32px;
    margin-bottom: 0;
}

.portfolio-empty .add-item-tile span {
    font-size: 16px;
}

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

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

.portfolio-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; }

.portfolio-item .item-details {
    padding: 15px;
}

.portfolio-item .item-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-bottom: 8px;
}

.portfolio-item .item-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 15px;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
}

.profit-value {
    display: flex;
    align-items: center;
    gap: 5px;
}

.profit-value.positive { color: #2ecc71; }
.profit-value.negative { color: #e74c3c; }
.profit-value.neutral { color: #f5f5f5; }

.portfolio-item .item-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

/* Pagination */
.portfolio-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;
}

/* Modals */
.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;
}

.modal-small {
    max-width: 500px;
    padding: 30px;
}

@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 */
.modal .item-details {
    display: flex;
    flex-direction: row;
    padding: 30px;
    gap: 30px;
}

.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;
}

.property-value.positive { 
    color: #2ecc71; 
}

.property-value.negative { 
    color: #e74c3c; 
}

.investment-notes {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.investment-notes h3 {
    font-size: 16px;
    margin-bottom: 10px;
}

.investment-notes textarea {
    width: 100%;
    min-height: 100px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--light);
    padding: 10px;
    margin-bottom: 10px;
    resize: vertical;
}

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

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

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

.form-group input,
.form-group textarea {
    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);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

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

/* Collection List */
.collection-list {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.collection-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 5px;
}

.collection-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.collection-option.selected {
    background-color: rgba(255, 77, 0, 0.2);
    border: 1px solid var(--primary);
}

.collection-option input[type="radio"] {
    margin-right: 10px;
}

.collection-option-label {
    font-weight: 500;
}

/* Empty message styling */
.portfolio-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);
}

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

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

/* Dropdown menu */
.dropdown-menu {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--dark);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1;
    border-radius: 4px;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.2s ease;
}

.dropdown-content a {
    color: var(--light);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s;
}

.dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Make dropdown stay open when hovering over it */
.dropdown-menu:hover .dropdown-content {
    display: block;
}

/* Add a small delay before hiding the dropdown */
.dropdown-content {
    pointer-events: auto;
}

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

.add-item-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.add-item-tile:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.add-item-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.add-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-icon .fa-plus {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
}

.add-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
}

/* Search Modal Styles */
.search-modal-content {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    max-height: 800px;
}

.search-input-container {
    position: relative;
    margin-bottom: 20px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

#item-search-input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
}

#item-search-input:focus {
    outline: none;
    border-color: var(--theme-accent-color);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 10px;
}

.search-empty, .search-loading, .search-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.search-loading .fa-spinner {
    margin-right: 10px;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.search-result-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.search-result-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.result-item-image {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
}

.result-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-item-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-item-name {
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-item-price {
    font-size: 16px;
    font-weight: bold;
    color: var(--theme-accent-color);
}

.add-to-portfolio-btn {
    padding: 8px 12px;
    background-color: var(--theme-accent-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.add-to-portfolio-btn:hover {
    background-color: var(--theme-accent-color-hover);
}

/* Purchase Info Modal */
.purchase-info-modal-content {
    width: 500px;
    max-width: 90%;
}

.purchase-item-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.purchase-item-preview img {
    width: 150px;
    height: 150px;
    object-fit: contain;
}

#purchase-item-name {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-align: center;
}

#purchase-item-market-price {
    font-size: 16px;
    color: var(--theme-accent-color);
}

.purchase-info-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

.form-group input, .form-group select, .form-group textarea {
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--theme-accent-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.cancel-btn {
    padding: 10px 15px;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.confirm-btn {
    padding: 10px 15px;
    background-color: var(--theme-accent-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.cancel-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.confirm-btn:hover {
    background-color: var(--theme-accent-color-hover);
}

/* Search Modal Enhancements */
.search-modal-content {
    background-color: var(--dark, #1a1a1a);
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--light, #ffffff);
}

.modal-body {
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

.portfolio-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

#portfolio-search {
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.portfolio-search-container input {
    padding: 8px 15px 8px 35px;
    border: none;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--light);
    width: 220px;
    cursor: text;
    transition: all 0.3s ease;
    font-size: 14px;
}

.portfolio-search-container input:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.portfolio-search-container input:focus {
    width: 280px;
    background-color: rgba(255, 255, 255, 0.15);
    outline: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.portfolio-search-container input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.portfolio-search-container i {
    position: absolute;
    left: 12px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: color 0.3s ease;
    font-size: 14px;
}

.portfolio-search-container:hover i,
.portfolio-search-container i.active {
    color: var(--primary, #f77f00);
}

.search-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    pointer-events: none;
}

.search-input-container {
    position: relative;
    margin-bottom: 20px;
}

#item-search-input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    font-size: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    transition: border-color 0.3s, background-color 0.3s;
}

#item-search-input:focus {
    outline: none;
    border-color: var(--primary, #f77f00);
    background-color: rgba(255, 255, 255, 0.15);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    padding: 10px;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 15px;
}

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

.search-empty, .search-loading, .search-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 20px;
}

.search-empty i, .search-loading i, .search-error i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.search-loading .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.search-result-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, background-color 0.3s;
    display: flex;
    flex-direction: column;
}

.search-result-item:hover {
    transform: translateY(-3px);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.result-item-image {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 aspect ratio */
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
}

.result-item-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.search-result-item:hover .result-item-image img {
    transform: scale(1.05);
}

.result-item-details {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item-name {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-item-info {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.result-item-category {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
}

.result-item-collection {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.result-item-price {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary, #f77f00);
    margin-top: auto;
}

.add-to-portfolio-btn {
    padding: 8px 12px;
    background-color: var(--primary, #f77f00);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-to-portfolio-btn:hover {
    background-color: var(--primary-hover, #e04700);
}

.add-to-portfolio-btn i {
    font-size: 14px;
}

/* Rarity indicator at the top of items */
.item-rarity {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 1;
}

.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; }

/* Custom scrollbar for the search results */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .modal-header, .modal-body {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    #item-search-input {
        padding: 12px 12px 12px 40px;
        font-size: 14px;
    }
    
    .search-icon {
        left: 12px;
    }
}

/* Quantity display in portfolio items */
.item-quantity {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

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

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

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

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control button {
    width: 30px;
    height: 30px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

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

.quantity-control button:active {
    background-color: var(--primary);
}

.quantity-control input {
    width: 50px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    padding: 5px 0;
}

/* Make total value and total profit more prominent for quantity items */
.modal .property-value.total-value {
    font-size: 18px;
    font-weight: 700;
}

.modal .property-value .each-value {
    font-size: 14px;
    opacity: 0.8;
}

/* Quantity indicator styles */
.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 */
}

/* Make the add item tile have consistent height */
.add-item-tile {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Chart loading state */
.portfolio-chart.loading {
    position: relative;
}

.portfolio-chart.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.portfolio-chart.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary, #f77f00);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Add this to portfolio.css */
.form-group select {
    width: 100%;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: var(--light);
    appearance: auto; /* Ensures the dropdown arrow appears */
}

#purchase-condition-select {
    width: 100%;
}

/* Update existing CSS or add this to portfolio.css */
.confirm-btn {
    padding: 10px 15px;
    background-color: var(--primary); /* Use the orange primary color */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.confirm-btn:hover {
    background-color: #e04700; /* Darker orange on hover */
}

/* Collection tab container styling */
.collection-tab-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Delete button styling */
.collection-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

.collection-delete-btn:hover {
    background-color: #e74c3c;
    color: white;
}

/* Show delete button on hover */
.collection-tab-container:hover .collection-delete-btn {
    opacity: 1;
}

/* Make sure collection tabs still look good with the new container */
.collection-tab-container .collection-tab {
    margin: 0;
}

/* Active tab styling (update for container) */
.collection-tab-container .collection-tab.active {
    background-color: var(--primary);
}

/* Delete Collection Modal Styling */
.delete-collection-warning {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.delete-collection-warning i {
    color: #e74c3c;
    font-size: 24px;
}

.delete-collection-warning p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

.delete-collection-items-notice {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.delete-collection-items-notice p {
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.8);
}

.delete-collection-items-notice p:last-child {
    margin-bottom: 0;
}

.action-button.danger {
    background-color: #e74c3c;
}

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

/* Collection Management Dropdown */
.collection-manage-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 10px;
}

.collection-manage-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.collection-manage-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.collection-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--dark);
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    overflow: hidden;
    margin-top: 5px;
}

.collection-manage-dropdown:hover .collection-dropdown-content {
    display: block;
}

.collection-dropdown-content a {
    display: block;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: background-color 0.2s;
}

.collection-dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.collection-dropdown-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

.collection-dropdown-header {
    color: rgba(255, 255, 255, 0.5);
    padding: 5px 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.collection-dropdown-delete-item:hover {
    background-color: rgba(231, 76, 60, 0.2);
    color: #fff;
}

.collection-dropdown-delete-item:hover i {
    color: #e74c3c;
}

/* Adjust the collections container to prevent scrollbar */
.collections-tabs {
    display: flex;
    gap: 10px;
    overflow: visible; /* Change from auto to visible */
    flex-wrap: wrap;
    max-width: 100%;
    margin-bottom: 20px; /* Add some bottom margin for spacing */
}

/* Make collection tab containers work better in the flex layout */
.collection-tab-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-bottom: 5px; /* Add a small bottom margin in case of wrapping */
}

/* Ensure the collection tabs header adapts to flex layout */
.collections-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Change from center to flex-start to handle wrapping better */
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Ensure consistent sizing for all collection tabs */
.collection-tab {
    height: 36px; /* Set a fixed height for all tabs */
    padding: 0 15px; /* Consistent padding */
    font-size: 14px; /* Consistent font size */
    line-height: 36px; /* Match line height to height for vertical centering */
    white-space: nowrap; /* Prevent text wrapping within tabs */
}

/* Make All Items tab consistent with other tabs */
.collection-tab[data-collection="all"] {
    height: 36px;
    line-height: 36px;
    padding: 0 15px;
}

/* Ensure the collection tab container doesn't add extra size */
.collection-tab-container {
    height: 36px;
    line-height: 36px;
}

/* Make sure the collection tab inside the container fits properly */
.collection-tab-container .collection-tab {
    margin: 0;
    height: 100%;
}

/* Adjust delete button position to work with fixed height */
.collection-delete-btn {
    top: -6px;
    right: -6px;
}

/* Collection actions dropdown */
.collection-actions-dropdown {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 10;
}

.collection-actions-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.collection-actions-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.collection-actions-content {
    display: none;
    position: absolute;
    top: 24px;
    right: 0;
    min-width: 120px;
    background-color: var(--dark);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 20;
    overflow: hidden;
    padding: 5px 0;
    /* Add a slight delay before hiding */
    transition: visibility 0s linear 0.3s, opacity 0.3s ease;
    visibility: hidden;
    opacity: 0;
}

/* Add a padding/buffer area to make it easier to move to dropdown */
.collection-actions-dropdown::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}

/* Show dropdown on hover */
.collection-actions-dropdown:hover .collection-actions-content {
    display: block;
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

/* Keep dropdown visible when hovering over the dropdown content */
.collection-actions-content:hover {
    display: block;
    visibility: visible;
    opacity: 1;
}

.collection-actions-content a {
    display: block;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 13px;
    white-space: nowrap;
}

.collection-actions-content a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.collection-actions-content a:hover i {
    color: var(--primary);
}

.collection-actions-content a:last-child:hover i {
    color: #e74c3c;
}

.collection-actions-content a i {
    width: 16px;
    margin-right: 8px;
    text-align: center;
}

/* Form validation styling */
.form-group.error input,
.form-group.error textarea {
    border-color: #e74c3c;
}

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

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

/* Make All Items tab match other tabs in size */
.collection-tab[data-collection="all"] {
    margin-bottom: 5px; /* Match margin of other tabs */
}

#purchase-condition-select {
    width: 100%;
}

/* Update existing CSS or add this to portfolio.css */
.confirm-btn {
    padding: 10px 15px;
    background-color: var(--primary); /* Use the orange primary color */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.confirm-btn:hover {
    background-color: #e04700; /* Darker orange on hover */
}

/* Special flags checkboxes styling */
.checkbox-group {
    display: flex;
    gap: 20px;
    margin-top: 5px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkbox-item label {
    margin: 0;
    font-weight: normal;
    color: var(--light);
    cursor: pointer;
}

#purchase-stattrak-checkbox:checked + label {
    color: #CF6A32; /* StatTrak orange color */
    font-weight: 600;
}

#purchase-souvenir-checkbox:checked + label {
    color: #FFD700; /* Souvenir gold color */
    font-weight: 600;
}