/* ==================== ÁÀÇÎÂÛÅ ÑÒÈËÈ ==================== */
html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0;
    background-color: #1a1a1a;
    color: #eee;
}

.page {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

main {
    flex-grow: 1;
    overflow-y: auto;
    height: 100vh;
    background-color: #1a1a1a;
}

.content {
    padding: 1.1rem 1.5rem;
}

/* ==================== HEADER ==================== */
.top-row {
    height: 3.5rem;
    display: flex;
    align-items: center;
    background-color: rgba(0,0,0,0.4);
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    color: #eee;
}

/* ==================== ÇÀÃÎËÎÂÊÈ ==================== */
h3 {
    color: #fff;
    margin-bottom: 1.5rem;
}

/* ==================== ÊÀÐÒÎ×ÊÈ ÍÀÖÈÉ ==================== */
.nation-card {
    border: 2px solid #555;
    transition: border-color .2s, transform .2s;
    background-color: #3a3a3a;
    color: #eee;
}

    .nation-card:hover {
        border-color: #007bff;
        transform: translateY(-2px);
    }

    .nation-card img {
        background-color: #444;
    }

    .nation-card .card-footer {
        background-color: #2a2a2a;
        border-top: 1px solid #555;
        color: #fff;
    }

/* ==================== ÒÀÁÛ ==================== */
.nav-tabs {
    border-bottom: 1px solid #555;
    margin-bottom: 1rem;
}

    .nav-tabs .nav-item .nav-link {
        background-color: #2a2a2a;
        border: 1px solid #555;
        color: #ccc;
        margin-right: 2px;
        border-bottom: none;
    }

        .nav-tabs .nav-item .nav-link:hover {
            background-color: #3a3a3a;
            color: #fff;
            border-color: #666;
        }

        .nav-tabs .nav-item .nav-link.active {
            background-color: #222;
            color: #fff;
            border-color: #555 #555 #222;
            border-bottom: 1px solid #222;
        }

/* ==================== ÊÎÍÒÅÉÍÅÐ ÄÐÅÂÀ ÒÅÕÍÎËÎÃÈÉ ==================== */
.tech-tree-container {
    overflow: auto;
    position: relative;
    min-height: 300px;
    padding-bottom: 70px;
    flex-grow: 1;
    background-color: #222;
}

    .tech-tree-container.loading::after,
    .tech-tree-container.error::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5em;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 10;
    }

    .tech-tree-container.loading::before {
        content: 'Loading...';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #fff;
        z-index: 11;
    }

    .tech-tree-container.error::before {
        content: 'Îøèáêà çàãðóçêè äàííûõ!';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #ffcccc;
        z-index: 11;
    }

.tab-content {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ==================== ÑÅÒÊÀ ÄÐÅÂÀ ÒÅÕÍÎËÎÃÈÉ ==================== */
.tree-grid {
    display: grid;
    gap: 10px 20px;
    padding: 10px;
    background-color: #222;
    position: relative;
}

.tree-grid-item {
    border: 1px solid #555;
    background-color: #3a3a3a;
    color: #eee;
    padding: 5px;
    border-radius: 4px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: visible;
    z-index: 1;
    transition: background-color 0.2s ease-in-out, outline 0.2s ease-in-out;
}

    .tree-grid-item.node-type-folder {
        cursor: pointer;
    }

        .tree-grid-item.node-type-folder:hover {
            background-color: #4f4f4f;
        }

/* ==================== ÓÇËÛ ÄÐÅÂÀ ==================== */
.node-content {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 50px;
}

    .node-content.vehicle-node {
        cursor: pointer;
    }

        .node-content.vehicle-node:hover {
            background-color: #4f4f4f;
        }

.vehicle-node.node-selected {
    outline: 2px solid #0dcaf0;
    outline-offset: -2px;
    background-color: #505f70;
}

.node-content.folder-node.folder-contains-selected {
    border: 1px dashed #0dcaf0 !important;
    background-color: rgba(13, 202, 240, 0.15) !important;
    border-radius: 4px;
}

.tree-grid-item .folder-node.folder-active {
    background-color: #4f4f4f;
}

.node-icon {
    width: 48px;
    height: 48px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 8px;
    flex-shrink: 0;
}

.node-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 0.85em;
    padding-bottom: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.node-name {
    font-weight: bold;
    margin-bottom: 1px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.node-details span {
    margin-right: 8px;
    font-size: 0.9em;
    color: #bbb;
    white-space: nowrap;
}

.node-detail-item.node-exp {
    display: flex;
    align-items: center;
    color: #bbb;
}

/* ==================== ÏÀÏÊÈ ==================== */
.folder-child-counter {
    position: absolute;
    bottom: 3px;
    right: 5px;
    font-size: 0.8em;
    color: #a0a0a0;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 0 4px;
    border-radius: 3px;
    line-height: 1.2;
    z-index: 2;
}

.folder-toggle-icon {
    margin-left: auto;
    padding: 0 8px;
    font-size: 1.1em;
    font-weight: bold;
    color: #ccc;
    align-self: center;
    flex-shrink: 0;
}

.folder-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    z-index: 99;
}

.folder-popup {
    position: absolute;
    visibility: hidden;
    z-index: 100 !important;
    background-color: #3a3a3a;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.6);
    min-width: 180px;
    max-width: 250px;
    transition: opacity 0.1s ease-in-out;
    opacity: 1;
}

.folder-popup-content {
    padding: 8px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.folder-popup-item .vehicle-node {
    background-color: #444;
    border: 1px dashed #777;
}

.folder-popup-item .node-content {
    min-height: 45px;
}

.folder-popup-item .node-icon {
    width: 40px;
    height: 40px;
}

.folder-items-container {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 500;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    min-width: 180px;
}

    .folder-items-container .vehicle-node {
        background-color: #444;
        border: 1px dashed #777;
        z-index: 50;
        padding: 5px;
    }

/* ==================== ÐÀÍÃÈ È ÐÀÇÄÅËÈÒÅËÈ ==================== */
.rank-label {
    background: #555;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    text-align: center;
    padding: 5px;
    flex-direction: column;
    writing-mode: unset;
    transform: none;
    line-height: 1.2;
    border-right: 1px solid #444;
    grid-row: 1 / -1;
    position: sticky;
    left: 0;
    z-index: 2;
    width: 70px; /* Ôèêñèðîâàííàÿ øèðèíà */
    min-width: 70px;
    max-width: 70px;
}

.rank-requirement-counter {
    font-size: 0.8em;
    margin-top: 4px;
    color: #ccc;
}

    .rank-requirement-counter.req-met {
        color: #4CAF50;
        font-weight: bold;
    }

    .rank-requirement-counter.req-not-met {
        color: #ffcc80;
    }

.rank-divider-h {
    grid-column: 2 / -1;
    height: 3px;
    background-color: #555;
    align-self: start;
    position: relative;
    z-index: 0;
    margin: -8px 0;
}

.premium-divider-v {
    width: 3px;
    background-color: #555;
    justify-self: start;
    position: relative;
    z-index: 0;
    margin: 0 -19px;
}

.tech-cat-premium, .tech-cat-event {
    border-left: 5px solid gold;
}

/* ==================== ÏÎËß ÂÂÎÄÀ ==================== */
.rp-input {
    background-color: transparent;
    color: inherit;
    border: none;
    border-bottom: 1px dotted #777;
    border-radius: 0;
    padding: 1px 2px;
    margin-left: 4px;
    width: 80px;
    font-size: inherit;
    text-align: left;
    -moz-appearance: textfield;
    outline: none;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

    .rp-input::-webkit-outer-spin-button,
    .rp-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .rp-input:hover {
        border-bottom-color: #aaa;
        background-color: rgba(255, 255, 255, 0.05);
    }

    .rp-input:focus {
        color: #eee;
        background-color: rgba(0, 0, 0, 0.2);
        border: 1px solid #007bff;
        border-radius: 3px;
    }

    /* Ïîäñâåòêà èçìåíåííûõ çíà÷åíèé RP */
    .rp-input.rp-modified {
        background-color: rgba(100, 200, 255, 0.15) !important;
        border-bottom-color: #64c8ff !important;
        box-shadow: 0 0 4px rgba(100, 200, 255, 0.4);
    }

        .rp-input.rp-modified:hover {
            background-color: rgba(100, 200, 255, 0.25) !important;
            border-bottom-color: #7dd3ff !important;
        }

        .rp-input.rp-modified:focus {
            background-color: rgba(100, 200, 255, 0.2) !important;
            border: 1px solid #64c8ff !important;
            box-shadow: 0 0 6px rgba(100, 200, 255, 0.6);
        }

/* ==================== ÑÎÅÄÈÍÈÒÅËÜÍÛÅ ËÈÍÈÈ ==================== */
.tree-connections-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

    .tree-connections-overlay svg {
        display: block;
        width: 100%;
        height: 100%;
    }

    .tree-connections-overlay line {
        stroke: rgba(150, 150, 150, 0.6);
        stroke-width: 2;
    }

    .tree-connections-overlay .line-researched {
        stroke: #4CAF50;
        stroke-width: 2.5;
    }

    .tree-connections-overlay .line-researching {
        stroke: #2196F3;
        stroke-width: 2.5;
    }

/* ==================== ÏÀÍÅËÜ ÈÒÎÃÎÂ ==================== */
#summary-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background-color: rgba(40, 40, 40, 0.9);
    backdrop-filter: blur(3px);
    border-top: 1px solid #666;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Èíäèêàòîð çàãðóçêè ñêðèíøîòà */
.screenshot-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: #fff;
}

.screenshot-loading-content {
    text-align: center;
    padding: 20px;
    background-color: rgba(40, 40, 40, 0.9);
    border-radius: 8px;
    border: 1px solid #666;
}

.screenshot-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid #0dcaf0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

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

    100% {
        transform: rotate(360deg);
    }
}

#summary-panel {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 25px;
    flex-shrink: 0;
    padding: 5px 0;
    width: auto;
    color: #eee;
    justify-content: center;
}

    #summary-panel .summary-item {
        display: flex;
        align-items: center;
        font-size: 1.1em;
        font-weight: bold;
        white-space: nowrap;
    }

        #summary-panel .summary-item img {
            width: 24px;
            height: 24px;
            margin-right: 8px;
            vertical-align: middle;
        }

        #summary-panel .summary-item span:first-child {
            margin-right: 5px;
            color: #bbb;
            font-weight: normal;
        }

#selected-names-container {
    display: flex;
    align-items: center;
    width: 90%;
    max-width: 600px;
    gap: 10px;
}

#selected-names-panel {
    color: #ccc;
    font-size: 0.9em;
    text-align: left;
    max-width: 600px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.2em;
    padding-bottom: 5px;
    flex-shrink: 0;
    flex-grow: 1;
    cursor: default;
    min-width: 0;
}

    #selected-names-panel span[title] {
        cursor: help;
        max-width: 600px;
    }

.copy-button {
    padding: 0.1rem 0.4rem;
    line-height: 1;
    flex-shrink: 0;
    background-color: #555;
    border-color: #666;
    color: #eee;
}

    .copy-button:hover {
        background-color: #666;
        border-color: #777;
        color: #fff;
    }

    .copy-button i {
        vertical-align: middle;
    }

/* Ñïåöèàëüíûå ñòèëè äëÿ êíîïîê ñêðèíøîòà */
.screenshot-button {
    background-color: #6f42c1;
    border-color: #6f42c1;
    color: #fff;
}

    .screenshot-button:hover {
        background-color: #5a359a;
        border-color: #5a359a;
        color: #fff;
    }

    .screenshot-button:disabled {
        background-color: #444;
        border-color: #555;
        color: #888;
        cursor: not-allowed;
    }

/* ==================== ÊÍÎÏÊÈ ==================== */
.btn {
    background-color: #444;
    border-color: #555;
    color: #eee;
}

    .btn:hover {
        background-color: #555;
        border-color: #666;
        color: #fff;
    }

.btn-secondary {
    background-color: #555;
    border-color: #666;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: #fff;
}

    .btn-info:hover {
        background-color: #138496;
        border-color: #117a8b;
        color: #fff;
    }

/* ==================== ÑÀÉÄÁÀÐ ==================== */
body .page .sidebar {
    width: 70px !important;
    min-width: 70px !important;
    position: static !important;
    padding-top: 0.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    flex-shrink: 0 !important;
    height: 100vh !important;
    overflow: visible !important;
    background-color: #2a2a2a;
}

    body .page .sidebar .top-row {
        display: none !important;
    }

body .page main {
    flex-grow: 1 !important;
    height: 100vh !important;
    overflow-y: auto !important;
    padding-left: 0 !important;
}

/* ==================== ÇÀÃÐÓÇÊÀ È ÎØÈÁÊÈ ==================== */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #666;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: #eee;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

#blazor-error-ui {
    background: #b32121;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
        color: white;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ==================== ÂÀËÈÄÀÖÈß ==================== */
.validation-message {
    color: #ff6b6b;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #ff6b6b;
}

/* ==================== ÀÄÀÏÒÈÂÍÎÑÒÜ ==================== */
@media (max-width: 767.98px) {
    .top-row {
        justify-content: space-between;
    }

        .top-row a, .top-row .btn-link {
            margin-left: 1.5rem !important;
        }
}

@media (min-width: 641px) {
    body .page .top-row:not(.sidebar .top-row),
    body .page article {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
}
/* ==================== ÏÎËÅ ËÈÌÈÒÀ RP ==================== */
.summary-item.summary-limit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rp-limit-input {
    background-color: #444;
    color: #eee;
    border: 1px solid #666;
    border-radius: 4px;
    padding: 4px 8px;
    width: 80px;
    font-size: 0.9em;
    text-align: center;
    -moz-appearance: textfield;
    outline: none;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

    .rp-limit-input::-webkit-outer-spin-button,
    .rp-limit-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .rp-limit-input:hover {
        border-color: #777;
        background-color: #555;
    }

    .rp-limit-input:focus {
        border-color: #007bff;
        background-color: #555;
        box-shadow: 0 0 4px rgba(0, 123, 255, 0.3);
    }

    .rp-limit-input::placeholder {
        color: #888;
        font-size: 0.8em;
    }

.limit-suffix {
    color: #bbb;
    font-size: 0.9em;
    font-weight: normal;
    margin-left: -4px;
}
/* ==================== ÏÐÅÄÓÏÐÅÆÄÅÍÈÅ Î ËÈÌÈÒÅ ==================== */
.rp-limit-warning {
    background-color: #856404;
    color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 8px 15px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

    .rp-limit-warning i {
        font-size: 1.1em;
        color: #ffeaa7;
    }

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

