﻿/* Базовые стили дерева */
.tree, .tree ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

    .tree li {
        margin: 0;
    }

/* Переключатель папки */
.folder-toggle {
    cursor: pointer;
    user-select: none;
    font-weight: bold;
    display: inline-block;
    padding: 2px 0;
}

    .folder-toggle::before {
        content: "▼ ";
        color: #555;
    }

    .folder-toggle.collapsed::before {
        content: "▶ ";
    }

.folder-content {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease-out, opacity 0.2s ease-out;
    opacity: 1;
}

    .folder-content.collapsed {
        grid-template-rows: 0fr;
        opacity: 0;
        pointer-events: none;
    }

    .folder-content > ul {
        margin-left: 20px;
        padding: 0;
        list-style-type: none;
        overflow: hidden;
        min-height: 0;
    }

/* Стили элементов файлов */
.file-item {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

.file-info-block {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 15px;
}

.file-item:hover {
    background-color: #f0f4f8;
}

.file-item > span:first-child {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .btnSignCrypto {
    background-color: #3182ce;
    color: white;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

    .file-item .btnSignCrypto:hover:not([disabled]) {
        background-color: #2b6cb0;
    }

    .file-item .btnSignCrypto:disabled {
        background-color: #e2e8f0;
        color: #a0aec0;
        cursor: not-allowed;
        box-shadow: none;
    }

.file-size {
    color: #718096;
    font-size: 0.85em;
    margin-left: 8px;
    flex-shrink: 0;
}

.btn-delete {
    background-color: #fff;
    color: #e53e3e;
    border: 1px solid #fed7d7;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
}

    .btn-delete:hover {
        background-color: #fff5f5;
        border-color: #feb2b2;
        color: #c53030;
    }

.file-link {
    color: #0066cc;
    text-decoration: none;
    cursor: pointer;
}

    .file-link:hover {
        text-decoration: underline;
    }

.btn-zip {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 15px;
    transition: background 0.2s;
}

    .btn-zip:hover {
        background-color: #218838;
        text-decoration: none;
        color: white;
    }

.cert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.15s ease-in-out;
}

    .cert-item:last-child {
        border-bottom: none;
    }

    .cert-item:hover {
        background-color: #f1f5f9;
        color: #0f172a;
        padding-left: 18px;
    }

    .cert-item.active {
        background-color: #eff6ff !important;
        color: #1d4ed8 !important;
        font-weight: 500;
        border-left: 3px solid #3b82f6;
        padding-left: 15px;
    }

.file-actions {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    flex-wrap: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

    .file-actions button {
        margin: 0 !important;
        white-space: nowrap;
        box-sizing: border-box;
    }

    .file-actions div[id^="result-"] {
        display: inline-block;
        vertical-align: middle;
    }

.file-result {
    flex-basis: 100%;
    text-align: right;
    padding-top: 8px;
    min-height: 20px;
}

@media (min-width: 768px) {
    .file-item {
        flex-wrap: nowrap !important;
    }

    .file-actions {
        flex-basis: auto !important;
        justify-content: flex-end !important;
        margin-top: 0 !important;
        flex-wrap: nowrap !important;
    }

    .file-result {
        flex-basis: auto;
        padding-top: 0;
        padding-left: 10px;
        text-align: left;
    }
}

select {
    width: 100% !important;
}

/* Доп. стили для детальной dropZone (взяты из Create) */
#dropZone {
    border: 2px dashed #cbd5e1;
    background-color: #fafafa;
    border-radius: 8px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    height: -webkit-fill-available;
    /* Центрирование содержимого */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Задаёт минимальную высоту для корректного вертикального центрирования */
    min-height: 160px;
}

    #dropZone:hover {
        border-color: #3b82f6;
        background-color: #f0f9ff;
    }

.choose-menu {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(2,6,23,0.08);
    display: flex;
    gap: 10px;
    padding: 10px;
    z-index: 30;
}

    .choose-menu button {
        padding: 8px 12px;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        font-weight: 600;
    }

    .choose-menu .btn-file {
        background: linear-gradient(90deg,#3b82f6,#2563eb);
        color: white;
    }

    .choose-menu .btn-folder {
        background: linear-gradient(90deg,#10b981,#059669);
        color: white;
    }

/* Выравнивание кнопки ZIP: слева на малых экранах, справа на больших */
.zip-actions {
    margin-top: 15px;
    text-align: left; /* по умолчанию — слева */
}

/* Для больших экранов (>=768px) выравниваем вправо */
@media (min-width: 768px) {
    .zip-actions {
        text-align: right;
    }
        /* Если внутри есть inline-flex элементы — дополнительно выравниваем их корректно */
        .zip-actions > * {
            display: inline-block;
            vertical-align: middle;
        }
}

.remove-signer {
    padding: 3px;
    margin: 3px !important;
    --bs-btn-bg: #d7959b !important;
}
