* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f0f0f;
    min-height: 100vh;
    padding: 10px;
    color: #e0e0e0;
}

.container {
    max-width: 100%;
    margin: 0;
}

header {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #2a2a2a;
}

header h1 {
    color: #f5a623;
    font-size: 2.5em;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(245, 166, 35, 0.3);
}

section {
    background: #1a1a1a;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin-bottom: 20px;
    border: 1px solid #2a2a2a;
}

h2 {
    color: #f5a623;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 600;
}

h3 {
    color: #b0b0b0;
    margin-bottom: 12px;
    font-size: 1.2em;
    font-weight: 600;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #f5a623;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.2);
}

.search-input::placeholder {
    color: #666;
}

.sort-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sort-label {
    color: #b0b0b0;
    font-size: 14px;
    font-weight: 600;
}

.sort-btn {
    padding: 10px 16px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sort-btn:hover {
    background: #353535;
    border-color: #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.sort-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border-color: #8b5cf6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.collections-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
    max-height: calc(5 * (85px + 10px));
    overflow-y: auto;
    padding-right: 5px;
}

.collections-grid::-webkit-scrollbar {
    width: 8px;
}

.collections-grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.collections-grid::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 4px;
}

.collections-grid::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

.collection-btn {
    padding: 6px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: right;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    min-height: 85px;
    position: relative;
}

.collection-btn-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
}

.collection-btn-preview {
    width: auto;
    height: 100%;
    max-width: 60px;
    object-fit: contain;
    border-radius: 4px;
    background: #1a1a1a;
}

.collection-btn-name {
    font-size: 16px;
    line-height: 1.3;
    word-break: break-word;
    text-align: right;
    margin-bottom: 4px;
    font-weight: 800;
    color: #e0e0e0;
    text-shadow: 0 0 8px rgba(224, 224, 224, 0.3);
}

.collection-btn-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex: 1;
    justify-content: flex-end;
}

.collection-btn-price-ton {
    font-size: 16px;
    font-weight: 800;
    color: #a78bfa;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

.collection-btn-price-usd {
    font-size: 16px;
    font-weight: 800;
    color: #fbbf24;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.collection-btn:hover {
    background: #353535;
    border-color: #8b5cf6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.collection-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border-color: #8b5cf6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
    max-height: calc(5 * (100px + 10px));
    overflow-y: auto;
    padding-right: 5px;
}

.models-grid::-webkit-scrollbar {
    width: 8px;
}

.models-grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.models-grid::-webkit-scrollbar-thumb {
    background: #8b5cf6;
    border-radius: 4px;
}

.models-grid::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

.model-btn {
    padding: 6px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: right;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    min-height: 100px;
    position: relative;
}

.model-btn-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
}

.model-btn-preview {
    width: auto;
    height: 100%;
    max-width: 70px;
    object-fit: contain;
    border-radius: 4px;
    background: #1a1a1a;
}

.model-btn-name {
    font-size: 16px;
    line-height: 1.3;
    word-break: break-word;
    text-align: right;
    margin-bottom: 4px;
    font-weight: 800;
    color: #e0e0e0;
    text-shadow: 0 0 8px rgba(224, 224, 224, 0.3);
}

.model-btn-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex: 1;
    justify-content: flex-end;
}

.model-btn-price-ton {
    font-size: 16px;
    font-weight: 800;
    color: #a78bfa;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
}

.model-btn-price-usd {
    font-size: 16px;
    font-weight: 800;
    color: #fbbf24;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.model-btn:hover {
    background: #353535;
    border-color: #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.model-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border-color: #8b5cf6;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.all-models-btn {
    grid-column: 1 / -1;
    background: #2a2a2a;
    color: #f5a623;
    font-weight: 700;
    border: 1px solid #f5a623;
    min-height: 50px;
    padding: 12px 16px;
    flex-direction: row;
}

.all-models-btn:hover {
    background: #353535;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.3);
}

.all-models-btn.active {
    background: linear-gradient(135deg, #f5a623 0%, #e88d00 100%);
    color: #0f0f0f;
    border-color: #f5a623;
    box-shadow: 0 0 20px rgba(245, 166, 35, 0.5);
}

.filters-group {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 30px;
    align-items: start;
}

.filter-block {
    display: flex;
    flex-direction: column;
}

.providers-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.provider-btn {
    padding: 10px 20px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.provider-btn:hover {
    background: #353535;
    border-color: #f5a623;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
}

.provider-btn.active {
    background: linear-gradient(135deg, #f5a623 0%, #e88d00 100%);
    color: #0f0f0f;
    border-color: #f5a623;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.4);
}

.time-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.time-btn {
    padding: 10px 16px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.time-btn:hover {
    background: #353535;
    border-color: #f5a623;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
}

.time-btn.active {
    background: linear-gradient(135deg, #f5a623 0%, #e88d00 100%);
    color: #0f0f0f;
    border-color: #f5a623;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.4);
}

.price-filter {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-inputs input {
    flex: 1;
    padding: 10px 12px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.price-inputs input:focus {
    outline: none;
    border-color: #f5a623;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
}

.price-inputs input::placeholder {
    color: #666;
}

.price-separator {
    color: #666;
    font-weight: 600;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #f5a623;
}

.checkbox-label:hover span {
    color: #f5a623;
}

.reset-zoom-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: 1px solid #8b5cf6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
    margin-top: 25px;
}

.reset-zoom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
}

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

.chart-header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.currency-toggle {
    display: flex;
    gap: 8px;
    background: #2a2a2a;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
}

.currency-btn {
    padding: 8px 16px;
    background: transparent;
    color: #b0b0b0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.currency-btn:hover {
    color: #f5a623;
}

.currency-btn.active {
    background: linear-gradient(135deg, #f5a623 0%, #e88d00 100%);
    color: #0f0f0f;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
}

.chart-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    color: #b0b0b0;
    font-size: 14px;
}

.stat-item strong {
    color: #f5a623;
    font-size: 16px;
}

.chart-container {
    position: relative;
    height: 500px;
    margin-bottom: 15px;
    background: #242424;
    border-radius: 8px;
    padding: 10px;
}

.chart-hint {
    text-align: center;
    color: #666;
    font-size: 13px;
    font-style: italic;
}

.loader {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

@media (max-width: 1024px) {
    .filters-group {
        grid-template-columns: 1fr;
    }
    
    .collections-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    header h1 {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    section {
        padding: 15px;
    }
    
    .collections-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .models-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .chart-container {
        height: 350px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .add-form {
        flex-direction: column;
    }
}

/* Navigation links */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.nav-link {
    padding: 10px 20px;
    background: linear-gradient(135deg, #f5a623 0%, #e88d00 100%);
    color: #0f0f0f;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid #f5a623;
    display: inline-block;
}

.nav-link:hover {
    box-shadow: 0 0 20px rgba(245, 166, 35, 0.5);
    transform: translateY(-1px);
}

.nav-link.secondary {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    border-color: #8b5cf6;
    color: white;
}

.nav-link.secondary:hover {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

/* Portfolio summary */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.summary-card {
    background: #242424;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid #3a3a3a;
}

.summary-label {
    color: #b0b0b0;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-value {
    color: #f5a623;
    font-size: 22px;
    font-weight: 700;
}

.summary-sub {
    color: #fbbf24;
    font-size: 14px;
    margin-top: 4px;
}

.summary-pnl-pct {
    font-size: 18px;
    font-weight: 700;
    margin-top: 4px;
}

.positive { color: #22c55e !important; }
.negative { color: #ef4444 !important; }

/* Import section */
.import-hint {
    color: #b0b0b0;
    font-size: 14px;
    margin-bottom: 12px;
}

#import-textarea {
    width: 100%;
    padding: 12px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    margin-bottom: 12px;
}

#import-textarea:focus {
    outline: none;
    border-color: #f5a623;
    box-shadow: 0 0 15px rgba(245, 166, 35, 0.2);
}

#import-textarea::placeholder {
    color: #555;
}

.import-buttons {
    display: flex;
    gap: 10px;
}

/* Action buttons */
.action-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: white;
    border: 1px solid #8b5cf6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.action-btn:hover {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #3a3a3a;
}

.action-btn.secondary:hover {
    border-color: #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.action-btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #ef4444;
}

.action-btn.danger:hover {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Add form */
.add-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 150px;
}

.form-group label {
    color: #b0b0b0;
    font-size: 13px;
    font-weight: 600;
}

.form-group input {
    padding: 10px 12px;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #f5a623;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
}

.form-group input::placeholder {
    color: #555;
}

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

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

.table-wrapper {
    overflow-x: auto;
}

#portfolio-table {
    width: 100%;
    border-collapse: collapse;
}

#portfolio-table th {
    background: #242424;
    color: #f5a623;
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 2px solid #3a3a3a;
    white-space: nowrap;
    user-select: none;
}

#portfolio-table th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

#portfolio-table th.sortable:hover {
    color: #fbbf24;
}

#portfolio-table th.sort-asc::after {
    content: ' \2191';
    color: #8b5cf6;
}

#portfolio-table th.sort-desc::after {
    content: ' \2193';
    color: #8b5cf6;
}

#portfolio-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 14px;
    white-space: nowrap;
}

#portfolio-table tr:hover {
    background: #242424;
}

.delete-btn {
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* Toast notification */
.status-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s;
}

.status-toast.success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.status-toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}
