/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 0; /* Will be set dynamically via JavaScript */
    width: 280px;
    height: 100vh; /* Will be adjusted dynamically */
    background: var(--dark-surface);
    border-right: 1px solid var(--border-color);
    z-index: 999;
    transform: translateX(0); /* Open by default on desktop */
    transition: transform 0.3s ease;
    overflow-y: hidden; /* Remove scrollbar */
    overflow-x: hidden;
    user-select: none;
}

.sidebar.closed {
    transform: translateX(-100%);
}

.sidebar.resizing {
    transition: none; /* Disable transition while resizing */
}

.sidebar-content {
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    min-height: 0; /* Important for flex scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin; /* Firefox - show thin scrollbar */
    scrollbar-color: rgba(37, 99, 235, 0.3) transparent; /* Firefox */
    -ms-overflow-style: auto; /* IE and Edge - show scrollbar */
}

.sidebar-content::-webkit-scrollbar {
    width: 6px; /* Chrome, Safari, Opera - show thin scrollbar */
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.3);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.5);
}

/* Sidebar Top Buttons */
.sidebar-top-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0; /* Prevent shrinking */
}

.sidebar-top-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
}

.sidebar-top-btn:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--primary-purple);
    transform: translateX(5px);
}

.sidebar-top-btn.has-image:hover {
    transform: none;
    opacity: 0.9;
}

.sidebar-top-btn i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    color: var(--primary-purple-light);
    flex-shrink: 0;
}

/* Quando tem imagem, ela ocupa todo o espaço */
.sidebar-top-btn.has-image {
    padding: 0;
    min-height: 50px;
    position: relative;
}

.sidebar-top-btn.has-image .sidebar-btn-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.sidebar-top-btn.has-image .sidebar-btn-title {
    position: relative;
    z-index: 2;
    color: var(--text-light, #ffffff);
    font-weight: 700;
    text-transform: uppercase;
    padding: 12px 15px;
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.sidebar-top-btn.has-image i {
    display: none;
}

.sidebar-btn-image {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-btn-title {
    flex: 1;
}

.sidebar-btn-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    z-index: 3;
}

.sidebar-top-btn.has-image .sidebar-btn-badge {
    top: 8px;
    right: 8px;
    z-index: 3;
}

/* VIP Button Special Style */
.sidebar-top-btn[data-position="1"] {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.2) 100%);
    border-color: rgba(255, 215, 0, 0.5);
}

.sidebar-top-btn[data-position="1"]:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.3) 100%);
    border-color: rgba(255, 215, 0, 0.8);
}

.sidebar-top-btn[data-position="1"] i {
    color: #FFD700;
}

/* Sidebar Section (Promoção) */
.sidebar-section {
    margin-top: 15px;
    flex-shrink: 0; /* Prevent shrinking */
}

.promo-container {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(30, 64, 175, 0.08) 100%);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(37, 99, 235, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.15);
}

.promo-container .sidebar-section-header {
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 10px 10px 0 0;
}

.promo-container .sidebar-section-header.collapsed {
    border-bottom: none;
    border-radius: 10px;
}

.sidebar-section-header:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: translateX(2px);
}

.sidebar-section-header i:first-child {
    color: var(--primary-purple, #2563eb);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.3));
}

.sidebar-section-header .section-title {
    flex: 1;
    color: var(--text-light, #ffffff);
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-section-header .section-toggle {
    color: var(--text-muted, #888);
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.sidebar-section-header.collapsed .section-toggle {
    transform: rotate(180deg);
}

.sidebar-section-content {
    margin-top: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.promo-container .sidebar-section-content {
    background: var(--dark-surface, #1a1f3a);
    border-radius: 0 0 10px 10px;
}

.sidebar-section-header.collapsed + .sidebar-section-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0;
}

.sidebar-submenu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    color: var(--text-light, #ffffff);
    text-decoration: none;
    border-radius: 0;
    transition: all 0.3s;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(37, 99, 235, 0.08);
    position: relative;
}

.sidebar-submenu-item:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: var(--text-light, #ffffff);
    padding-left: 20px;
    border-left: 3px solid var(--primary-purple, #2563eb);
}

.sidebar-submenu-item:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-purple, #2563eb);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.sidebar-submenu-item i {
    width: 24px;
    height: 24px;
    text-align: center;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Promoção Items Special Icons */
.promo-item {
    position: relative;
}

.promo-icon-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    display: inline-block;
    flex-shrink: 0;
    overflow: visible;
}

/* Bônus de Convite - Bullhorn */
.promo-icon-bullhorn {
    color: #FFD700;
    font-size: 1.4rem;
}

/* Clube VIP - Crown */
.promo-icon-crown {
    color: #FFD700;
    font-size: 1.4rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Afiliado Recorrente - Two Dollar Signs */
.promo-icon-afiliado {
    position: relative;
    background: transparent;
    overflow: visible;
    width: 32px;
}

.promo-icon-afiliado .promo-icon-dollar-1 {
    color: #ff4444;
    font-size: 1.3rem;
    font-weight: 700;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    line-height: 1;
    display: block;
}

.promo-icon-afiliado .promo-icon-dollar-2 {
    color: #ff4444;
    font-size: 1.3rem;
    font-weight: 700;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    line-height: 1;
    display: block;
}

/* Giro de Sorte - Wheel */
.promo-icon-wheel {
    color: #ff8800;
    font-size: 1.3rem;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Bônus por Baixar - Gift */
.promo-icon-gift {
    color: #ff8800;
    font-size: 1.3rem;
}

/* 5% Cashback - Percent in Box */
.promo-icon-percent-box {
    width: 28px;
    height: 28px;
    background: rgba(37, 99, 235, 0.2);
    border: 1px solid rgba(37, 99, 235, 0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.promo-icon-percent {
    color: var(--primary-purple, #2563eb);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Download APP Button */
.sidebar-download {
    margin-top: auto;
    padding-top: 20px;
    flex-shrink: 0; /* Prevent shrinking */
}

.sidebar-download-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(30, 64, 175, 0.15) 100%);
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-radius: 12px;
    color: var(--text-light, #ffffff);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.1);
}

.sidebar-download-btn:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25) 0%, rgba(30, 64, 175, 0.25) 100%);
    border-color: var(--primary-purple, #2563eb);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.sidebar-download-btn .download-icon {
    font-size: 1.2rem;
    color: #00ff00;
    filter: drop-shadow(0 0 3px rgba(0, 255, 0, 0.5));
}

.sidebar-download-btn .download-text {
    flex: 1;
    color: var(--text-light, #ffffff);
    font-weight: 700;
}

.download-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    font-size: 0;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 20px;
    min-width: auto;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.download-badge::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #ff4444;
}

.badge-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    display: inline-block;
}

.badge-coin {
    font-size: 0.7rem;
    color: #FFD700;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.6));
}

/* Language Selector */
.sidebar-language {
    margin-top: 20px;
    position: relative;
    flex-shrink: 0; /* Prevent shrinking */
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(30, 64, 175, 0.12) 100%);
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.language-selector:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(30, 64, 175, 0.2) 100%);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.language-flag {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 50%; /* Round flags */
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.language-text {
    flex: 1;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.language-toggle {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.language-selector.active .language-toggle {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.98) 0%, rgba(20, 25, 45, 0.98) 100%);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 10px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.language-selector.active + .language-dropdown,
.language-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-light);
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.2) 0%, rgba(37, 99, 235, 0.05) 100%);
    padding-left: 20px;
}

.language-option:hover .language-flag {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.3);
}

.language-option .language-flag {
    width: 28px;
    height: 28px;
    border-radius: 50%; /* Round flags in dropdown */
}

/* Sidebar Overlay - Hidden on desktop, shown on mobile */
.sidebar-overlay {
    display: none; /* Hidden on desktop */
}

/* Adjust main content when sidebar is open - DESKTOP ONLY */
.dashboard-main {
    transition: margin-left 0.3s ease;
    margin-top: 0;
    margin-left: 0; /* Start closed */
}

.sidebar:not(.closed) ~ .dashboard-main {
    margin-left: 280px; /* Push content when sidebar is open on desktop */
}

.sidebar.closed ~ .dashboard-main {
    margin-left: 0;
}

/* Sidebar Resize Handle */
.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    z-index: 1000;
    transition: background 0.2s;
}

.sidebar-resize-handle:hover {
    background: rgba(37, 99, 235, 0.5);
}

.sidebar-resize-handle.active {
    background: rgba(37, 99, 235, 0.8);
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .sidebar {
        width: 260px;
        top: 0; /* Will be set dynamically via JavaScript */
        /* Height will be calculated dynamically via JavaScript to account for header + bottom nav */
        height: 100vh; /* Will be adjusted dynamically */
        max-height: 100vh;
        transform: translateX(-100%); /* Closed on mobile by default */
        transform-origin: left center;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.closed {
        transform: translateX(-100%);
    }
    
    .sidebar-content {
        height: 100%;
        max-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin; /* Firefox - show thin scrollbar on mobile */
        scrollbar-color: rgba(37, 99, 235, 0.3) transparent;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .sidebar-content::-webkit-scrollbar {
        width: 4px; /* Thinner on mobile */
    }
    
    .dashboard-main {
        margin-left: 0 !important; /* No margin on mobile */
        padding: 0 !important; /* No padding on mobile */
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
    }
    
    .sidebar.active ~ .dashboard-main {
        margin-left: 0 !important;
    }
    
    /* Sidebar starts closed on mobile */
    .sidebar {
        transform: translateX(-100%); /* Closed by default on mobile */
        z-index: 1001; /* Above overlay */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.closed {
        transform: translateX(-100%);
    }
    
    /* Overlay on mobile - shows when sidebar is open */
.sidebar-overlay {
        display: block; /* Show overlay on mobile */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
        z-index: 1000; /* Below sidebar, above content */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
        pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
        pointer-events: auto; /* Allow clicks when active */
}

    /* On mobile, sidebar opens on top, doesn't push content */
.dashboard-main {
        margin-left: 0 !important; /* Never push on mobile */
}

.sidebar.active ~ .dashboard-main {
        margin-left: 0 !important; /* Never push on mobile */
    }
}

