@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100..900&display=swap');

* {
    font-family: "Montserrat", sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: rgb(24, 24, 24);
    min-height: 100vh;
    color: white;
    position: relative;
    padding: 30px;
}

/* Фоновый водяной знак БОРЩ */
body::before {
    content: "БОРЩ";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28vw;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.03);
    z-index: -1;
    pointer-events: none;
}

.dashboard-wrapper {
    max-width: 1000px;
    margin: 0 auto;
}

/* Хедер панели */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-bottom: 30px;
}

.dash-header .logo {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Общий стиль стеклянных контейнеров */
.tile {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

/* БЛОК 1: Стили топ панели */
.tile-top-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 20px;
}

/* Зона действий (кнопки в один ряд) */
.action-buttons-zone {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
}

.action-buttons-zone .glass-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 14px;
}

.label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.balance-zone .value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.active-subs-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.sub-tag {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
}

.panel-footer-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.referral-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.referral-box code {
    color: #4ade80;
    font-family: monospace;
    font-size: 14px;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s;
}
.icon-btn:hover { transform: scale(1.15); }

/* БЛОК 2: Дерево (Аккордеоны) */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-left: 5px;
}

.protocols-tree {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.protocol-node {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.protocol-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.protocol-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.protocol-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.protocol-info .arrow {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.3s;
}

.protocol-info h4 {
    font-size: 16px;
    font-weight: 600;
}

/* Статус-бейджи на узлах */
.status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
}
.status-badge.paid { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.status-badge.not-paid { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.6); }

/* Раскрываемый контент */
.protocol-content {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Когда узел открыт */
.protocol-node.active {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.protocol-node.active .protocol-content {
    max-height: 500px; /* С запасом для списка */
    padding: 0 20px 20px 20px;
    opacity: 1;
    pointer-events: all;
}

.node-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

/* Элементы внутри дерева (конфиги) */
.configs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.server-name {
    font-size: 14px;
}

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

.buy-inside-zone {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Кнопки */
.glass-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.95);
    color: #181818;
}
.btn-primary:hover { background: #fff; transform: translateY(-1px); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }

.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .panel-main-info { flex-direction: column; gap: 15px; }
    .config-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .config-actions { width: 100%; justify-content: flex-start; }
    .action-buttons-zone { flex-direction: column; }
}

.subs-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 280px;
    margin-top: 10px;
}

.sub-item-progress {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sub-info-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4e50, #f9d423); /* #! Заглушка градиента БОРЩА, можно поменять на свой */
    width: 0%; /* Меняется через JS */
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* Изменение структуры кнопок копирования */
.config-actions .glass-btn {
    margin-left: 5px;
}

/* Выравнивание заголовка дерева и кнопки создания */
.tree-header-zone {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.tree-header-zone .section-title {
    margin-bottom: 0; /* Сбрасываем нижний отступ */
}

#create-protocol-btn {
    width: 100%;
    height: 50px;
    font-size: large;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #221d1d;
}

#create-protocol-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* --- СТИЛИ МЕТАДАННЫХ И ТУЛТИПОВ --- */

.protocol-meta-bar {
    display: flex;
    gap: 25px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    flex-wrap: wrap;
}

.meta-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.badges-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Бейджи технологий */
.tech-badge {
    position: relative;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tech-badge:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Тултипы при наведении */
.has-tooltip[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.has-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Контейнеры-заглушки под твои изображения/SVG */
.icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.icon-placeholder img, 
.icon-placeholder svg {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* --- КАРТОЧКА ПОДКЛЮЧЕНИЯ (СЕРВЕРА) --- */

.config-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 14px 20px;
    border-radius: 14px;
    transition: all 0.25s ease;
}

.config-item-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.config-main-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.config-flag {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.config-node-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.95);
}

.btn-connect {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-connect:hover {
    box-shadow: 0 6px 18px rgba(255, 255, 255, 0.2);
}