/* ============================================================
   PHANTOM MSG — Vault Module Styles
   File manager cifrado con carpetas anidadas
   ============================================================ */

/* Folder color classes */
.vault-fc0 { --vf-color: var(--note-color-0); }
.vault-fc1 { --vf-color: var(--note-color-1); }
.vault-fc2 { --vf-color: var(--note-color-2); }
.vault-fc3 { --vf-color: var(--note-color-3); }
.vault-fc4 { --vf-color: var(--note-color-4); }
.vault-fc5 { --vf-color: var(--note-color-5); }
.vault-fc6 { --vf-color: var(--note-color-6); }
.vault-fc7 { --vf-color: var(--note-color-7); }
.vault-fc8 { --vf-color: var(--note-color-8); }

/* ---- CONTAINER ---- */
#panel-vault.tool-panel {
    max-width: 100%;
    padding: 16px 24px;
}

.vault-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 12px;
    overflow-y: auto;
}

/* ---- HEADER ---- */
.vault-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.vault-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #F0F4F8);
    margin: 0;
}

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

.vault-btn-icon {
    background: var(--bg-card, #151D30);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    color: var(--text-secondary, #8B9BB4);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.vault-btn-icon:hover {
    background: var(--primary-400, #2DD4BF);
    color: #fff;
}

/* ---- STORAGE BAR ---- */
.vault-storage-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.vault-storage-track {
    flex: 1;
    height: 6px;
    background: var(--bg-card, #151D30);
    border-radius: 3px;
    overflow: hidden;
    display: flex;
}

.vault-storage-fill {
    height: 100%;
    background: var(--primary-400, #2DD4BF);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.vault-storage-fill-hidden {
    height: 100%;
    background: #e05252;
    border-radius: 0 3px 3px 0;
    transition: width 0.3s ease;
    opacity: 0.7;
}

.vault-storage-text {
    font-size: 0.72rem;
    color: var(--text-secondary, #8B9BB4);
    white-space: nowrap;
}

/* ---- BREADCRUMB ---- */
.vault-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    overflow-x: auto;
    padding: 2px 0;
}

.vault-crumb {
    background: none;
    border: none;
    color: var(--text-secondary, #8B9BB4);
    font-size: 0.82rem;
    font-family: var(--font-display, inherit);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.vault-crumb:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #F0F4F8);
}

.vault-crumb:last-child {
    color: var(--primary-400, #2DD4BF);
    font-weight: 600;
}

.vault-crumb-sep {
    color: var(--text-secondary, #8B9BB4);
    font-size: 0.75rem;
    user-select: none;
}

/* ---- SEARCH ---- */
.vault-search-wrap {
    position: relative;
    flex-shrink: 0;
}

.vault-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #5A6A80);
    pointer-events: none;
}

.vault-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-input, #111B2E);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 8px;
    color: var(--text-primary, #F0F4F8);
    font-family: var(--font-display, inherit);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.vault-search-input:focus {
    border-color: var(--primary-400, #2DD4BF);
}

.vault-search-input::placeholder {
    color: var(--text-muted, #5A6A80);
}

/* ---- FILTERS ---- */
.vault-filters {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    overflow-x: auto;
    padding: 2px 0;
    -webkit-overflow-scrolling: touch;
}

.vault-filter {
    background: var(--bg-card, #151D30);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    color: var(--text-secondary, #8B9BB4);
    font-family: var(--font-display, inherit);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.vault-filter:hover {
    border-color: var(--primary-400, #2DD4BF);
    color: var(--text-primary, #F0F4F8);
}

.vault-filter.active {
    background: var(--primary-100, rgba(20,184,166,0.12));
    border-color: var(--primary-400, #2DD4BF);
    color: var(--primary-400, #2DD4BF);
}

/* ---- CONTENT ---- */
.vault-content {
    flex: 1;
    overflow-y: auto;
}

/* ---- LIST VIEW (default) ---- */
.vault-list-view {
    display: flex !important;
    flex-direction: column;
    gap: 2px;
}

/* ---- GRID VIEW ---- */
.vault-grid-view {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    align-content: start;
}

.vault-grid-view .vault-item {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.vault-grid-view .vault-item:hover {
    border-color: var(--primary-400, #2DD4BF);
    background: none;
}

.vault-grid-view .vault-item-check {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    padding: 0;
}

.vault-grid-view .vault-item-main {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 28px 10px 10px;
    gap: 6px;
}

.vault-grid-view .vault-item-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.vault-grid-view .vault-item-name {
    font-size: 0.75rem;
    justify-content: center;
    text-align: center;
    word-break: break-all;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.vault-grid-view .vault-item-meta {
    font-size: 0.68rem;
    text-align: center;
}

.vault-grid-view .vault-item-menu {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 4px 6px;
    z-index: 2;
}

/* ---- VAULT ITEM (folder/file row) ---- */
.vault-item {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    border-radius: 10px;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.vault-item:hover {
    background: rgba(255,255,255,0.06);
}

.vault-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 10px 4px 10px 12px;
    cursor: pointer;
}

.vault-item-menu {
    background: none;
    border: none;
    color: var(--text-secondary, #8B9BB4);
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.vault-item-menu:hover {
    color: var(--text-primary, #F0F4F8);
    background: rgba(255,255,255,0.08);
}

.vault-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-card, #151D30);
    color: var(--text-secondary, #8B9BB4);
}

.vault-folder-icon {
    background: rgba(45,212,191,0.12);
    color: var(--vf-color, var(--primary-400, #2DD4BF));
}

.vault-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vault-item-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary, #F0F4F8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vault-item-meta {
    font-size: 0.72rem;
    color: var(--text-secondary, #8B9BB4);
}

.vault-item-badge {
    font-size: 10px;
    flex-shrink: 0;
}

/* ---- EMPTY STATE ---- */
.vault-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-secondary, #8B9BB4);
    flex: 1;
}

.vault-empty p { margin: 0; font-size: 0.9rem; }

.vault-empty-actions {
    display: flex;
    gap: 10px;
}

.vault-empty-btn {
    background: var(--primary-400, #2DD4BF);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s;
}

.vault-empty-btn:hover { opacity: 0.85; }

/* ---- UPLOAD PROGRESS ---- */
.vault-upload-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    flex-shrink: 0;
}

.vault-upload-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-card, #151D30);
    border-radius: 2px;
    overflow: hidden;
}

.vault-upload-fill {
    height: 100%;
    background: var(--primary-400, #2DD4BF);
    border-radius: 2px;
    transition: width 0.2s;
}

.vault-upload-text {
    font-size: 0.72rem;
    color: var(--text-secondary, #8B9BB4);
    white-space: nowrap;
}

/* ---- DRAG & DROP OVERLAY ---- */
.vault-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(45,212,191,0.12);
    border: 2px dashed var(--primary-400, #2DD4BF);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 50;
    color: var(--primary-400, #2DD4BF);
    pointer-events: none;
}

.vault-drop-overlay p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ---- CONTEXT MENU ---- */
.vault-ctx-menu {
    position: fixed;
    background: var(--bg-elevated, #1A2440);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    border-radius: 10px;
    padding: 6px;
    min-width: 160px;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.vault-ctx-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--text-primary, #F0F4F8);
    font-family: var(--font-display, inherit);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    text-align: left;
}

.vault-ctx-menu button:hover {
    background: rgba(255,255,255,0.08);
}

.vault-ctx-menu button svg {
    color: var(--text-secondary, #8B9BB4);
    flex-shrink: 0;
}

.vault-ctx-danger { color: #e05252 !important; }
.vault-ctx-danger svg { color: #e05252 !important; }

/* ---- MOBILE ---- */
@media (max-width: 768px) {
    .vault-container { padding: 12px; }

    #panel-vault {
        padding: 0 !important;
        padding-bottom: 70px !important;
    }

    .vault-item-main { padding: 8px 4px 8px 10px; }
    .vault-item-icon { width: 36px; height: 36px; border-radius: 8px; }

    .vault-grid-view {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .vault-grid-view .vault-item-main { padding: 24px 8px 8px; }
    .vault-grid-view .vault-item-icon { width: 38px; height: 38px; }
}

/* ---- PRIVACY MODE — Blur names until hover ---- */
.vault-privacy .vault-item-name,
.vault-privacy .vault-item-meta {
    filter: blur(6px);
    user-select: none;
    -webkit-user-select: none;
    transition: filter 0.25s ease;
}

.vault-privacy .vault-item:hover .vault-item-name,
.vault-privacy .vault-item:hover .vault-item-meta {
    filter: blur(0);
}

.vault-privacy .vault-item-icon {
    opacity: 0.4;
    transition: opacity 0.25s ease;
}

.vault-privacy .vault-item:hover .vault-item-icon {
    opacity: 1;
}

.vault-btn-icon.active {
    background: var(--primary-100, rgba(20,184,166,0.12));
    color: var(--primary-400, #2DD4BF);
    border-color: var(--primary-400, #2DD4BF);
}

/* ---- LIGHTBOX ---- */
.vault-lightbox {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.vault-lb-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.2s;
}

.vault-lb-close:hover {
    background: rgba(255,255,255,0.2);
}

.vault-lb-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.vault-lb-info {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- ITEM CHECKBOX ---- */
.vault-item-check {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px 0 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.vault-item-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-400, #2DD4BF);
    cursor: pointer;
}

.vault-selected {
    background: rgba(45,212,191,0.08) !important;
    border-left: 3px solid var(--primary-400, #2DD4BF);
}

.vault-grid-view .vault-selected {
    border-left: 1px solid var(--primary-400, #2DD4BF);
    border-color: var(--primary-400, #2DD4BF) !important;
    box-shadow: 0 0 0 1px var(--primary-400, #2DD4BF);
}

/* ---- SELECTION BAR ---- */
.vault-selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-card, #151D30);
    border: 1px solid var(--primary-400, rgba(45,212,191,0.3));
    border-radius: 10px;
    padding: 8px 12px;
    flex-shrink: 0;
}

.vault-sel-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-400, #2DD4BF);
    white-space: nowrap;
}

.vault-sel-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.vault-sel-actions button {
    background: var(--bg-card, #151D30);
    border: 1px solid var(--border, rgba(255,255,255,0.06));
    color: var(--text-primary, #F0F4F8);
    font-family: var(--font-display, inherit);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.vault-sel-actions button:hover { background: rgba(255,255,255,0.12); }

.vault-sel-danger {
    color: #e05252 !important;
    border-color: rgba(224,82,82,0.3) !important;
}
.vault-sel-danger:hover { background: rgba(224,82,82,0.12) !important; }

/* ---- FOLDER PICKER (Move modal) ---- */
.vault-pick-list {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.vault-pick-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-primary, #F0F4F8);
    transition: background 0.15s;
}

.vault-pick-item:hover { background: rgba(45,212,191,0.12); }

.vault-pick-icon { font-size: 18px; flex-shrink: 0; }

.vault-pick-sub {
    font-size: 0.72rem;
    color: var(--text-secondary, #8B9BB4);
}

/* ---- SHARE MODAL EXTRAS ---- */
.vault-share-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary, #8B9BB4);
    margin-bottom: 4px;
}

.vault-share-url-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.vault-share-url-wrap input {
    flex: 1;
    min-width: 0;
}

.vault-share-copy {
    background: var(--primary-400, #2DD4BF);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.vault-share-copy:hover { opacity: 0.85; }

/* ============================================================ */
/* SHARES MANAGEMENT MODAL — v1.10.21                            */
/* ============================================================ */

.vault-shares-modal-box {
    max-width: 640px;
    width: 90vw;
}

.vault-shares-list {
    max-height: 60vh;
    overflow-y: auto;
    margin: 0;
    padding: 0;
}

.vault-shares-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.vault-share-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
    align-items: flex-start;
}

.vault-share-item:last-child {
    border-bottom: none;
}

.vault-share-info {
    flex: 1;
    min-width: 0;
}

.vault-share-name {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 4px;
    word-break: break-word;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vault-share-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.vault-share-url {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: 4px;
    background: var(--bg-elevated, rgba(0,0,0,0.2));
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vault-share-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.vault-share-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.15));
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.vault-share-btn:hover {
    background: var(--bg-hover, rgba(255,255,255,0.05));
}

.vault-share-btn-danger {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
}

.vault-share-btn-danger:hover {
    background: rgba(255, 107, 107, 0.1);
}

.vault-share-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.vault-share-active {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.vault-share-expired {
    background: rgba(149, 165, 166, 0.2);
    color: #95a5a6;
}

.vault-share-exhausted {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
}

/* ============================================================ */
/* CLOSE FOLDER LOCK BUTTON — v1.10.21                           */
/* ============================================================ */

.vault-crumb-close-lock {
    margin-left: auto;
    padding: 4px 10px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px;
    background: transparent;
    color: #ff6b6b;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.vault-crumb-close-lock:hover {
    background: rgba(255, 107, 107, 0.1);
}

.vault-crumb-lock {
    font-size: 0.85em;
    margin-left: 2px;
    opacity: 0.85;
}
