/* Body - No Fixed Height */
body {
    min-height: 100vh;
    height: auto;
}

/* Main Content - Not Full Width */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    min-height: calc(100vh - 80px); /* Subtract header height */
}

.content-container {
    max-width: 100%;
    padding: 20px;
    padding-top: 100px;
}

/* Header Section - Match Content Width */
.header-section {
    margin: 0 auto 24px auto;
    max-width: 1200px;
    position: relative;
    z-index: 1;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 12px;
    padding: 20px 24px;
}

.header-text h1 {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    letter-spacing: -0.5px;
}

.header-text p {
    color: #cccccc;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.action-buttons .btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Statistics Section - Clean */
.stats-section {
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.stat-card {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: #555;
    transform: translateY(-1px);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Profit Chart - Ultra Compact */
.profit-chart-section {
    margin-bottom: 15px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 12px;
}

.profit-chart-section h2 {
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.chart-container {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px;
    height: 120px;
}

#profitChart {
    max-width: 100%;
    height: 100%;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #404040;
}

.section-header h2 {
    color: #ffffff;
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #404040;
    color: white;
    border: 1px solid #555;
}

.btn-secondary:hover {
    background: #4a4a4a;
}

.btn-icon {
    font-size: 0.9rem;
}

/* Investments List - Ultra Compact */
.investments-list {
    display: grid;
    gap: 8px;
}

.investment-card {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.investment-image {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    background: #404040;
}

.investment-details {
    flex: 1;
}

.investment-details h4 {
    color: #ffffff;
    font-size: 0.9rem;
    margin-bottom: 2px;
    font-weight: 600;
}

.investment-details p {
    color: #cccccc;
    font-size: 0.7rem;
    margin-bottom: 4px;
}

.investment-value {
    color: #4CAF50;
    font-weight: 600;
    font-size: 0.9rem;
}

.investment-actions {
    display: flex;
    gap: 6px;
}

.btn-sell {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-sell:hover {
    background: #45a049;
}

.btn-edit {
    background: #f44336;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-edit:hover {
    background: #ffffff;
}

/* Sold Items - Ultra Compact */
.sold-items {
    margin-bottom: 15px;
}

.sold-items .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sold-items .section-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
}

.sold-items .section-header .btn {
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sold-items .section-header .btn:hover {
    background: #333333;
    border-color: #555;
}

.sold-items .section-header .btn .btn-icon {
    transition: transform 0.2s ease;
}

.sold-items .section-header .btn.expanded .btn-icon {
    transform: rotate(180deg);
}

.filter-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.filter-buttons .btn {
    padding: 3px 6px;
    font-size: 0.7rem;
}

.filter-buttons .btn.active {
    background: #ffffff;
    color: white;
}

.sold-items-list {
    display: grid;
    gap: 8px;
}

.sold-items-content {
    display: grid;
    gap: 8px;
}

.sold-item-card {
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 14px;
    align-items: center;
    transition: all 0.2s ease;
}

.sold-item-card:hover {
    background: #333333;
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.sold-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #555;
}

.sold-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sold-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sold-item-name {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sold-item-main-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.sold-item-prices {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 12px 16px;
    align-items: start;
}

.sold-item-price-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}

.sold-item-price-label {
    color: #999999;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sold-item-sale-price { color: #ffffff; font-weight: 700; font-size: 1.0rem; line-height: 1.2; }

.sold-item-purchase-price { color: #cccccc; font-weight: 500; font-size: 0.9rem; line-height: 1.2; }

.sold-item-profit {
    color: #4CAF50;
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    padding: 6px 12px;
    background: rgba(76, 175, 80, 0.18);
    border-radius: 8px;
    border: 1px solid rgba(76, 175, 80, 0.45);
    min-width: 110px;
}

.sold-item-loss {
    color: #f44336;
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
    padding: 6px 12px;
    background: rgba(244, 67, 54, 0.18);
    border-radius: 8px;
    border: 1px solid rgba(244, 67, 54, 0.45);
    min-width: 110px;
}

.sold-item-dates { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.7rem; color: #999999; border-top: 1px dashed #3a3a3a; padding-top: 6px; }

.sold-item-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sold-item-date-icon {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.sold-item-card {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sold-item-card.profit {
    border-left: 3px solid #4CAF50;
}

.sold-item-card.loss {
    border-left: 3px solid #f44336;
}

.sold-item-details {
    flex: 1;
}

.sold-item-details h4 {
    color: #ffffff;
    font-size: 0.9rem;
    margin-bottom: 2px;
    font-weight: 600;
}

.sold-item-details p {
    color: #cccccc;
    font-size: 0.7rem;
    margin-bottom: 4px;
}
.sold-item-sub { color: #999999; font-size: 0.75rem; margin-left: 6px; }

.sold-item-profit {
    font-weight: 600;
    font-size: 0.9rem;
}

.sold-item-profit.positive {
    color: #4CAF50;
}

.sold-item-profit.negative {
    color: #f44336;
}

/* Performance Metrics - Compact */
.performance-metrics {
    margin-bottom: 20px;
}

.performance-metrics h2 {
    color: #ffffff;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.metric-card {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.metric-title {
    color: #cccccc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.metric-value {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.metric-description {
    color: #999999;
    font-size: 0.7rem;
}

/* Modals - Compact */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #404040;
}

.modal-header {
    background: #404040;
    color: white;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

/* Forms - Compact */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #cccccc;
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    background: #404040;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.85rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

/* Fee Calculator - Compact */
.fee-calculator {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
    margin: 15px 0;
}

.fee-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.fee-item.total {
    border-top: 1px solid #333;
    padding-top: 6px;
    margin-top: 6px;
    font-weight: 600;
}

.fee-item.profit {
    color: #4CAF50;
    font-weight: 700;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999999;
}

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

/* Item Actions */
.item-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .investment-card {
        flex-direction: column;
        text-align: center;
    }
    
    .investment-actions {
        justify-content: center;
    }
    
    .item-actions {
        margin-left: 0;
        justify-content: center;
    }
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-content {
        max-width: 1000px;
    }
    
    .header-section {
        max-width: 1000px;
    }
}

@media (max-width: 1200px) {
    .main-content {
        max-width: 900px;
    }
    
    .header-section {
        max-width: 900px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
        min-height: calc(100vh - 60px);
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .section-actions {
        flex-direction: column;
        gap: 8px;
        align-items: flex-end;
    }
    
    .sold-item-main-content {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .sold-item-prices {
        flex-direction: column;
        gap: 8px;
        align-items: center;
        text-align: center;
    }
    
    .sold-item-dates {
        flex-direction: column;
        gap: 4px;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .section-actions {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
}

/* Items Section - Clean */
.items-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    color: #ffffff;
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.items-count {
    color: #cccccc;
    font-size: 0.9rem;
    font-weight: 500;
}

.items-list {
    display: grid;
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #999999;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 12px;
}

.empty-state p {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 500;
}

.empty-state p:last-child {
    margin: 0;
    font-size: 0.85rem;
    color: #666666;
}