/* Globalne */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* zapobiega scrollowi całej strony */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f6f8;
    color: #333;
}

/* Nawigacja / pasek zakładek z wartością portfela */
nav {
    display: flex;
    justify-content: space-between; /* zakładki po lewej, wartość portfela po prawej */
    align-items: center;
    background: #2c3e50;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    height: 50px; /* wysokość paska */
    box-sizing: border-box;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    padding: 14px 25px;
    cursor: pointer;
    color: #ecf0f1;
    transition: background 0.3s, color 0.3s;
    user-select: none;
    white-space: nowrap;
}

nav ul li:hover {
    background: #34495e;
}

nav ul li.active {
    background: #e74c3c;
    color: white;
    font-weight: bold;
}

#computeCorrBtn {
    padding: 6px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#computeCorrBtn:hover {
    background: #2980b9;
}

/* Wartość portfela po prawej stronie */
#portfolio-value {
    font-size: 16px;
    font-weight: bold;
    color: #ecf0f1;
    white-space: nowrap; /* liczba nie zawija się */
}

#portfolio-value #portfolio-amount {
    color: #f1c40f; /* wyróżnienie liczby złotym kolorem */
}

/* Zakładki / sekcje */
.tab {
    display: none;
    padding: 20px;
    height: calc(100vh - 50px); /* dopasowanie wysokości sekcji do paska zakładek */
    box-sizing: border-box;
    overflow: hidden; /* scroll tylko w lewej kolumnie */
}

.tab.active {
    display: block;
}

/* Portfel – układ */
#portfolio-container {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;

    height: calc(100vh - 60px); /* odejmujemy wysokość nav i ewentualne marginesy */
    align-items: stretch;        /* kolumny rozciągnięte na pełną wysokość */
    padding: 10px;               /* estetyczne odstępy */
    box-sizing: border-box;
}

/* Lewa kolumna – tabela */
#portfolio-table {
    flex: 1;
    min-width: 350px;
    max-width: 700px;
    height: 90%;
    overflow-y: auto;
    overflow-x: auto;
    padding-right: 4px;
}

/* Tabela */
#portfolio-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    font-size: 15px;
}

/* Komórki */
#portfolio-table th, 
#portfolio-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e4e7eb;
}

/* Nagłówki tabeli */
#portfolio-table th {
    background: #f2f2f2;
    color: black;
    font-weight: 600;
    letter-spacing: 0.4px;
    position: relative;
    user-select: none;
}

/* Strzałki sortowania */
#portfolio-table th .sort-arrow-box {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    line-height: 0.8em;
}

#portfolio-table th .sort-arrow-box span {
    font-size: 0.65em;
    opacity: 0.6;
    transition: 0.15s;
}

#portfolio-table th:hover .sort-arrow-box span {
    opacity: 0.9;
}

/* Strzałki aktywne */
#portfolio-table th .arrow-up.active,
#portfolio-table th .arrow-down.active {
    opacity: 1 !important;
    font-weight: bold;
}

/* Naprzemienne wiersze */
#portfolio-table tr:nth-child(even) {
    background: #f9fbfd;
}

/* Hover */
#portfolio-table tr:hover {
    background: #eef4fb;
}

/* Wiersz dodawania */
.add-row {
    text-align: center;
    background: #fff;
    padding: 18px;
}

/* Prawa kolumna – graf */
#portfolio-graph {
    flex: 1;
    min-width: 600px;

    height: 90%;
    box-sizing: border-box;
    padding: 15px;

    border-radius: 10px;
    border: 1px solid #ccc;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);

    overflow: hidden;   /* brak scrolla w panelu grafu */
}

/* Zapobiega przycinaniu samego obszaru SVG */
#portfolio-graph svg {
    overflow: visible !important;
    background: transparent;
}

/* Etykiety węzłów */
.node-label {
    font-size: 14px;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

/* Etykiety krawędzi */
.edge-label {
    font-size: 14px;
    font-weight: 600;
    fill: #333;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

/* Lista aktywów */
#assets-list table {
    width: 100%;
    border-collapse: collapse;
}

#assets-list th, #assets-list td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
}

#assets-list th {
    background-color: #f2f2f2;
    cursor: pointer;
    position: relative; /* potrzebne dla strzałki */
}

#assets-list th span.arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
}

button {
    padding: 6px 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    margin: 2px;
}

button:hover {
    background: #2980b9;
}

/* Responsywność */
@media (max-width: 900px) {
    #portfolio-container {
        flex-direction: column;
    }

    #portfolio-graph {
        height: 400px;
    }
}