/**
 * Sticky Top Bar Styles
 * A unified header bar with player info, stats, and navigation
 */

/* =========================================
   TOP BAR CONTAINER
   ========================================= */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease;
    font-family: var(--ui-font, 'Readex Pro', sans-serif);
}

/* Dark mode */
body.dark-mode .top-bar {
    background: rgba(37, 42, 40, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Hidden state */
.top-bar.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Body padding when top bar is visible */
body.has-top-bar {
    padding-top: 56px;
}

body.has-top-bar.top-bar-hidden {
    padding-top: 0;
}

/* =========================================
   TOP BAR SECTIONS
   ========================================= */

.top-bar-left,
.top-bar-center,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-left {
    flex: 0 0 auto;
}

.top-bar-center {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    gap: 12px;
}

.top-bar-right {
    flex: 0 0 auto;
    gap: 8px;
    margin-left: 8px;
}

/* =========================================
   FEATURE SHORTCUT BUTTONS
   ========================================= */

.feature-shortcut-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(58, 157, 116, 0.1);
    color: var(--primary-color, #3a9d74);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.feature-shortcut-btn:hover {
    background: var(--primary-color, #3a9d74);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(58, 157, 116, 0.3);
}

.feature-shortcut-btn:active {
    transform: translateY(0);
}

body.dark-mode .feature-shortcut-btn {
    background: rgba(58, 157, 116, 0.15);
}

body.dark-mode .feature-shortcut-btn:hover {
    background: var(--primary-color, #3a9d74);
}

/* NEW Badge */
.feature-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    padding: 2px 5px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(238, 90, 36, 0.4);
    animation: badge-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes badge-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(238, 90, 36, 0.4);
    }

    50% {
        transform: scale(1.08);
        box-shadow: 0 3px 10px rgba(238, 90, 36, 0.6);
    }
}

/* =========================================
   HIDE/SHOW TOGGLE BUTTON
   ========================================= */

.top-bar-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color, #333);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.top-bar-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .top-bar-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color-dark, #e8f0ec);
}

body.dark-mode .top-bar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* =========================================
   PLAYER INFO SECTION
   ========================================= */

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 20px;
    max-width: 280px;
    flex-shrink: 1;
    overflow: hidden;
}

body.dark-mode .player-info {
    background: rgba(255, 255, 255, 0.05);
}

/* Rank Icon */
.rank-icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* Player Name */
.player-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

body.dark-mode .player-name {
    color: var(--text-color-dark, #e8f0ec);
}

/* Streak Badge */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #ff6b35, #ff9f1c);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.streak-badge.inactive {
    background: rgba(0, 0, 0, 0.1);
    color: var(--muted-text, #666);
}

body.dark-mode .streak-badge.inactive {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   DAILY PROGRESS RING
   ========================================= */

.daily-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(58, 157, 116, 0.1);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--primary-color, #3a9d74);
}

.progress-ring {
    width: 20px;
    height: 20px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 3;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--primary-color, #3a9d74);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-text {
    font-weight: 600;
    white-space: nowrap;
}

/* =========================================
   HASANAT POINTS BUTTON
   ========================================= */

.hasanat-btn-topbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(56, 142, 60, 0.9));
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.hasanat-btn-topbar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.hasanat-btn-topbar .icon {
    font-size: 0.9rem;
}

.hasanat-btn-topbar .value {
    font-weight: 700;
}

/* Glow animation when points increase */
.hasanat-btn-topbar.glow {
    animation: hasanat-glow 0.8s ease;
}

@keyframes hasanat-glow {
    0% {
        box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
        transform: scale(1);
    }

    25% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.8), 0 0 40px rgba(76, 175, 80, 0.4);
        transform: scale(1.08);
    }

    50% {
        box-shadow: 0 0 30px rgba(76, 175, 80, 0.9), 0 0 50px rgba(76, 175, 80, 0.5);
        transform: scale(1.1);
    }

    75% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
        transform: scale(1);
    }
}

/* =========================================
   PROFILE BUTTON
   ========================================= */

.profile-btn-topbar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color, #3a9d74);
    background: var(--card-bg, white);
    color: var(--primary-color, #3a9d74);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.profile-btn-topbar:hover {
    background: var(--primary-color, #3a9d74);
    color: white;
    transform: scale(1.05);
}

body.dark-mode .profile-btn-topbar {
    background: var(--card-bg-dark, #252a28);
}

/* =========================================
   HAMBURGER BUTTON IN TOP BAR
   ========================================= */

.top-bar .hamburger-btn {
    position: static;
    width: 36px;
    height: 36px;
}

/* =========================================
   MINIMIZED FLOATING PILL
   ========================================= */

.top-bar-pill {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-bar-pill.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.top-bar-pill:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

body.dark-mode .top-bar-pill {
    background: rgba(37, 42, 40, 0.95);
}

.pill-expand-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: var(--primary-color, #3a9d74);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pill-hasanat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color, #3a9d74);
}

.pill-streak {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
    color: #ff6b35;
}

/* =========================================
   RESPONSIVE STYLES
   ========================================= */

@media (max-width: 767px) {
    .top-bar {
        height: 52px;
        padding: 0 10px;
    }

    body.has-top-bar {
        padding-top: 52px;
    }

    .player-info {
        padding: 3px 8px;
        max-width: 160px;
    }

    .player-name {
        max-width: 90px;
        font-size: 0.75rem;
    }

    .rank-icon {
        font-size: 1rem;
    }

    .daily-progress {
        display: none;
        /* Hide on mobile to save space */
    }

    .hasanat-btn-topbar {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .profile-btn-topbar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .top-bar .hamburger-btn {
        width: 32px;
        height: 32px;
    }

    .top-bar-toggle {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .top-bar-pill {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
    }

    /* Feature shortcuts - slightly smaller on mobile */
    .feature-shortcut-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .feature-badge {
        padding: 1px 4px;
        font-size: 0.5rem;
        top: -5px;
        right: -5px;
    }
}

@media (max-width: 360px) {
    .player-info {
        display: none;
        /* Hide player info on very small screens */
    }

    /* Hide feature shortcuts on very small screens - users can use hamburger menu */
    .feature-shortcut-btn {
        display: none;
    }
}

/* =========================================
   HIDE OLD GAMIFICATION SIDEBAR
   (when top bar is active)
   ========================================= */

body.has-top-bar .gamification-sidebar,
body.has-top-bar #gamificationSidebar,
body.has-top-bar .multiplier-badge,
body.has-top-bar #multiplierBadge {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}