/* Portfolio Boss Frontend Styles - WORKING VERSION */

/* Container */
.portfolio-boss-container {
    background-color: #000000;
    color: #FFFFFF;
    font-family: 'Courier New', Courier, monospace;
    padding: 20px;
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.portfolio-header {
    margin-bottom: 20px;
}

.portfolio-header h2 {
    color: #FFD700;
    font-size: 28px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 20px 0;
    font-family: 'Courier New', Courier, monospace;
}

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

.sort-toggle, .currency-toggle {
    display: flex;
    gap: 10px;
}

.sort-btn, .currency-btn {
    background-color: transparent;
    color: #FFD700;
    border: 2px solid #FFD700;
    padding: 8px 16px;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.sort-btn:hover, .currency-btn:hover {
    background-color: #FFD700;
    color: #000000;
}

.sort-btn.active, .currency-btn.active {
    background-color: #FFD700;
    color: #000000;
}

/* Totals */
.portfolio-totals {
    background-color: #1a1a1a;
    border: 2px solid #FFD700;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.total-item {
    text-align: center;
    min-width: 150px;
}

.total-label {
    color: #FFD700;
    font-size: 12px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.total-value {
    color: #FFFFFF;
    font-size: 20px;
    font-weight: bold;
}

.total-value.positive {
    color: #00FF00;
}

.total-value.negative {
    color: #FF0000;
}

/* CRITICAL: Table wrapper that ACTUALLY works */
.portfolio-table-wrapper {
    width: 100%;
    overflow-x: scroll !important; /* Force scroll always */
    overflow-y: visible;
    margin-bottom: 20px;
    border: 1px solid #333;
    background-color: #000000;
    position: relative;
    display: block;
}

/* Table with fixed layout */
.portfolio-table {
    width: max-content; /* This forces the table to be as wide as its content */
    min-width: 1500px; /* Minimum width to force scroll */
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed !important; /* This is critical */
    background-color: #000000;
}

.portfolio-table thead {
    background-color: #1a1a1a;
}

.portfolio-table th {
    color: #FFD700;
    text-align: left;
    padding: 12px 10px;
    text-transform: uppercase;
    font-weight: bold;
    border-bottom: 2px solid #FFD700;
    font-size: 12px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.portfolio-table tbody tr {
    border-bottom: 1px solid #333333;
}

.portfolio-table tbody tr:hover {
    background-color: #1a1a1a;
}

.portfolio-table td {
    padding: 12px 10px;
    font-size: 14px;
    vertical-align: top;
    overflow: hidden;
}

/* WORKING COLUMN WIDTHS */
/* Column 1 - CAD Ticker */
.portfolio-table th:nth-child(1),
.portfolio-table td:nth-child(1) {
    width: 80px !important;
    font-weight: bold;
    color: #FFD700;
}

/* Column 2 - Company */
.portfolio-table th:nth-child(2),
.portfolio-table td:nth-child(2) {
    width: 150px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column 3 - Description - THE KEY FIX */
.portfolio-table th:nth-child(3),
.portfolio-table td:nth-child(3) {
    width: 350px !important;
    max-width: 350px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    line-height: 1.4;
    color: #CCCCCC;
    font-size: 13px;
}

/* Column 4 - Shares */
.portfolio-table th:nth-child(4),
.portfolio-table td:nth-child(4) {
    width: 120px !important;
    text-align: right;
}

/* Column 5 - Entry Price */
.portfolio-table th:nth-child(5),
.portfolio-table td:nth-child(5) {
    width: 100px !important;
    text-align: right;
}

/* Column 6 - Current Price */
.portfolio-table th:nth-child(6),
.portfolio-table td:nth-child(6) {
    width: 120px !important;
    text-align: right;
}

/* Column 7 - Original Value */
.portfolio-table th:nth-child(7),
.portfolio-table td:nth-child(7) {
    width: 140px !important;
    text-align: right;
}

/* Column 8 - Current Value */
.portfolio-table th:nth-child(8),
.portfolio-table td:nth-child(8) {
    width: 140px !important;
    text-align: right;
}

/* Column 9 - Market Cap */
.portfolio-table th:nth-child(9),
.portfolio-table td:nth-child(9) {
    width: 120px !important;
    text-align: right;
}

/* Column 10 - P/L $ */
.portfolio-table th:nth-child(10),
.portfolio-table td:nth-child(10) {
    width: 120px !important;
    text-align: right;
}

/* Column 11 - P/L % */
.portfolio-table th:nth-child(11),
.portfolio-table td:nth-child(11) {
    width: 80px !important;
    text-align: right;
}

/* Currency values */
.currency-value {
    font-family: 'Courier New', Courier, monospace;
}

/* P/L Styling */
.positive { color: #00FF00; }
.negative { color: #FF0000; }

/* Gradients */
.gain-1 { color: #90EE90; }
.gain-2 { color: #7FFF00; }
.gain-3 { color: #00FF00; }
.gain-4 { color: #00FA9A; }
.gain-5 { color: #00FF7F; }
.gain-6 { color: #00FF00; font-weight: bold; }

.loss-1 { color: #FFB6C1; }
.loss-2 { color: #FFA07A; }
.loss-3 { color: #FF6347; }
.loss-4 { color: #FF4500; }
.loss-5 { color: #FF0000; }
.loss-6 { color: #DC143C; font-weight: bold; }

/* Loading */
.loading {
    text-align: center;
    color: #FFD700;
    padding: 40px;
    font-size: 16px;
}

/* Footer */
.portfolio-footer {
    text-align: center;
    color: #FFD700;
    font-size: 12px;
    margin-top: 20px;
    text-transform: uppercase;
}

/* Custom scrollbar */
.portfolio-table-wrapper::-webkit-scrollbar {
    height: 14px;
    background: #000;
}

.portfolio-table-wrapper::-webkit-scrollbar-track {
    background: #1a1a1a;
    border: 1px solid #333;
}

.portfolio-table-wrapper::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 7px;
}

.portfolio-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #FFA500;
}

/* Force scrollbar to always show */
.portfolio-table-wrapper {
    overflow-x: scroll !important;
    -webkit-overflow-scrolling: touch;
}