/* ============================================
   CHAT UI - FANFIX-INSPIRED DESIGN
   Dark Theme + Soulmate Pink Accent
   With Light Mode Support
   ============================================ */

/* ========================================
   CSS VARIABLES - LIGHT THEME (Default)
   ======================================== */

:root {
    /* Light backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #e8e8e8;
    --bg-input: #f0f0f0;
    --bg-bubble-received: #e8e8e8;
    --bg-bubble-sent: linear-gradient(135deg, #E91E63 0%, #C2185B 100%);

    /* Text colors */
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-accent: #E91E63;

    /* Accent colors - Soulmate Pink */
    --accent-primary: #E91E63;
    --accent-secondary: #F06292;
    --accent-light: rgba(233, 30, 99, 0.1);
    --accent-glow: rgba(233, 30, 99, 0.2);

    /* Status colors */
    --status-online: #4CAF50;
    --status-unread: #7C4DFF;
    --status-quiz: #FF9800;

    /* Borders */
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;

    /* Shadows */
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(233, 30, 99, 0.15);

    /* Sizing */
    --header-height: 60px;
    --input-height: 70px;
    --nav-height: 65px;
    --avatar-size: 48px;
    --avatar-small: 40px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ========================================
   CSS VARIABLES - DARK THEME
   ======================================== */

[data-theme="dark"] {
    /* Align with theme-system.css dark surfaces */
    --bg-primary: var(--app-bg, #0D0A0F);
    --bg-secondary: var(--app-surface, #161218);
    --bg-tertiary: var(--app-surface-2, #1C1620);
    --bg-input: #201A26;
    --bg-bubble-received: #1C1428;
    --bg-bubble-sent: linear-gradient(135deg, #E91E63 0%, #C2185B 100%);

    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #B0B0B0;
    --text-muted: #666666;
    --text-accent: #E91E63;

    /* Borders */
    --border-color: var(--app-border, #2E2433);
    --border-light: var(--border-light, #382C40);

    /* Shadows */
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(233, 30, 99, 0.2);
}

/* ========================================
   GLOBAL RESETS FOR CHAT
   ======================================== */

#chatScreen,
#chatScreen * {
    box-sizing: border-box;
}

#chatScreen {
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================
   MESSAGES SCREEN (Kontaktliste - Bild 2)
   ======================================== */

#profileSelection {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
}

/* Messages Header */
.messages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.messages-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.messages-header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.messages-header-btn:hover {
    background: var(--bg-tertiary);
}

.messages-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.messages-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-badge {
    position: relative;
}

.notification-badge .badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--status-unread);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Search Bar */
.messages-search {
    padding: 12px 20px;
    background: var(--bg-primary);
}

.messages-search-input {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
}

.messages-search-input svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.messages-search-input input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: var(--text-primary);
}

.messages-search-input input::placeholder {
    color: var(--text-muted);
}

/* Filter Dropdown */
.messages-filter {
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.messages-filter svg {
    width: 16px;
    height: 16px;
}

/* Contact List */
.contact-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(var(--nav-height) + 20px);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.contact-item:hover {
    background: var(--bg-secondary);
}

.contact-item:active {
    background: var(--bg-tertiary);
}

/* Contact Avatar */
.contact-avatar {
    position: relative;
    flex-shrink: 0;
}

.contact-avatar-img {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: var(--radius-full);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: white;
    overflow: hidden;
    position: relative;
}

.contact-unread-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background: var(--status-unread);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-primary);
}

/* Contact Info */
.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.contact-name h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.contact-verified {
    color: var(--accent-primary);
    font-size: 14px;
}

.contact-preview {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contact Meta */
.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.contact-time {
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   CHAT SCREEN (Bild 1)
   ======================================== */

#actualChat {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
}

/* ═══════════════════════════════════════════
   CHAT HEADER V2 — Single-row with inline level
   ═══════════════════════════════════════════ */

.chat-hdr {
    flex-shrink: 0;
    z-index: 5;
    background: var(--bg-primary, #0D0A0F);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
}

/* Gradient shimmer bottom edge */
.chat-hdr::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(233, 30, 99, 0.3), rgba(124, 77, 255, 0.2), transparent);
}

/* ── Single row: Back · Avatar · Name · Level · Menu ── */
.chat-hdr-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 6px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
}

.chat-hdr-back {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary, #B0B0B0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.chat-hdr-back:active { background: rgba(255,255,255,0.06); }

.chat-hdr-partner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 1;
}

/* Avatar + online dot */
.chat-hdr-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-hdr-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 10px rgba(233, 30, 99, 0.2);
}

.chat-hdr-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success-color, #66BB6A);
    border: 2px solid var(--bg-primary, #0D0A0F);
}

.chat-hdr-partner-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.chat-hdr-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.chat-hdr-status {
    font-size: 11px;
    font-weight: 500;
    color: var(--success-color, #66BB6A);
    line-height: 1;
}

/* ── Inline Level Badge (right of name) ── */
.chat-hdr-lvl {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.1), rgba(124, 77, 255, 0.08));
    border: 1px solid rgba(233, 30, 99, 0.2);
    border-radius: 22px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    margin-left: auto;
    box-shadow: 0 2px 12px rgba(233, 30, 99, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.chat-hdr-lvl:active {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.15), rgba(124, 77, 255, 0.12));
    transform: scale(0.97);
}

/* Gradient number circle */
.chat-hdr-lvl-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #E91E63), var(--secondary-color, #7C4DFF));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(233, 30, 99, 0.35);
}

.chat-hdr-lvl-num {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

/* Name + progress bar */
.chat-hdr-lvl-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 50px;
    max-width: 85px;
}

.chat-hdr-lvl-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-hdr-lvl-bar {
    width: 100%;
    height: 3.5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.chat-hdr-lvl-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary-color, #E91E63), var(--primary-light, #F06292));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
    box-shadow: 0 0 6px rgba(233, 30, 99, 0.3);
}

/* Next-level hint */
.chat-hdr-lvl-next {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    display: none;
}
@media (min-width: 380px) {
    .chat-hdr-lvl-next { display: block; }
}

/* ── Actions (3-dot menu) ── */
.chat-hdr-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.chat-hdr-menu-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-tertiary, #808080);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.chat-hdr-menu-btn:active {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary, #fff);
}

/* ── Dropdown menu ── */
.chat-hdr-dropdown {
    display: none;
    position: absolute;
    right: 14px;
    top: 52px;
    background: var(--bg-secondary, #161218);
    border: 1px solid var(--border-color, #2E2433);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255,255,255,0.03);
    z-index: 9999;
    min-width: 180px;
    overflow: hidden;
    animation: hdrDropIn 0.18s ease-out;
}
.chat-hdr-dropdown[style*="display: block"],
.chat-hdr-dropdown.open {
    display: block;
}
@keyframes hdrDropIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-hdr-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary, #fff);
    transition: background 0.12s;
}
.chat-hdr-dropdown-item:active {
    background: rgba(255,255,255,0.05);
}
.chat-hdr-dropdown-danger {
    color: #ff5c5c;
}

/* ── Level color theming ── */
.chat-hdr[data-level="1"] .chat-hdr-lvl-icon { background: linear-gradient(135deg, #78909C, #546E7A); box-shadow: 0 2px 8px rgba(120, 144, 156, 0.25); }
.chat-hdr[data-level="1"] .chat-hdr-lvl-fill { background: linear-gradient(90deg, #78909C, #90A4AE); box-shadow: 0 0 6px rgba(120, 144, 156, 0.3); }
.chat-hdr[data-level="1"] .chat-hdr-lvl { border-color: rgba(120, 144, 156, 0.2); background: linear-gradient(135deg, rgba(120, 144, 156, 0.1), rgba(84, 110, 122, 0.06)); box-shadow: 0 2px 12px rgba(120, 144, 156, 0.1); }
.chat-hdr[data-level="1"]::after { background: linear-gradient(90deg, transparent, rgba(120, 144, 156, 0.25), transparent); }

.chat-hdr[data-level="2"] .chat-hdr-lvl-icon { background: linear-gradient(135deg, #7C4DFF, #651FFF); box-shadow: 0 2px 10px rgba(124, 77, 255, 0.35); }
.chat-hdr[data-level="2"] .chat-hdr-lvl-fill { background: linear-gradient(90deg, #7C4DFF, #B388FF); box-shadow: 0 0 6px rgba(124, 77, 255, 0.3); }
.chat-hdr[data-level="2"] .chat-hdr-lvl { border-color: rgba(124, 77, 255, 0.2); background: linear-gradient(135deg, rgba(124, 77, 255, 0.1), rgba(101, 31, 255, 0.06)); box-shadow: 0 2px 12px rgba(124, 77, 255, 0.1); }
.chat-hdr[data-level="2"] .chat-hdr-avatar { box-shadow: 0 2px 10px rgba(124, 77, 255, 0.25); }
.chat-hdr[data-level="2"]::after { background: linear-gradient(90deg, transparent, rgba(124, 77, 255, 0.3), transparent); }

.chat-hdr[data-level="3"] .chat-hdr-lvl-icon { background: linear-gradient(135deg, #E91E63, #C2185B); box-shadow: 0 2px 10px rgba(233, 30, 99, 0.35); }
.chat-hdr[data-level="3"] .chat-hdr-lvl-fill { background: linear-gradient(90deg, #E91E63, #F06292); box-shadow: 0 0 6px rgba(233, 30, 99, 0.3); }
.chat-hdr[data-level="3"] .chat-hdr-lvl { border-color: rgba(233, 30, 99, 0.2); background: linear-gradient(135deg, rgba(233, 30, 99, 0.1), rgba(194, 24, 91, 0.06)); box-shadow: 0 2px 12px rgba(233, 30, 99, 0.1); }
.chat-hdr[data-level="3"]::after { background: linear-gradient(90deg, transparent, rgba(233, 30, 99, 0.35), transparent); }

.chat-hdr[data-level="4"] .chat-hdr-lvl-icon { background: linear-gradient(135deg, #FF6F00, #E65100); box-shadow: 0 2px 10px rgba(255, 111, 0, 0.35); }
.chat-hdr[data-level="4"] .chat-hdr-lvl-fill { background: linear-gradient(90deg, #FF6F00, #FFB74D); box-shadow: 0 0 6px rgba(255, 111, 0, 0.3); }
.chat-hdr[data-level="4"] .chat-hdr-lvl { border-color: rgba(255, 111, 0, 0.2); background: linear-gradient(135deg, rgba(255, 111, 0, 0.1), rgba(230, 81, 0, 0.06)); box-shadow: 0 2px 12px rgba(255, 111, 0, 0.1); }
.chat-hdr[data-level="4"] .chat-hdr-avatar { box-shadow: 0 2px 10px rgba(255, 111, 0, 0.25); }
.chat-hdr[data-level="4"]::after { background: linear-gradient(90deg, transparent, rgba(255, 111, 0, 0.3), transparent); }

.chat-hdr[data-level="5"] .chat-hdr-lvl-icon { background: linear-gradient(135deg, #FFD700, #FFC107); box-shadow: 0 2px 12px rgba(255, 215, 0, 0.4); }
.chat-hdr[data-level="5"] .chat-hdr-lvl-fill { background: linear-gradient(90deg, #FFD700, #FFF176); box-shadow: 0 0 6px rgba(255, 215, 0, 0.3); }
.chat-hdr[data-level="5"] .chat-hdr-lvl { border-color: rgba(255, 215, 0, 0.25); background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 193, 7, 0.06)); box-shadow: 0 2px 12px rgba(255, 215, 0, 0.12); }
.chat-hdr[data-level="5"] .chat-hdr-avatar { box-shadow: 0 2px 10px rgba(255, 215, 0, 0.25); }
.chat-hdr[data-level="5"] .chat-hdr-lvl-next { display: none !important; }

/* ── Hidden compat elements ── */
.chat-partner-handle { display: none !important; }

/* ── Level Ring (used in modals, hidden in header) ── */
.level-badge-ring {
    position: relative;
    width: 38px;
    height: 38px;
}

.level-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.level-ring-bg {
    stroke: var(--bg-tertiary, #1a1a1a);
}

.level-ring-fill {
    stroke: #E91E63;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s ease;
}

.level-badge-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #E91E63;
    line-height: 1;
}

/* Level colors per level (for modals) */
.level-badge-ring[data-level="1"] .level-ring-fill { stroke: #78909C; }
[data-level="1"] .level-badge-number { color: #78909C; }

.level-badge-ring[data-level="2"] .level-ring-fill { stroke: #7C4DFF; }
[data-level="2"] .level-badge-number { color: #7C4DFF; }

.level-badge-ring[data-level="3"] .level-ring-fill { stroke: #E91E63; }
[data-level="3"] .level-badge-number { color: #E91E63; }

.level-badge-ring[data-level="4"] .level-ring-fill { stroke: #FF6F00; }
[data-level="4"] .level-badge-number { color: #FF6F00; }

.level-badge-ring[data-level="5"] .level-ring-fill { stroke: #FFD700; }
[data-level="5"] .level-badge-number { color: #FFD700; }

/* ── Level Detail Modal ── */
.level-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 10, 15, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.level-detail-overlay.active { display: flex; }

.level-detail-sheet {
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    background: linear-gradient(165deg, #1C1424 0%, #160F1E 40%, #12101A 100%);
    border-radius: 24px 24px 0 0;
    overflow-y: auto;
    animation: levelSheetUp 0.32s cubic-bezier(0.34, 1.1, 0.64, 1) both;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(233, 30, 99, 0.12);
    box-shadow: 0 -8px 40px rgba(233, 30, 99, 0.08);
}

@keyframes levelSheetUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.level-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 12px;
    position: sticky;
    top: 0;
    background: linear-gradient(165deg, #1C1424 0%, #160F1E 100%);
    z-index: 1;
}

.level-detail-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.level-detail-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.level-detail-close:hover { background: rgba(255,255,255,0.15); }

.level-detail-body {
    padding: 8px 22px 32px;
}

/* Current level hero */
.level-hero {
    text-align: center;
    padding: 24px 0 28px;
}

.level-hero-ring {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
}
.level-hero-ring .level-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.level-hero-ring .level-ring-bg { stroke: rgba(255,255,255,0.08); stroke-width: 4; }
.level-hero-ring .level-ring-fill { stroke-width: 4; stroke-linecap: round; }
.level-hero-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: #E91E63;
}

.level-hero-name {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
}

.level-hero-progress-text {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin: 0 0 16px;
}

.level-hero-bar {
    width: 80%;
    max-width: 260px;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
}

.level-hero-bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #E91E63, #F06292);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Level roadmap */
.level-roadmap {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.level-roadmap-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    position: relative;
}

.level-roadmap-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 52px;
    bottom: -14px;
    width: 2px;
    background: rgba(255,255,255,0.06);
}

.level-roadmap-item.completed:not(:last-child)::after {
    background: rgba(233, 30, 99, 0.3);
}

.level-roadmap-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.level-roadmap-item.completed .level-roadmap-dot {
    background: linear-gradient(135deg, #E91E63, #C2185B);
    color: #fff;
    box-shadow: 0 2px 12px rgba(233, 30, 99, 0.35);
}

.level-roadmap-item.current .level-roadmap-dot {
    background: rgba(233, 30, 99, 0.15);
    color: #E91E63;
    border: 2px solid #E91E63;
    box-shadow: 0 0 16px rgba(233, 30, 99, 0.25);
    animation: currentLevelPulse 2s ease-in-out infinite;
}

@keyframes currentLevelPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(233, 30, 99, 0.2); }
    50%      { box-shadow: 0 0 20px rgba(233, 30, 99, 0.4); }
}

.level-roadmap-item.locked .level-roadmap-dot {
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.08);
}

.level-roadmap-info {
    flex: 1;
    min-width: 0;
}

.level-roadmap-name {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px;
}

.level-roadmap-item.completed .level-roadmap-name { color: #fff; }
.level-roadmap-item.current .level-roadmap-name { color: #E91E63; }
.level-roadmap-item.locked .level-roadmap-name { color: rgba(255,255,255,0.3); }

.level-roadmap-sub {
    font-size: 12px;
    margin: 0;
    color: rgba(255,255,255,0.4);
}

.level-roadmap-item.current .level-roadmap-sub { color: rgba(233, 30, 99, 0.6); }
.level-roadmap-item.locked .level-roadmap-sub { color: rgba(255,255,255,0.2); }

.level-roadmap-check {
    font-size: 16px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   Profile Card Modal — Redesign v4
   Cover image layout, site-consistent typography
   ══════════════════════════════════════════════ */

.profile-card-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    background: var(--bg-primary, #0D0A0F);
    z-index: 9500;
    display: none;
    flex-direction: column;
}

@media (max-width: 767px) {
    .profile-card-overlay { left: 0; right: 0; }
}

@media (min-width: 768px) {
    .profile-card-overlay {
        width: calc(100vh * 9 / 16);
        max-width: 100vw;
        left: 50%;
        transform: translateX(-50%);
    }
    .profile-card-overlay.active {
        animation: pcSlideInDesktop 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    @keyframes pcSlideInDesktop {
        from { opacity: 0; transform: translateX(-50%) scale(0.97); }
        to   { opacity: 1; transform: translateX(-50%) scale(1); }
    }
}

.profile-card-overlay.active {
    display: flex;
    animation: pcSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pcSlideIn {
    from { transform: translateX(40%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

.profile-card-sheet {
    width: 100%;
    height: 100%;
    background: var(--bg-primary, #0D0A0F);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ── Topbar (floating over cover) ── */
.pc-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    background: transparent;
    z-index: 20;
    pointer-events: none;
}

.pc-topbar-back {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    pointer-events: auto;
}
.pc-topbar-back:active {
    background: rgba(0, 0, 0, 0.55);
    transform: scale(0.9);
}

.pc-topbar-title { display: none; }
.pc-topbar-spacer { width: 40px; flex-shrink: 0; }

/* ── Scroll Area ── */
.profile-card-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* ── Hero Cover Image (tap to view full) ── */
.pc-cover {
    width: 100%;
    height: 52vh;
    min-height: 320px;
    max-height: 480px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #1a1028, #120e1a);
    flex-shrink: 0;
}

.pc-cover-img {
    position: absolute;
    inset: 0;
}

.pc-cover-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom,
            rgba(13, 10, 15, 0.1) 0%,
            transparent 20%,
            transparent 40%,
            rgba(13, 10, 15, 0.25) 55%,
            rgba(13, 10, 15, 0.65) 72%,
            rgba(13, 10, 15, 0.92) 86%,
            var(--bg-primary, #0D0A0F) 100%);
    pointer-events: none;
}

.pc-cover-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 24px 20px;
    z-index: 2;
    pointer-events: none;
}

.pc-name {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.3px;
    line-height: 1.15;
}

.pc-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

/* ── Header (unused — kept for compat) ── */
.pc-header { display: none; }

/* ── Avatar (unused — kept for compat) ── */
.pc-avatar-row { display: none; }
.pc-avatar { display: none; }
.pc-avatar-tap-hint { display: none; }
.pc-avatar-meta { display: none; }
.pc-avatar-name { display: none; }
.pc-avatar-handle { display: none; }

/* ── Body ── */
.pc-body {
    padding: 20px 24px 40px;
}

.pc-section {
    margin-bottom: 24px;
}

.pc-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--text-muted, rgba(255, 255, 255, 0.3));
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pc-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--app-border-subtle, rgba(255, 255, 255, 0.06)), transparent);
}

.pc-bio {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    margin: 0;
}

/* ── Tags ── */
.pc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pc-tag {
    padding: 7px 14px;
    border-radius: 20px;
    background: rgba(233, 30, 99, 0.08);
    border: 1px solid rgba(233, 30, 99, 0.15);
    font-size: 13px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.65));
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}
.pc-tag:active {
    background: rgba(233, 30, 99, 0.15);
    border-color: rgba(233, 30, 99, 0.3);
}

/* ── Stats ── */
.pc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.pc-stat {
    text-align: center;
    padding: 16px 12px;
    border-radius: var(--border-radius-md, 12px);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--app-border-subtle, rgba(255, 255, 255, 0.05));
}
.pc-stat:active {
    background: rgba(255, 255, 255, 0.06);
}

.pc-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color, #E91E63);
    display: block;
    margin-bottom: 4px;
    line-height: 1;
}

.pc-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted, rgba(255, 255, 255, 0.3));
}

.pc-divider {
    height: 1px;
    background: var(--app-border-subtle, rgba(255, 255, 255, 0.05));
    margin: 8px 0 24px;
}

/* ── Action Bar ── */
.pc-action-bar {
    flex-shrink: 0;
    padding: 12px 24px calc(14px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, var(--bg-primary, #0D0A0F) 60%, rgba(13, 10, 15, 0.95) 80%, transparent);
    position: relative;
}

.pc-action-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--border-radius-lg, 20px);
    border: none;
    background: linear-gradient(135deg, #E91E63 0%, #D81558 50%, #C2185B 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.pc-action-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
    border-radius: var(--border-radius-lg, 20px);
}
.pc-action-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 12px rgba(233, 30, 99, 0.35);
}

/* ── Profile Image Fullscreen Lightbox (UNCHANGED) ── */
.pc-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: background 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s;
    -webkit-tap-highlight-color: transparent;
}
.pc-lightbox-overlay.active {
    background: rgba(0, 0, 0, 0.96);
    opacity: 1;
    pointer-events: auto;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.pc-lightbox-img {
    max-width: 92%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
    transform: scale(0.85);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s;
    user-select: none;
    -webkit-user-select: none;
}
.pc-lightbox-overlay.active .pc-lightbox-img {
    transform: scale(1);
    opacity: 1;
}

.pc-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    top: calc(16px + env(safe-area-inset-top, 0px));
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}
.pc-lightbox-close:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.9);
}

.pc-lightbox-hint {
    position: absolute;
    bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 0.5s 0.4s;
    pointer-events: none;
}
.pc-lightbox-overlay.active .pc-lightbox-hint {
    opacity: 1;
}

/* Chat Tabs (like Fanfix) */
.chat-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.chat-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.chat-tab:hover {
    color: var(--text-primary);
}

.chat-tab.active {
    color: var(--accent-primary);
}

.chat-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 1px;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary);
}

/* Date Separator */
.message-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.message-date-separator span {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 0 12px;
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
    /* animation entfernt – nur .new-message animiert (chat-vibe.css) */
}

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

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.received {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.message.sent .message-avatar {
    display: none;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    position: relative;
}

.message.received .message-bubble {
    background: var(--bg-bubble-received);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message.sent .message-bubble {
    background: var(--bg-bubble-sent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble p {
    margin: 0 0 6px 0;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    display: block;
    text-align: right;
}

/* ========================================
   CHAT INPUT AREA (Fanfix-Style)
   ======================================== */

.chat-input-area {
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Main Input Field */
.chat-input-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    min-height: 44px;
}

.chat-input-field input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: var(--text-primary);
}

.chat-input-field input::placeholder {
    color: var(--text-muted);
}

/* Input Actions (GIF, Send inside field) */
.input-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.input-action-btn:hover {
    color: var(--accent-primary);
}

.input-action-btn.send-btn {
    color: var(--accent-primary);
}

/* Joker Button (right side, like gift icon in Fanfix) */
.card-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    border: 2px solid var(--accent-primary);
    background: transparent;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.card-btn:hover {
    background: var(--accent-light);
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

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

/* Input Footer Info */
.chat-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    font-size: 12px;
}

.char-counter {
    color: var(--text-muted);
}

.free-messages {
    color: var(--accent-primary);
    font-weight: 500;
}

.free-messages strong {
    color: var(--text-primary);
}

/* ========================================
   BOTTOM NAVIGATION (Dark Theme)
   ======================================== */

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 16px;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
    border-radius: var(--radius-md);
}

.nav-item:hover {
    color: var(--text-secondary);
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
}

.nav-item span {
    font-size: 11px;
    font-weight: 500;
}

/* ========================================
   SPACING ADJUSTMENTS
   ======================================== */

#chatScreen {
    padding-bottom: var(--nav-height);
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 600px) {
    :root {
        --avatar-size: 44px;
        --avatar-small: 36px;
    }

    .contact-item {
        padding: 12px 16px;
    }

    .message {
        max-width: 85%;
    }

    .chat-input-field {
        padding: 8px 12px;
    }

    .card-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    animation: pulse 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.contact-item:focus,
.chat-hdr-back:focus,
.card-btn:focus,
.nav-item:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ========================================
   OVERRIDE OLD STYLES
   ======================================== */

#chatScreen,
#profileSelection,
#actualChat {
    background: var(--bg-primary) !important;
}

#actualChat .chat-messages {
    background: var(--bg-primary) !important;
}

/* Hide old soulmate progress bar */
.soulmate-progress,
.soulmate-rank-bar {
    display: none !important;
}

/* Level badge always visible in header */
.chat-hdr .chat-hdr-lvl {
    display: flex !important;
}
