/**
 * Portfolio Tracker Widget Styles
 * Phase 2: Investment portfolio management styling
 */

.portfolio-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

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

.portfolio-selector {
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portfolio-selector:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.5);
}

.portfolio-actions {
    display: flex;
    gap: 8px;
}

.portfolio-action-btn {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portfolio-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

/* Summary Cards */
.portfolio-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.portfolio-summary-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 12px;
}

.portfolio-summary-card.positive {
    background: rgba(0, 255, 100, 0.05);
    border-color: rgba(0, 255, 100, 0.2);
}

.portfolio-summary-card.negative {
    background: rgba(255, 100, 100, 0.05);
    border-color: rgba(255, 100, 100, 0.2);
}

.summary-icon {
    font-size: 28px;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.summary-value {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
}

.portfolio-summary-card.positive .summary-value {
    color: #00ff64;
}

.portfolio-summary-card.negative .summary-value {
    color: #ff6464;
}

/* Holdings Table */
.portfolio-holdings {
    overflow-x: auto;
    border-radius: 12px;
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.3);
}

.holdings-table thead {
    background: rgba(0, 212, 255, 0.1);
}

.holdings-table th {
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.holdings-table td {
    padding: 14px 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.holding-row {
    transition: background 0.2s ease;
}

.holding-row:hover {
    background: rgba(0, 212, 255, 0.05);
}

.holding-name {
    font-weight: 600;
    color: #ffffff;
}

.holding-type {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.holding-gain.positive {
    color: #00ff64;
}

.holding-gain.negative {
    color: #ff6464;
}

.holding-return.positive {
    color: #00ff64;
    font-weight: 600;
}

.holding-return.negative {
    color: #ff6464;
    font-weight: 600;
}

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

.holding-action-btn {
    padding: 6px;
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.holding-action-btn:hover {
    opacity: 1;
}

.edit-btn:hover {
    transform: scale(1.1);
}

.delete-btn:hover {
    transform: scale(1.1);
}

.holdings-empty {
    padding: 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

/* Performance Chart */
.portfolio-performance {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.performance-title {
    margin: 0 0 16px 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.performance-empty {
    padding: 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

#performance-chart {
    max-height: 250px;
}

/* Add Holding Button */
.add-holding-btn {
    padding: 12px 20px;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    color: #00d4ff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-holding-btn:hover {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

/* Empty State */
.portfolio-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.portfolio-empty h4 {
    margin: 0 0 12px 0;
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
}

.portfolio-empty p {
    margin: 0 0 24px 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.create-portfolio-btn {
    padding: 12px 24px;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.5);
    border-radius: 10px;
    color: #7c3aed;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.create-portfolio-btn:hover {
    background: rgba(124, 58, 237, 0.3);
    border-color: rgba(124, 58, 237, 0.7);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 1024px) {
    .portfolio-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .portfolio-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .portfolio-summary {
        grid-template-columns: 1fr;
    }

    .holdings-table {
        font-size: 12px;
    }

    .holdings-table th,
    .holdings-table td {
        padding: 10px 12px;
    }

    .summary-value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .portfolio-summary-card {
        padding: 12px;
    }

    .summary-icon {
        font-size: 24px;
    }

    .summary-value {
        font-size: 14px;
    }

    .holdings-table {
        font-size: 11px;
    }
}

/* Accessibility */
.portfolio-selector:focus-visible,
.portfolio-action-btn:focus-visible,
.holding-action-btn:focus-visible,
.add-holding-btn:focus-visible,
.create-portfolio-btn:focus-visible {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .portfolio-action-btn,
    .holding-action-btn,
    .add-holding-btn,
    .create-portfolio-btn {
        transition: none;
    }

    .add-holding-btn:hover,
    .create-portfolio-btn:hover {
        transform: none;
    }
}
