/* Portfolio Management Styles */

.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Portfolio Container */
.portfolio-container {
    background: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.loading-portfolio {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid var(--border-color);
    border-top: 6px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
}

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

/* Portfolio Header */
.portfolio-header {
    background: linear-gradient(135deg, var(--accent-color), #9b59b6);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.portfolio-title h2 {
    margin: 0 0 5px 0;
    font-size: 2.2rem;
    color: white;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.last-updated {
    font-size: 0.9rem;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

.btn-add-bet,
.btn-export-portfolio {
    background: white;
    color: #2c3e50;
    border: 2px solid white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-add-bet:hover,
.btn-export-portfolio:hover {
    background: #f8f9fa;
    color: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.view-toggle {
    display: flex;
    background: white;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.view-btn {
    background: transparent;
    color: #2c3e50;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: #3498db;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.view-btn:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

/* Portfolio Content */
.portfolio-content {
    padding: 30px;
}

.portfolio-section {
    display: none;
}

.portfolio-section.active {
    display: block;
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.analytics-grid,
.risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

/* Portfolio Cards */
.portfolio-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.portfolio-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), #9b59b6);
}

.portfolio-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.portfolio-card h3 {
    color: var(--text-primary);
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Bankroll Summary */
.bankroll-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.current-bankroll,
.profit-loss {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.current-bankroll .amount,
.profit-loss .amount {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.profit-loss.profit .amount {
    color: #2ecc71;
}

.profit-loss.loss .amount {
    color: #e74c3c;
}

.current-bankroll .label,
.profit-loss .label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.bankroll-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.detail-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-item .value {
    font-weight: 600;
    color: var(--text-primary);
}

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

.detail-item .value.negative {
    color: #e74c3c;
}

.detail-item .value.risk-low {
    color: #2ecc71;
}

.detail-item .value.risk-medium {
    color: #f39c12;
}

.detail-item .value.risk-high {
    color: #e74c3c;
}

/* Performance Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.metric-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.metric-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.metric-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Bet Cards */
.bets-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.bet-card {
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bet-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.bet-card.active {
    border-left: 4px solid var(--accent-color);
}

.bet-card.recent.win {
    border-left: 4px solid #2ecc71;
}

.bet-card.recent.loss {
    border-left: 4px solid #e74c3c;
}

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

.bet-match {
    font-weight: 600;
    color: var(--text-primary);
}

.bet-id {
    font-size: 0.8rem;
    color: white;
    background: var(--accent-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.bet-outcome {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.bet-outcome.win {
    background: #2ecc71;
    color: white;
}

.bet-outcome.loss {
    background: #e74c3c;
    color: white;
}

.bet-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.bet-market,
.bet-stake,
.bet-return,
.bet-result {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.bet-result.profit {
    color: #2ecc71;
    font-weight: 600;
}

.bet-result.loss {
    color: #e74c3c;
    font-weight: 600;
}

.bet-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bet-strategy {
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
}

.bet-confidence {
    color: var(--accent-color);
    font-weight: 600;
}

.bet-roi.positive {
    color: #2ecc71;
    font-weight: 600;
}

.bet-roi.negative {
    color: #e74c3c;
    font-weight: 600;
}

.view-all-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.no-bets {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Goals Progress */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.goal-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

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

.goal-name {
    font-weight: 600;
    color: var(--text-primary);
}

.goal-progress {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #2ecc71);
    border-radius: 4px;
    transition: width 0.8s ease;
}

.goal-details {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Risk Management */
.risk-overview .risk-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
}

.score-circle {
    width: 100px;
    height: 100px;
    border: 6px solid var(--accent-color);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
}

.score {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-color);
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.risk-level {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
}

.risk-level.low {
    background: #2ecc71;
    color: white;
}

.risk-level.medium {
    background: #f39c12;
    color: white;
}

.risk-level.high {
    background: #e74c3c;
    color: white;
}

.risk-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.risk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

/* Risk Controls */
.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.control-item label {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.control-input {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
    text-align: center;
    font-weight: 600;
}

.control-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: 80px;
}

.save-controls-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.save-controls-btn:hover {
    background: var(--accent-hover);
}

/* Recommendations */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.rec-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.rec-text {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Market and Analytics */
.market-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.market-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 15px;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.market-name {
    font-weight: 600;
    color: var(--text-primary);
}

.market-roi {
    color: #2ecc71;
    font-weight: 600;
}

.market-bets {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.time-stats h4 {
    color: var(--text-primary);
    margin: 0 0 15px 0;
}

.day-performance {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.day-item {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Add Bet Modal */
.bet-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.bet-modal {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 3px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    color: white !important;
    font-weight: 700 !important;
    font-size: 1.4rem !important;
    text-shadow: none !important;
    margin: 0 !important;
    background: none !important;
    opacity: 1 !important;
}

.close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
    transform: rotate(90deg);
}

.bet-form {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    background: #f8f9fa;
}

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

.btn-cancel,
.btn-add {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: #f8f9fa;
    color: #2c3e50;
    border: 2px solid #ddd;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-cancel:hover {
    background: #e9ecef;
    color: #2c3e50;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-add {
    background: #3498db;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-add:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Quick Actions */
.quick-actions {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quick-actions h3 {
    color: var(--text-primary);
    margin: 0 0 20px 0;
    text-align: center;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
}

.action-icon {
    font-size: 1.8rem;
}

.action-text {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Portfolio Insights */
.portfolio-insights {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.portfolio-insights h3 {
    color: var(--text-primary);
    margin: 0 0 20px 0;
    text-align: center;
}

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

.insight-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.insight-card .insight-icon {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-color), #9b59b6);
    border-radius: 50%;
    color: white;
}

.insight-card .insight-content h4 {
    color: var(--text-primary);
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.insight-card .insight-content p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* Notifications */
.portfolio-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInRight 0.3s ease;
}

.portfolio-notification.success {
    border-left: 4px solid #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.portfolio-notification.error {
    border-left: 4px solid #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.portfolio-notification.info {
    border-left: 4px solid var(--accent-color);
    background: rgba(74, 144, 226, 0.1);
}

.portfolio-notification button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    margin-left: 10px;
    padding: 0;
    width: 20px;
    height: 20px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Error State */
.portfolio-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-primary);
}

.portfolio-error h3 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.portfolio-error button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
}

.portfolio-error button:hover {
    background: var(--accent-hover);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }
    
    .portfolio-header {
        flex-direction: column;
        text-align: center;
    }
    
    .portfolio-actions {
        justify-content: center;
    }
    
    .overview-grid,
    .analytics-grid,
    .risk-grid {
        grid-template-columns: 1fr;
    }
    
    .bankroll-main {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bet-details {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .insights-cards {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .portfolio-container {
        margin: 0 -10px 20px;
        border-radius: 0;
    }
    
    .portfolio-content {
        padding: 20px;
    }
    
    .portfolio-card {
        padding: 20px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .market-item {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .control-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .control-input {
        width: 100%;
    }
}