:root {
    --primary-color: #2a9d8f;
    --primary-hover: #264653;
    --secondary-color: #e9c46a;
    --danger-color: #e76f51;
    --background-color: #f4f4f9;
    --container-bg: #ffffff;
    --text-color: #2c3e50;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
    background: var(--container-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

h1,
h2 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--primary-hover);
}

.hidden {
    display: none;
}

/* Műszerfal gombok */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.dashboard-button {
    padding: 20px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
}

.dashboard-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
}

.dashboard-button.primary {
    grid-column: 1 / -1;
    /* Átfogja mindkét oszlopot */
    font-size: 1.5em;
    padding: 25px;
    background-color: var(--secondary-color);
    color: var(--primary-hover);
}

.dashboard-button.primary:hover {
    background-color: #f4a261;
}

/* Űrlap stílusok */
.back-button {
    background: none;
    border: none;
    font-size: 1em;
    color: var(--primary-color);
    cursor: pointer;
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

.form-group input[readonly] {
    background-color: #eee;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

.summary {
    font-size: 1.2em;
    font-weight: bold;
}

#pnl-summary {
    padding: 5px 10px;
    border-radius: 5px;
    background-color: #eee;
}

.primary-button {
    padding: 12px 25px;
    font-size: 1.1em;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.primary-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Mobil nézet */
@media (max-width: 600px) {
    .container {
        margin: 10px;
        padding: 15px;
    }

    .menu-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* style.css kiegészítése */

/* Játékos sorok a formon belül */
.player-result-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    /* Név | +/- és input | Törlés gomb */
    gap: 15px;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.player-result-row:last-child {
    border-bottom: none;
}

.player-nickname {
    font-size: 1.1em;
    font-weight: 500;
}

/* Előjel váltó gomb és beviteli mező csoportja */
.pnl-input-group {
    display: flex;
    align-items: center;
}

.pnl-sign-toggle {
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    font-weight: bold;
    border: 1px solid #ccc;
    cursor: pointer;
    border-radius: 5px 0 0 5px;
    transition: background-color 0.2s;
}

.pnl-sign-toggle.positive {
    background-color: #d4edda;
    /* Halványzöld */
    color: #155724;
}

.pnl-sign-toggle.negative {
    background-color: #f8d7da;
    /* Halványpiros */
    color: #721c24;
}

.pnl-input {
    width: 100px;
    height: 40px;
    padding: 10px;
    border: 1px solid #ccc;
    border-left: none;
    border-radius: 0 5px 5px 0;
    font-size: 1.1em;
    text-align: right;
    transition: background-color 0.2s;
}

/* A beviteli mező háttérszínei */
.positive-bg {
    background-color: #e2f0e5;
}

.negative-bg {
    background-color: #fbe9ea;
}

.remove-player-btn {
    width: 30px;
    height: 30px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.remove-player-btn:hover {
    background-color: #c04527;
}

.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

#results-table-container {
    overflow-x: auto;
    /* Mobil nézetben görgethetővé teszi a táblát */
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
}

.results-table th,
.results-table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: center;
}

.results-table th {
    background-color: var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
    /* Fejléc rögzítése görgetéskor */
}

.results-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.results-table td.profit,
.results-table td.loss {
    font-weight: bold;
}

/* Játékos kártyák és profil stílusok */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.player-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: center;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
}

.player-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    background-color: #eee;
}

.player-card .nickname {
    font-weight: bold;
    font-size: 1.1em;
}

/* Toggle switch a checkbox helyett */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-switch-label:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch-checkbox:checked+.toggle-switch-label {
    background-color: var(--primary-color);
}

.toggle-switch-checkbox:checked+.toggle-switch-label:before {
    transform: translateX(26px);
}

/* Játékos profil részletező nézet */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.profile-header img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #eee;
}

.profile-header .names .nickname {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-hover);
}

.profile-header .names .real-name {
    font-size: 1.2em;
    color: #777;
}

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

.metric-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: var(--border-radius);
    border-left: 5px solid var(--primary-color);
}

.metric-box .label {
    font-size: 0.9em;
    color: #555;
}

.metric-box .value {
    font-size: 1.5em;
    font-weight: bold;
}

.metric-box .value.profit {
    color: #2e7d32;
}

.metric-box .value.loss {
    color: #c62828;
}

/* =================================== */
/* === LOGIN NÉZET STÍLUSAI (ÚJ) === */
/* =================================== */

#login-view {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--background-color);
}

/* A .hidden class megerősítése az ID selectorral szemben */
#login-view.hidden {
    display: none;
}

.login-box {
    padding: 40px;
    background: var(--container-bg);
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin: 20px;
}

.login-box h1 {
    margin-bottom: 30px;
    color: var(--primary-hover);
}

.login-box label {
    display: none; /* A placeholder miatt nincs szükség a labelre, elrejtjük */
}

.login-box input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.login-box button {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-box button:hover {
    background-color: var(--primary-hover);
}

.login-box button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* =================================== */
/* === MŰSZERFAL HÁTTÉRKÉP (ÚJ) === */
/* =================================== */

#dashboard-view {
    position: relative; /* Pozícionálási kontextus a háttér-rétegnek */
    z-index: 1; /* Biztosítja, hogy a tartalom (gombok, cím) a háttér felett legyen */
    
    /* Ez a sor biztosítja, hogy a háttérkép sarkai is le legyenek kerekítve, ahogy a container */
    border-radius: var(--border-radius); 
    overflow: hidden;
}

#dashboard-view::before {
    content: '';
    position: absolute;
    
    /* 1. TÚLLÓGATÁS: A réteg 20 pixellel nagyobb minden irányban, mint a tárolója. */
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    
    background-image: url('../images/background.png');
    background-size: cover;
    background-position: center;
    
    /* 2. ELMOSÁS: A filter tulajdonság egyenletesen elmossa az egész képréteget. */
    filter: blur(5px);
    
    opacity: 0.6; /* Az áttetszőséget kicsit növelhetjük a jobb hatásért */
    z-index: -1;
}

/* A "Játékos hozzáadása" gomb stílusa */
.secondary-button {
    padding: 8px 16px;
    font-size: 0.9em;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
}

.secondary-button:hover {
    background-color: #e0e0e0;
}

/* A felugró ablakok (dialog) stílusai */
dialog {
    width: 100%;
    max-width: 500px;
    padding: 30px;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

dialog h2 {
    margin-top: 0;
}

/* Az inaktív játékosok listája */
#inactive-player-list {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inactive-player-item {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    font-size: 1.1em;
    transition: background-color 0.2s, border-color 0.2s;
}

.inactive-player-item:hover {
    background-color: #e2f0e5;
    border-color: var(--primary-color);
}

#add-player-modal button, #create-player-modal button {
    margin-top: 10px;
}

.summary-bar {
    display: grid; /* Rácsos elrendezés */
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Rugalmas oszlopok */
    gap: 5px;
    padding: 10px;
    background-color: #f0f2f5;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.summary-cell {
    padding: 10px;
    text-align: center;
    border-radius: 5px;
}

.summary-cell .nickname {
    display: block;
    font-size: 0.8em;
    font-weight: bold;
    margin-bottom: 5px;
}

.summary-cell .value {
    font-size: 1.1em;
    font-weight: bold;
}