/* ============================================
   Shared Sidebar Styles
   Used across: BRF, Habits, Journal, Calendar, Challenges
   ============================================ */

/* Base App Sidebar - shared across all BRF pages */
.app-sidebar {
    background: rgba(15, 15, 35, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-sidebar .sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
}

/* Sidebar Header */
.app-sidebar .sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar .header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-sidebar .header-title h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.app-sidebar .habit-count,
.app-sidebar .entry-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ============================================
   Growth Sidebar Section
   ============================================ */
.growth-sidebar-section {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

/* ============================================
   Avatar Widget
   ============================================ */
.avatar-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.avatar-widget:hover {
    transform: scale(1.02);
}

.avatar-video-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
}

.avatar-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-video-container .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.avatar-video-container .avatar-placeholder svg {
    width: 60%;
    height: 60%;
    opacity: 0.5;
}

.avatar-info {
    text-align: center;
}

.avatar-character-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
}

.avatar-stage-name {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.avatar-xp-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.avatar-xp-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #22c55e;
}

.avatar-forest-level {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.avatar-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.avatar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.avatar-xp-to-next {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.25rem;
}

/* ============================================
   Avatar Modal
   ============================================ */
.avatar-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.avatar-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.avatar-modal {
    background: linear-gradient(135deg, #1a1a3e 0%, #0f0f23 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

/* Expanded modal with body map */
.avatar-modal.avatar-modal-with-bodymap {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.avatar-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.avatar-modal-left {
    text-align: center;
}

.avatar-modal-right {
    text-align: left;
}

@media (max-width: 600px) {
    .avatar-modal.avatar-modal-with-bodymap {
        max-width: 95%;
    }

    .avatar-modal-grid {
        grid-template-columns: 1fr;
    }

    .avatar-modal-right {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-top: 1rem;
        margin-top: 0.5rem;
    }
}

.avatar-modal-overlay.active .avatar-modal {
    transform: scale(1);
}

.avatar-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-modal-video {
    width: 200px;
    height: 200px;
    border-radius: 20px;
    overflow: hidden;
    margin: 0 auto 1.5rem;
    border: 3px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.3);
}

.avatar-modal-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
    text-transform: capitalize;
}

.avatar-modal-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.avatar-modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.avatar-modal-stat {
    text-align: center;
}

.avatar-modal-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #22c55e;
    display: block;
}

.avatar-modal-stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.avatar-change-btn {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #a78bfa;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-top: 1rem;
}

.avatar-change-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    color: white;
}

/* ============================================
   Character Selection Modal
   ============================================ */
.character-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.character-option {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.character-option:hover {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.1);
}

.character-option.selected {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.character-option.placeholder {
    opacity: 0.5;
}

.character-option video,
.character-option img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 0.5rem;
}

.character-option-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
}

/* ============================================
   Upgrade Banner
   ============================================ */
.upgrade-banner {
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
}

.upgrade-banner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.upgrade-icon {
    font-size: 1.25rem;
}

.upgrade-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    font-weight: 500;
}

.upgrade-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.upgrade-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ============================================
   Growth XP Display (used in some sidebars)
   ============================================ */
.growth-xp-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #22c55e;
    margin-top: 0.5rem;
}

.growth-level-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   BRF Says... Tip Card
   ============================================ */
.brf-tip-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.brf-tip-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.brf-tip-icon {
    font-size: 1rem;
}

.brf-tip-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.brf-tip-refresh {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.brf-tip-refresh:hover {
    color: rgba(255, 255, 255, 0.7);
}

.brf-tip-text {
    font-size: 0.8rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    margin: 0;
}

/* ============================================
   Weekly Trend Dots (Habits sidebar)
   ============================================ */
.weekly-trend-section {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.weekly-trend-section .section-header {
    padding: 0 0 0.5rem 0;
}

.weekly-trend-section .section-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.weekly-trend-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.trend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s;
    position: relative;
}

.trend-dot.filled {
    background: #22c55e;
}

.trend-dot.today {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.6);
}

.trend-dot-label {
    display: block;
    text-align: center;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 0.25rem;
}

/* ============================================
   Streak Stats Row (Calendar sidebar)
   ============================================ */
.streak-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.streak-stats-row .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.streak-stats-row .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #22c55e;
}

.streak-stats-row .stat-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================
   Next Reward Preview (Challenges sidebar)
   ============================================ */
.next-reward-preview {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.next-reward-preview .section-header {
    padding: 0 0 0.5rem 0;
}

.next-reward-preview .section-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.next-reward-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.next-reward-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.next-reward-xp {
    font-size: 0.8rem;
    color: #22c55e;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

/* ============================================
   Journal Week Counter (Journal sidebar)
   ============================================ */
.journal-week-counter {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.journal-week-counter .section-header {
    padding: 0 0 0.5rem 0;
}

.journal-week-counter .section-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.week-counter-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.1rem;
}

.week-counter-value {
    font-size: 2rem;
    font-weight: 700;
    color: #22c55e;
}

.week-counter-total {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
}

.week-counter-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.15rem;
}

/* ============================================
   Template Suggestion (Templates sidebar)
   ============================================ */
.templates-stats-section {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.template-suggestion {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.template-suggestion .section-header {
    padding: 0 0 0.5rem 0;
}

.template-suggestion .section-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.suggestion-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.suggestion-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.suggestion-icon {
    font-size: 1.5rem;
}

.suggestion-name {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* ============================================
   Shared Stat Row (used in BRF, Templates sidebars)
   ============================================ */
.stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.stat-row .stat-icon {
    font-size: 1rem;
    width: 1.5rem;
    text-align: center;
}

.stat-row .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.stat-row .stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Evolution Overlay (Stage-Up Celebration)
   ============================================ */
.evolution-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.evolution-overlay.active {
    opacity: 1;
    visibility: visible;
}

.evolution-modal {
    position: relative;
    text-align: center;
    padding: 2.5rem 2rem;
    max-width: 360px;
    width: 90%;
}

.evolution-badge {
    display: inline-block;
    padding: 0.4rem 1.5rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    animation: badgePulse 1.5s ease-in-out infinite;
}

.evolution-avatar-container {
    width: 180px;
    height: 180px;
    border-radius: 24px;
    overflow: hidden;
    margin: 0 auto 1.5rem;
    border: 3px solid rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.3), 0 0 80px rgba(239, 68, 68, 0.15);
    animation: avatarReveal 0.6s ease-out;
}

.evolution-character-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
    text-transform: capitalize;
}

.evolution-stage-transition {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.evolution-old-stage {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: line-through;
}

.evolution-arrow {
    color: #f59e0b;
    font-weight: 700;
}

.evolution-new-stage {
    color: #f59e0b;
    font-weight: 700;
}

.evolution-continue-btn {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border: none;
    color: white;
    padding: 0.75rem 2.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.evolution-continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

.evolution-particle {
    position: absolute;
    font-size: 1.2rem;
    pointer-events: none;
    opacity: 0;
    animation: particleFloat 3s ease-out forwards;
}

/* ============================================
   Growth Level-Up Toast
   ============================================ */
.growth-levelup-toast {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, #1a1a3e 0%, #0f0f23 100%);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.growth-levelup-toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.growth-toast-icon {
    font-size: 1.25rem;
}

.growth-toast-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.growth-toast-text strong {
    color: #22c55e;
}

/* ============================================
   Evolution Keyframe Animations
   ============================================ */
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes avatarReveal {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.5);
    }
}

/* ============================================
   Responsive - Hide sidebar on mobile
   ============================================ */
@media (max-width: 1024px) {
    .app-sidebar {
        display: none;
    }
}
