/**
 * RIFT - Topbar Styles
 */

/* Top Bar - Floating Elements */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: transparent;
    position: relative;
    z-index: 500;
}

/* Einheitliche Höhe für alle Elemente */
.topbar__search,
.topbar__room,
.topbar__room-badge,
.topbar__room-create,
.topbar__party,
.topbar__action,
.topbar__icons,
.topbar__user {
    height: 48px;
    box-sizing: border-box;
}

/* Search - Pill Shape */
.topbar__search {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}

.topbar__search:focus-within {
    background: var(--bg-elevated);
    border-color: var(--accent);
}

.topbar__search-icon {
    width: 18px;
    height: 18px;
    margin-left: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.topbar__search-input {
    width: 160px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

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

.topbar__search-btn {
    padding: 8px 18px;
    margin: 6px;
    background: var(--hover-bg);
    border: none;
    border-radius: 50px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.topbar__search-btn:hover {
    background: var(--active-bg);
}

/* Room Code Badge */
.topbar__room-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.topbar__room-badge:hover {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--border-hover);
}

.topbar__room-badge.copied {
    border-color: var(--success);
    color: var(--success);
}

.topbar__room-badge svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Room Container with Dropdown */
.topbar__room {
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
}

.topbar__room-chevron {
    width: 14px;
    height: 14px;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
}

.topbar__room-badge.open .topbar__room-chevron {
    transform: rotate(180deg);
}

.topbar__room-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: #1b1b1b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.topbar__room-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.topbar__room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.topbar__room-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.topbar__room-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

.topbar__room-item:hover svg {
    opacity: 1;
}

.topbar__room-item--danger {
    color: #ef4444;
}

.topbar__room-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.topbar__room-item--danger svg {
    color: #ef4444;
}

.topbar__room-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

/* Room Create Button */
.topbar__room-create {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 48px;
    background: var(--bg-card);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topbar__room-create:hover {
    background: rgba(255, 70, 85, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.topbar__room-create svg {
    width: 16px;
    height: 16px;
}

/* Main Action Button - Pill Shape */
.topbar__action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px 6px 6px;
    background: rgba(255, 70, 85, 0.2);
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.topbar__action:hover {
    background: rgba(255, 70, 85, 0.3);
}

.topbar__action:active {
    transform: scale(0.98);
}

/* Session Status (replaces action button when session active) */
.topbar__session-area {
    display: flex;
    align-items: center;
}

.topbar__session-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 12px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 50px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.topbar__session-status:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
}

.topbar__session-status--live {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
}

.topbar__session-status--live .topbar__session-dot {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: topbar-pulse 2s ease-in-out infinite;
}

.topbar__session-status--paused {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}

.topbar__session-status--paused:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
}

.topbar__session-status--paused .topbar__session-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
    animation: none;
}

.topbar__session-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

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

.topbar__session-timer {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: rgba(255, 255, 255, 0.9);
}

.topbar__session-name {
    color: rgba(255, 255, 255, 0.7);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar__session-arrow {
    opacity: 0.5;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.topbar__session-status:hover .topbar__session-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.topbar__action-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
}

.topbar__action-icon {
    width: 18px;
    height: 18px;
}

/* Spacer */
.topbar__spacer {
    flex: 1;
}

/* Icon Buttons Group - Pill Container */
.topbar__icons {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
}

.topbar__icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.topbar__icon-btn:hover {
    background: var(--hover-bg);
    color: var(--text);
}

/* GM Icon - Grün */
.topbar__icon-btn--gm {
    color: #4caf50;
}

.topbar__icon-btn--gm:hover {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
}

.topbar__icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Clock Display */
.topbar__clock {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 12px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 4px;
}

/* Notification Badge */
.topbar__icon-btn--notifications .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* Divider - just spacing now */
.topbar__divider {
    width: 8px;
}

/* User Profile - Pill Shape */
.topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px 6px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.topbar__user:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.topbar__avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.topbar__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.topbar__avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent;
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.topbar__user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.topbar__user-name {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

.topbar__user-status {
    display: none;
}

.topbar__user-chevron {
    width: 16px;
    height: 16px;
    color: #ffffff;
    transition: transform 0.2s;
}

.topbar__user:hover .topbar__user-chevron {
    transform: rotate(180deg);
}

/* User Dropdown */
.topbar__user-wrapper {
    position: relative;
    z-index: 9000;
}

.topbar__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 9000;
    box-shadow: var(--shadow-lg);
}

.topbar__user-wrapper:hover .topbar__dropdown,
.topbar__dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.topbar__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
    pointer-events: auto;
}

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

.topbar__dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.topbar__dropdown-divider {
    height: 1px;
    margin: 8px 0;
    background: var(--border);
}

.topbar__dropdown-item--danger {
    color: var(--accent);
}

.topbar__dropdown-item--danger:hover {
    background: var(--red-dim);
}

/* Topbar Divider Line */
.topbar-divider {
    margin: 25px 24px 0 24px;
    height: 1px;
    background: var(--border);
}

/* Mobile Menu Toggle */
.topbar__menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.topbar__menu-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.topbar__menu-toggle:active {
    transform: scale(0.95);
}

.topbar__menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .topbar__menu-toggle {
        display: flex;
    }
    
    .topbar {
        padding: 12px 16px;
        gap: 8px;
        z-index: 100; /* Niedriger als Sidebar auf Mobile */
    }
    
    .topbar__search-input {
        width: 100px;
    }
    
    .topbar__search-btn {
        display: none;
    }
    
    .topbar__action span {
        display: none;
    }
    
    /* Action Button rund auf Mobile (kein Ei) */
    .topbar__action {
        padding: 0;
        width: 48px;
        height: 48px;
        justify-content: center;
        border-radius: 50%;
    }
    
    .topbar__action-icon-wrap {
        margin: 0;
    }
    
    .topbar__session-status {
        padding: 6px 10px;
        gap: 8px;
    }
    
    .topbar__session-name {
        display: none;
    }
    
    .topbar__session-arrow {
        display: none;
    }
    
    /* Room Badge kompakter */
    .topbar__room-badge span {
        display: none;
    }
    
    .topbar__room-badge {
        padding: 0 12px;
        min-width: auto;
    }
    
    .topbar__room-badge code {
        font-size: 12px;
        letter-spacing: 0.5px;
    }
    
    .topbar__user-info {
        display: none;
    }
    
    .topbar__user {
        padding: 4px;
    }
    
    .topbar__user-chevron {
        display: none;
    }
    
    /* Party Badge - gleiche Farbe wie andere Elemente */
    .topbar__party-badge {
        background: transparent;
        border-color: var(--border);
        padding: 0 12px;
    }
    
    .topbar__party-badge span {
        font-size: 12px;
    }
    
    /* Party Dropdown - nicht aus dem Bild */
    .topbar__party-dropdown {
        right: 0;
        left: auto !important;
        transform: translateY(-10px) !important;
        max-width: calc(100vw - 32px);
        width: 260px;
    }
    
    .topbar__party-dropdown.open {
        transform: translateY(0) !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .topbar {
        padding: 10px 12px;
        gap: 6px;
    }
    
    .topbar__menu-toggle {
        width: 44px;
        height: 44px;
    }
    
    .topbar__search {
        display: none;
    }
    
    .topbar__icons {
        padding: 3px;
    }
    
    .topbar__icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .topbar__icon-btn svg {
        width: 18px;
        height: 18px;
    }
    
    /* Action Button kleiner aber rund */
    .topbar__action {
        width: 44px;
        height: 44px;
    }
    
    .topbar__action-icon-wrap {
        width: 32px;
        height: 32px;
    }
    
    .topbar__action-icon {
        width: 16px;
        height: 16px;
    }
    
    /* Room Badge noch kompakter */
    .topbar__room-badge {
        padding: 0 10px;
        height: 44px;
    }
    
    /* Party Badge kompakter */
    .topbar__party {
        height: 44px;
    }
    
    .topbar__party-badge {
        height: 44px;
        padding: 0 10px;
    }
    
    .topbar__party-badge span {
        display: none;
    }
}

/* ========================================
   PARTY INDICATOR
   ======================================== */

.topbar__party {
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
}

.topbar__party-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topbar__party-badge:hover {
    background: var(--bg-elevated);
    border-color: rgba(255, 255, 255, 0.15);
}

.topbar__party-badge svg {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.5);
}

.topbar__party-badge span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.topbar__party-status {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
}

.topbar__party-chevron {
    width: 14px;
    height: 14px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
}

.topbar__party-badge.open .topbar__party-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.topbar__party-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: 280px;
    background: #1b1b1b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.topbar__party-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.topbar__party-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar__party-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.topbar__party-count {
    font-size: 11px;
    color: #22c55e;
}

.topbar__party-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.topbar__party-empty {
    padding: 20px 12px;
    text-align: center;
}

.topbar__party-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.topbar__party-member:hover {
    background: rgba(255, 255, 255, 0.05);
}

.topbar__party-member-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.topbar__party-member-avatar--online {
    border-color: #22c55e;
}

.topbar__party-member-avatar--away {
    border-color: #eab308;
}

.topbar__party-member-avatar--offline {
    opacity: 0.5;
}

.topbar__party-member-info {
    flex: 1;
    min-width: 0;
}

.topbar__party-member-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: white;
}

.topbar__party-member-char {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__party-member-status {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.topbar__party-member-status--online {
    color: #22c55e;
}

.topbar__party-member-status--away {
    color: #eab308;
}

.topbar__party-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar__party-gm {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.topbar__party-gm svg {
    color: #eab308;
}

/* Responsive */
@media (max-width: 768px) {
    .topbar__party-badge {
        padding: 0 12px;
    }
    
    .topbar__party-badge svg {
        width: 16px;
        height: 16px;
    }
    
    .topbar__party-badge span {
        font-size: 12px;
    }
    
    .topbar__party-dropdown {
        left: auto;
        right: -50px;
        transform: none;
        width: 260px;
    }
}

/* ========================================
   BACK BUTTON (Character Sheets)
   ======================================== */

.topbar__back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card, #2a2a2a);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    border-radius: 50px;
    color: var(--text-muted, #bebebe);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    height: 44px;
}

.topbar__back-btn:hover {
    background: var(--bg-elevated, #1e1e1e);
    border-color: var(--accent, #FF4655);
    color: var(--text, #dedede);
}

.topbar__back-btn:hover svg {
    transform: translateX(-3px);
}

.topbar__back-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

@media (max-width: 768px) {
    .topbar__back-btn span {
        display: none;
    }
    
    .topbar__back-btn {
        padding: 10px;
        border-radius: 12px;
    }
}
