/**
 * USER PROFILE PANEL - Overlay Side Panel Styles
 * Displays user profiles in a right-sliding overlay panel
 * Follows chat panel pattern for consistency
 */

/* ============================================
   OVERLAY BACKDROP
   ============================================ */
.profilePanelOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10100; /* Above chat panel (9998) */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.profilePanelOverlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   SIDE PANEL
   ============================================ */
.profilePanelSidePanel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1175px;
    max-width: 90vw;
    background: #F7F8FA;
    z-index: 10103; /* Above chat panel (10001) */
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

.profilePanelSidePanel.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ============================================
   HEADER
   ============================================ */
.profilePanelHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #1775FF 0%, #0056D2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    min-height: 4rem;
}

.profilePanelHeaderActions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profilePanelHeaderTitle {
    flex: 1;
    margin: 0;
    padding: 0 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Close Button */
.profilePanelClose {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 3rem;
    height: 3rem;
    border-radius: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    line-height: 1;
}

.profilePanelClose:hover {
    background: rgba(255, 255, 255, 0.3);
    /*transform: rotate(90deg);*/
}

.profilePanelClose:active {
    transform: rotate(90deg) scale(0.95);
}

/* Back Button */
.profilePanelBackBtn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
}

.profilePanelBackBtn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.profilePanelBackBtn:active {
    transform: scale(0.95);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.profilePanelContentArea {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar */
.profilePanelContentArea::-webkit-scrollbar {
    width: 8px;
}

.profilePanelContentArea::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.profilePanelContentArea::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.profilePanelContentArea::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   STATES
   ============================================ */
.profilePanelLoading,
.profilePanelError {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    min-height: 300px;
}

.profilePanelLoading {
    color: #1775FF;
}

/* ============================================
   SKELETON LOADER ANIMATION
   ============================================ */
@keyframes skeleton-shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: skeleton-shimmer 2s infinite linear;
}

.skeleton-box {
    background-color: #e5e7eb;
}

.profilePanelError {
    color: #DC2626;
}

.profilePanelError i {
    margin-bottom: 1rem;
}

.profilePanelError h3 {
    margin: 1rem 0 0.5rem;
}

.profilePanelError p {
    margin: 0.5rem 0 1.5rem;
}

.profilePanelError button {
    transition: all 0.2s ease;
}

.profilePanelError button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.profilePanelError button:active {
    transform: translateY(0);
}

.profilePanelContent {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.profilePanelHidden {
    display: none !important;
}

/* ============================================
   BODY SCROLL LOCK
   ============================================ */
body.profilePanelOpen,
html.profilePanelOpen {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile devices */
@media (max-width: 768px) {
    .profilePanelSidePanel {
        width: 100vw;
        max-width: 100vw;
    }

    .profilePanelHeader {
        padding: 0.75rem 1rem;
    }

    .profilePanelHeaderTitle {
        font-size: 1.25rem;
        padding: 0 0.5rem;
    }

    .profilePanelClose {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 2rem;
    }

    .profilePanelBackBtn {
        min-width: 2rem;
        height: 2rem;
        padding: 0.25rem 0.5rem;
        font-size: 1.25rem;
    }
}

/* Tablet devices */
@media (min-width: 769px) and (max-width: 1024px) {
    .profilePanelSidePanel {
        width: 900px;
    }
}

/* Large desktop */
@media (min-width: 1440px) {
    .profilePanelSidePanel {
        width: 1200px;
    }
}

/* ============================================
   PROFILE CONTENT ADJUSTMENTS
   ============================================ */

/* Remove extra padding from profile content when in overlay */
.profilePanelContent .container {
    max-width: 100%;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus styles */
.profilePanelClose:focus,
.profilePanelBackBtn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .profilePanelOverlay,
    .profilePanelSidePanel,
    .profilePanelClose,
    .profilePanelBackBtn,
    .profilePanelContent {
        transition: none;
    }

    .profilePanelClose:hover,
    .profilePanelBackBtn:active {
        transform: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .profilePanelOverlay {
        background-color: rgba(0, 0, 0, 0.8);
    }

    .profilePanelSidePanel {
        border-left: 2px solid #000;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .profilePanelOverlay,
    .profilePanelSidePanel {
        display: none !important;
    }
}
