/**
 * PROFILE MODAL - Apple-Style Sidebar
 * Version: 1.0.0
 *
 * Verhält sich wie "Eigene Rubrik" analysis-sidebar:
 * - Desktop (≥768px): Slide-in von rechts, Apple Back-Button
 * - Mobile (<768px): Drag-Handler, Vertikale Tabs
 * - Glassmorphic Design
 * - 100dvh Support (Safari/Chrome Fix)
 */

/* ============================================================
   BASE STYLES - Profile Modal Container
   ============================================================ */

.profile-modal {
    position: fixed;
    top: 0;
    right: -100%;
    width: calc(100vw - 80px); /* ✅ RESPONSIVE: Desktop Large (≥1440px) = 80px Sidebar */
    height: 100vh; /* Fallback */
    height: 100dvh; /* Dynamic Viewport Height (Safari Fix) */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -2px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 1002; /* Über analysis-sidebar (1001) */
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Open State */
.profile-modal.open {
    right: 0;
}

/* Info-Sidebar bleibt sichtbar UND klickbar */
body.profile-modal-open .info-sidebar {
    z-index: 1003; /* ✅ FIX: ÜBER profile-modal (1002) */
    pointer-events: auto; /* Ensure clicks work */
}

/* ============================================================
   DRAG HANDLE (Mobile <768px)
   ============================================================ */

.profile-drag-handle {
    display: none; /* Hidden on Desktop */
    padding: 12px 0;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
}

.drag-handle-bar {
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    margin: 0 auto;
    transition: background 0.2s ease;
}

.profile-drag-handle:active {
    cursor: grabbing;
}

.profile-drag-handle:hover .drag-handle-bar {
    background: rgba(0, 0, 0, 0.35);
}

/* ============================================================
   HEADER (Desktop ≥768px: Apple Back-Button)
   ============================================================ */

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.profile-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.profile-back-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.profile-back-btn:active {
    transform: scale(0.95);
}

.profile-back-btn svg {
    stroke: #0077B6;
    stroke-width: 2.5;
}

.profile-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -0.03em;
}

/* ============================================================
   TABS NAVIGATION (Desktop: Horizontal)
   ============================================================ */

.profile-tabs {
    display: flex;
    gap: 12px;
    padding: 16px 32px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.profile-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 12px 12px 0 0;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.profile-tab:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #0077B6;
}

.profile-tab.active {
    color: #0077B6;
    font-weight: 600;
}

.profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #00b8d9 0%, #0077b6 50%, #003566 100%);
    border-radius: 2px 2px 0 0;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */

.profile-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px;
}

.profile-tab-content {
    display: none;
}

.profile-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   USER INFO CARD (Glassmorphic)
   ============================================================ */

.user-info-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
}

.user-info-header {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.user-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b8d9 0%, #0077b6 50%, #003566 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 119, 182, 0.25);
}

.user-avatar-initials {
    font-size: 32px;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
}

.user-info-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}

.user-info-label {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-info-value {
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
}

/* ============================================================
   PASSWORD CHANGE BUTTON
   ============================================================ */

.profile-change-password-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #00b8d9 0%, #0077b6 50%, #003566 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(0, 119, 182, 0.25);
}

.profile-change-password-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 182, 0.35);
}

.profile-change-password-btn:active:not(:disabled) {
    transform: translateY(0);
}

.profile-change-password-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================================================
   PLACEHOLDER (Empty Tabs)
   ============================================================ */

.profile-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 32px;
    color: #666;
}

.profile-placeholder svg {
    stroke: #00b8d9;
    margin-bottom: 24px;
}

.profile-placeholder h4 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px;
}

.profile-placeholder p {
    font-size: 15px;
    color: #666;
    margin: 0;
}

/* ============================================================
   RESPONSIVE WIDTH ADJUSTMENTS
   ============================================================ */

/* Desktop Medium: <1440px → 70px Sidebar */
@media (max-width: 1440px) {
    .profile-modal {
        width: calc(100vw - 70px);
    }
}

/* Tablet: <1024px → 60px Sidebar */
@media (max-width: 1024px) {
    .profile-modal {
        width: calc(100vw - 60px);
    }
}

/* ============================================================
   MOBILE STYLES (<768px)
   ============================================================ */

@media (max-width: 767px) {
    /* Mobile: 60px Sidebar */
    .profile-modal {
        width: calc(100vw - 60px);
    }

    /* Show Drag Handle */
    .profile-drag-handle {
        display: block;
    }

    /* Hide Apple Back-Button */
    .profile-back-btn {
        display: none;
    }

    /* Header Compact */
    .profile-header {
        padding: 16px 24px 12px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .profile-title {
        font-size: 24px;
    }

    /* Tabs: Vertical Layout (wie Eigene Rubrik) */
    .profile-tabs {
        flex-direction: column;
        gap: 8px;
        padding: 16px 16px 8px;
        border-bottom: none;
    }

    .profile-tab {
        width: 100%;
        padding: 12px 16px;
        border-radius: 10px;
        text-align: left;
    }

    .profile-tab.active::after {
        display: none;
    }

    .profile-tab.active {
        background: rgba(0, 119, 182, 0.08);
    }

    /* Content Padding */
    .profile-content {
        padding: 20px 16px;
    }

    /* User Info Card */
    .user-info-card {
        padding: 24px;
    }

    .user-avatar-large {
        width: 64px;
        height: 64px;
    }

    .user-avatar-initials {
        font-size: 26px;
    }

    .user-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .user-info-label {
        font-size: 12px;
    }

    .user-info-value {
        font-size: 15px;
    }

    /* Password Button */
    .profile-change-password-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Small Phones (<430px) */
@media (max-width: 429px) {
    /* Small Mobile: 50px Sidebar */
    .profile-modal {
        width: calc(100vw - 50px);
    }

    .profile-header {
        padding: 12px 16px 10px;
    }

    .profile-title {
        font-size: 22px;
    }

    .profile-tabs {
        padding: 12px 12px 6px;
    }

    .profile-content {
        padding: 16px 12px;
    }

    .user-info-card {
        padding: 20px;
    }
}

/* ============================================================
   100DVH SUPPORT (Safari/Chrome Fix)
   ============================================================ */

@supports (height: 100dvh) {
    .profile-modal {
        height: 100dvh;
    }
}
