/* ========================================== */
/* КРАТКОЕ ОГЛАВЛЕНИЕ                         */
/* ========================================== */
/*
 * ФАЙЛ: logo.css
 * НАЗНАЧЕНИЕ: Стилизация панели управления сервисом с индикатором-замком
 *
 * СОДЕРЖАНИЕ:
 * 1. .service-control - Секция управления сервисом
 * 2. .service-control__logo - Контейнер замка + «Рабочий стол»
 * 3. .service-control__title - Подпись «Рабочий стол»
 * 4. .storage-indicator-wrap / .storage-indicator — замок (% заполнения)
 * 5. .service-control__actions / .service-control__btn — кнопки справа
 *
 * ОСОБЕННОСТИ:
 * - Индикатор = точный силуэт lock.svg (mask) + заливка по %
 * - Текст % в центре корпуса; «Рабочий стол» на одной линии с %
 * - Линия-соединитель от замка до хранилища (ПК и мобильная)
 * - Hover: жёлтое свечение
 */
/* ========================================== */

/* ========== SERVICE CONTROL STYLES ==========*/

.service-control {
    max-width: 1000px;
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 50px;
    position: relative;
}

/* Логотип: замок + подпись */
.service-control__logo {
    display: flex;
    align-items: flex-start; /* «Рабочий стол» выравниваем с % внутри корпуса */
    gap: 10px;
    flex-shrink: 0;
}

/*
 * lock.svg: корпус-круг, центр ~65% высоты.
 * «Рабочий стол» — середина строки на одной линии с серединой %.
 */
.service-control__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--title-text);
    margin: 0;
    /* lock 44px → центр % ≈ 28px; половина строки 7px → 21px */
    margin-top: 21px;
    height: 14px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1;
}

/* Обёртка замка + линия вниз к хранилищу */
.storage-indicator-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 44px;
    padding-top: 0;
}

.storage-indicator-wrap::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 1px;
    height: 20px; /* = margin-bottom .service-control на десктопе */
    background-color: var(--card-border);
    pointer-events: none;
    z-index: 0;
}

/* Контейнер: заливка (::before + mask lock.svg) + % поверх */
.storage-indicator {
    position: relative;
    width: 44px;
    height: 44px;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    display: block;
    flex-shrink: 0;
    cursor: default;
    z-index: 1;
    transition: filter 0.3s ease;
    overflow: visible;
    --lock-fill: linear-gradient(90deg, #7fc241 0%, #1a6b6d 0%);
}

.storage-indicator::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--lock-fill);
    -webkit-mask-image: url('../lock.svg');
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-image: url('../lock.svg');
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    z-index: 0;
    pointer-events: none;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* % в центре сплошного корпуса — цифра и % с зазором 1px */
.storage-indicator__value {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 53%;
    height: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    margin: 0;
    padding: 0;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
    font-variant-numeric: tabular-nums;
}

.storage-indicator__num {
    letter-spacing: 0;
}

.storage-indicator__pct {
    margin-left: 0;
    font-size: 0.85em;
}

.storage-indicator:hover {
    filter: drop-shadow(0 0 3px var(--yellow-btn)) drop-shadow(0 0 10px rgba(252, 233, 74, 0.65));
    cursor: pointer;
}

/* ========================================== */
/* ПАНЕЛЬ ХРАНИЛИЩА (DOM-элемент, не ::after) */
/* ========================================== */

.storage-panel {
    position: fixed;
    z-index: 99999;
    width: 240px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
    display: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.storage-panel--visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.storage-panel:not(.storage-panel--visible) {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

.storage-panel__section--free {
    background: linear-gradient(135deg, #0d2a2b 0%, #1a4a4c 100%);
    padding: 14px 16px 12px;
}

.storage-panel__section--files {
    background: linear-gradient(135deg, #111827 0%, #1e2d40 100%);
    padding: 12px 16px 14px;
}

.storage-panel__section--local {
    background: linear-gradient(135deg, #1e1535 0%, #2d1f50 100%);
    padding: 12px 16px 14px;
}

.storage-panel__section--local .storage-panel__section-title {
    color: #b388ff;
}

.storage-panel__section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 10px;
}

.storage-panel__section--free .storage-panel__section-title {
    color: #7fc241;
}

.storage-panel__section--files .storage-panel__section-title {
    color: #5bb3d0;
}

.storage-panel__section-icon {
    display: flex;
    align-items: center;
    opacity: 0.9;
}

.storage-panel__limit-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: none;
    letter-spacing: 0;
}

.storage-panel__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.storage-panel__row-icon {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.storage-panel__row-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    flex: 1;
}

.storage-panel__row-value {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
}

.storage-panel__progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.storage-panel__progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    overflow: hidden;
}

.storage-panel__progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease, background 0.4s ease;
}

.storage-panel__percent {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    min-width: 28px;
    text-align: right;
}

.service-control__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 50px;
}

.service-control__btn {
    width: 32px;
    height: 32px;
    color: var(--orange-icon);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.service-control__btn:hover {
    transform: rotate(15deg) scale(1.1);
}

/* ========================================== */
/* RESPONSIVE - МОБИЛЬНАЯ АДАПТАЦИЯ           */
/* ========================================== */

@media (max-width: 880px) {
    .service-control {
        padding: 0 5px;
        margin: 10px 0;
        max-width: none;
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        gap: 9px;
        align-items: center;
        box-sizing: border-box;
    }

    .service-control__logo {
        gap: 6px;
        flex: 0 0 auto;
        order: 1;
        align-items: flex-start;
    }

    .service-control__title {
        display: flex;
        align-items: center;
        font-size: 13px; /* +2px к прежним 11px */
        font-weight: 600;
        max-width: none;
        white-space: nowrap;
        line-height: 1;
        margin-top: 14px;
        height: 13px;
    }

    .storage-indicator-wrap {
        width: 32px;
        padding-top: 0;
    }

    .storage-indicator-wrap::after {
        width: 1px;
        /* margin .service-control = 10px + 2px, чтобы дотянуть до карточки */
        height: 12px;
    }

    .storage-indicator {
        width: 32px;
        height: 32px;
    }

    .storage-indicator__value {
        left: 0;
        right: 0;
        top: 52%;
        height: 24%;
        font-size: 8px;
        letter-spacing: 0;
        gap: 1px;
    }

    .service-control__actions {
        gap: 0;
        margin-left: 0;
        margin-right: 0;
        flex: 0 0 auto;
        order: 3;
    }

    .service-control__btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 490px) {
    .service-control {
        padding: 0 5px;
        margin: 10px 0;
        width: 100%;
        gap: 8px;
        box-sizing: border-box;
    }

    .service-control__logo {
        gap: 5px;
        align-items: flex-start;
    }

    .service-control__title {
        display: flex;
        align-items: center;
        font-size: 12px; /* +2px к прежним 10px */
        max-width: none;
        white-space: nowrap;
        margin-top: 14px;
        height: 12px;
    }

    .storage-indicator-wrap {
        width: 32px;
        padding-top: 0;
    }

    .storage-indicator-wrap::after {
        width: 1px;
        /* margin .service-control = 10px + 2px, чтобы дотянуть до карточки */
        height: 12px;
    }

    .storage-indicator {
        width: 32px;
        height: 32px;
    }

    .storage-indicator__value {
        left: 0;
        right: 0;
        top: 52%;
        height: 24%;
        font-size: 8px;
        letter-spacing: 0;
        gap: 1px;
    }

    .service-control__actions {
        gap: 0;
    }

    .service-control__btn {
        width: 32px;
        height: 32px;
    }
}
