/* Portfolio Management Styles */

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

.marketgaze-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
}

.marketgaze-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
}

.marketgaze-header h2 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
}

.marketgaze-header .description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
}

/* Tab Navigation */
.portfolio-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
    background: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tab-button {
    background: none;
    border: none;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    flex: 1;
    text-align: center;
}

.tab-button:hover {
    color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Portfolio Section */
.portfolio-section {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h3 {
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-size: 1.8rem;
    font-weight: 600;
}

.section-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1rem;
}

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

.stat-card {
    background: var(--light-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Portfolio Table */
.portfolio-table-container {
    overflow-x: auto;
    margin-bottom: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.portfolio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: white;
}

.portfolio-table th,
.portfolio-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.portfolio-table th {
    background-color: var(--light-bg);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.portfolio-table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.portfolio-table tbody tr:nth-child(even) {
    background-color: rgba(248, 249, 250, 0.5);
}

/* Portfolio Actions */
.portfolio-actions {
    text-align: center;
    margin-top: 25px;
}

/* Portfolio Status */
.portfolio-status {
    text-align: center;
    padding: 50px 20px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    border: 2px dashed var(--border-color);
    margin: 30px 0;
}

.status-message p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
}

.status-message a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.status-message a:hover {
    text-decoration: underline;
}

/* Diversification Chart */
.diversification-chart,
.performance-charts {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.diversification-chart h4,
.chart-container h4 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
}

.performance-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.chart-container {
    background: var(--light-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

#sector-chart-container,
#value-chart,
#sector-performance-chart {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-style: italic;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin: 0 8px;
    transition: var(--transition);
    text-align: center;
    line-height: 1.5;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #229954;
    transform: translateY(-2px);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e67e22;
    transform: translateY(-2px);
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover:not(:disabled) {
    background-color: #138496;
    transform: translateY(-2px);
}

.btn:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .marketgaze-container {
        padding: 15px;
    }
    
    .marketgaze-header h2 {
        font-size: 2rem;
    }
    
    .portfolio-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        text-align: left;
        border-bottom: 1px solid var(--border-color);
        border-right: none;
    }
    
    .tab-button.active {
        border-bottom-color: var(--border-color);
        border-left: 3px solid var(--primary-color);
    }
    
    .portfolio-stats {
        grid-template-columns: 1fr;
    }
    
    .performance-charts {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    .portfolio-actions .btn {
        width: auto;
        margin: 5px;
    }
}
