/* ==================================================
   PROJECT MANAGER MODAL – Folders & Files layout,
   icons, names, Rename/Delete actions
   ================================================== */

/* --- Modal size --- */
#firebaseExplorerModal .modal-xl-custom {
    max-width: 95%;
    width: 1280px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: 80px auto 20px auto;
}

#firebaseExplorerModal .modal-xl-custom .modal-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#firebaseExplorerModal .modal-body {
    padding: 1rem 1.25rem 1rem 3.5rem;
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* --- Refresh button --- */
#firebaseExplorerModal .refresh-btn {
    position: absolute;
    top: 1rem;
    right: 3rem;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
}
#firebaseExplorerModal .refresh-btn:hover {
    background: #e9ecef;
    color: #212529;
}

/* --- Breadcrumbs --- */
#firebaseExplorerModal .breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.875rem;
}
#firebaseExplorerModal .breadcrumbs button {
    padding: 4px 8px;
    border-radius: 4px;
}

/* --- Two-column layout: Folders | Files --- */
#firebaseExplorerModal .explorer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1rem;
    flex: 1;
    min-height: 0;
}

#firebaseExplorerModal .explorer-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#firebaseExplorerModal .explorer-section .section-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    padding: 0 2px;
}

/* --- List container (search/sort + scrollable list) --- */
#firebaseExplorerModal .explorer-list.with-controls {
    display: flex;
    flex-direction: column;
    min-height: 560px;
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    overflow: hidden;
}

#firebaseExplorerModal .search-sort-container.sticky-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

#firebaseExplorerModal .search-sort-container .search-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 6px 10px;
    font-size: 0.875rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
}

#firebaseExplorerModal .search-sort-container .sort-dropdown {
    min-width: 120px;
    height: 34px;
    padding: 6px 10px;
    font-size: 0.875rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
}

#firebaseExplorerModal .item-list-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
    padding: 8px;
}

/* --- Each row: icon + name + date + actions --- */
#firebaseExplorerModal .item-list-container .project-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid #e0d8c6;
    background: linear-gradient(to right, #faf8f3, #f0ebe0);
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    min-height: 44px;
    box-sizing: border-box;
}

/* When the ... menu is open, bring this row (and its dropdown) above other items */
#firebaseExplorerModal .item-list-container .project-list-item:has(.item-options-menu.active) {
    z-index: 100;
}

#firebaseExplorerModal .item-list-container .project-list-item:hover {
    background: linear-gradient(to right, #f5f0e6, #e8e0d0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

/* Icon: fixed width, centered */
#firebaseExplorerModal .project-list-item .file-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 1.25rem;
}

#firebaseExplorerModal .project-list-item.folder .file-icon,
#firebaseExplorerModal .project-list-item.folder .file-icon i {
    color: #d4a017 !important;
}

#firebaseExplorerModal .project-list-item.file .file-icon,
#firebaseExplorerModal .project-list-item.file .file-icon i {
    color: #0d9488 !important;
}

#firebaseExplorerModal .project-list-item.back-button .file-icon,
#firebaseExplorerModal .project-list-item.back-button .file-icon i {
    color: #6c757d !important;
    font-size: 1.1rem;
}

/* Name: takes remaining space, ellipsis if long */
#firebaseExplorerModal .project-list-item .file-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 8px 0 0;
}

/* Date: small, gray, no shrink */
#firebaseExplorerModal .project-list-item .file-date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions wrapper: ellipsis button + dropdown */
#firebaseExplorerModal .project-list-item .actions {
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
}

/* Ellipsis "…" button */
#firebaseExplorerModal .project-list-item .ellipsis-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#firebaseExplorerModal .project-list-item .ellipsis-btn:hover,
#firebaseExplorerModal .project-list-item .ellipsis-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* Dropdown: Rename / Delete – high z-index so it paints above list items */
#firebaseExplorerModal .project-list-item .item-options-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    min-width: 120px;
    padding: 6px 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    z-index: 200;
    overflow: hidden;
}

#firebaseExplorerModal .project-list-item .item-options-menu.active {
    display: flex;
    flex-direction: column;
}

/* Rename / Delete buttons inside dropdown */
#firebaseExplorerModal .project-list-item .menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #333;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

#firebaseExplorerModal .project-list-item .menu-btn:hover {
    background: #f1f5f9;
}

#firebaseExplorerModal .project-list-item .menu-btn .fa-edit {
    color: #0d9488;
    width: 1em;
}

#firebaseExplorerModal .project-list-item .menu-btn .fa-trash-alt {
    color: #dc3545;
    width: 1em;
}

#firebaseExplorerModal .project-list-item .menu-btn .mr-1 {
    margin-right: 0.35rem;
}

/* Back button row (slightly different look) */
#firebaseExplorerModal .project-list-item.back-button {
    background: #e9ecef;
    border-color: #ced4da;
}

#firebaseExplorerModal .project-list-item.back-button:hover {
    background: #dee2e6;
}

#firebaseExplorerModal .project-list-item.back-button .file-date {
    display: none;
}

#firebaseExplorerModal .project-list-item.back-button .actions {
    display: none;
}

/* Loading spinner in list */
#firebaseExplorerModal .loading-indicator-container,
#firebaseExplorerModal .spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6c757d;
    min-height: 120px;
}

#firebaseExplorerModal .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 123, 255, 0.2);
    border-left-color: #007bff;
    border-radius: 50%;
    animation: pm-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes pm-spin {
    to { transform: rotate(360deg); }
}

/* Action buttons below lists */
#firebaseExplorerModal .explorer-action-button {
    width: 90%;
    margin-left: 5%;
    margin-top: 0.75rem;
    padding: 10px 16px;
    font-weight: 500;
    border-radius: 8px;
}

#firebaseExplorerModal .create-folder-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    border: none;
}

#firebaseExplorerModal .create-folder-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
}

#firebaseExplorerModal .save-btn {
    background: linear-gradient(135deg, #667eea, #5a67d8);
    color: #fff;
    border: none;
}

#firebaseExplorerModal .save-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #4c51bf);
    color: #fff;
}

/* --- Responsive: narrow viewports --- */
@media (max-width: 768px) {
    #firebaseExplorerModal .modal-xl-custom {
        width: 100%;
        max-height: 85vh;
        margin: 10px auto;
    }

    #firebaseExplorerModal .explorer-content {
        grid-template-columns: 1fr;
    }

    #firebaseExplorerModal .explorer-list.with-controls {
        min-height: 320px;
    }
}

@media (max-width: 480px) {
    #firebaseExplorerModal .modal-xl-custom {
        margin: 5px auto;
    }

    #firebaseExplorerModal .modal-body {
        padding: 0.75rem 1rem 0.75rem 1rem;
    }

    #firebaseExplorerModal .refresh-btn {
        right: 1rem;
    }

    #firebaseExplorerModal .explorer-list.with-controls {
        min-height: 260px;
    }
}
