/* LINGXI Profile Management Space (Modal System) */

/* --- Mask & Container --- */
.profile-modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 2147483646 !important; /* Second Highest Z-Index possible */
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.profile-modal-mask.show {
    display: block !important;
    opacity: 1 !important;
}

/* --- Main Modal (Level 1) --- */
.profile-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 900px;
    height: 650px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    display: none;
    z-index: 2147483647 !important; /* Highest Z-Index possible in browser */
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-modal-container.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, -50%) scale(1);
}

/* --- Standalone Mode (No Sidebar) --- */
.profile-modal-container.pm-mode-standalone .pm-sidebar {
    display: none !important;
}
.profile-modal-container.pm-mode-standalone {
    width: 700px; /* Narrower for focused tasks */
    height: auto;
    max-height: 85vh;
}

/* --- Modal Layout --- */
.pm-header {
    height: 64px;
    flex-shrink: 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background: #fff;
}
.pm-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}
.pm-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    color: #94a3b8;
}
.pm-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

.pm-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* --- Sidebar in Modal --- */
.pm-sidebar {
    width: 220px;
    background: #f8fafc;
    border-right: 1px solid #f1f5f9;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pm-nav-item {
    padding: 12px 16px;
    border-radius: 12px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pm-nav-item:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.pm-nav-item.active {
    background: #fff;
    color: var(--profile-primary, #4f46e5);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* --- Content Area --- */
.pm-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: #fff;
}

/* --- Component Library (Grid) --- */
.pm-component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.pm-comp-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    cursor: grab;
    transition: all 0.2s;
    position: relative;
    background: #fff;
}
.pm-comp-card:hover {
    border-color: var(--profile-primary, #4f46e5);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}
.pm-comp-icon {
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: #64748b;
}
.pm-comp-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}
.pm-comp-desc {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
}
.pm-comp-action {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    transition: all 0.2s;
}
.pm-comp-card.added .pm-comp-action {
    background: var(--profile-primary, #4f46e5);
    border-color: var(--profile-primary, #4f46e5);
    color: #fff;
}

/* --- Upload Area --- */
.pm-upload-zone {
    border: 2px dashed #e2e8f0;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    color: #64748b;
    transition: all 0.2s;
    background: #f8fafc;
    cursor: pointer;
}
.pm-upload-zone:hover {
    border-color: var(--profile-primary, #4f46e5);
    background: #eef2ff;
    color: var(--profile-primary, #4f46e5);
}
