/* TOPCIFRAS - Correções Mobile v3 - Menu ao lado da logo */

/* Header não-fixo */
header { position: relative !important; top: auto !important; }

/* Corrigir scroll horizontal */
html, body { overflow-x: hidden; max-width: 100vw; }
* { max-width: 100%; }
img { max-width: 100%; height: auto; }

/* ===== HEADER LEFT - Logo + Menu Hamburguer lado a lado ===== */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Menu Hamburguer */
.menu-hamburguer { 
    display: none; 
    width: 44px; 
    height: 44px; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    gap: 5px; 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 8px; 
    order: 2; /* Fica depois da logo */
}
.menu-hamburguer span { 
    display: block; 
    width: 24px; 
    height: 3px; 
    background: var(--primary); 
    border-radius: 2px; 
    transition: 0.3s; 
}
.menu-hamburguer.ativo span:nth-child(1) { transform: rotate(45deg) translate(7px, 7px); }
.menu-hamburguer.ativo span:nth-child(2) { opacity: 0; }
.menu-hamburguer.ativo span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

.logo {
    order: 1; /* Logo primeiro */
}

/* Menu Lateral */
.menu-lateral { 
    position: fixed; 
    top: 0; 
    right: -300px; 
    width: 280px; 
    height: 100vh; 
    background: white; 
    box-shadow: -5px 0 15px rgba(0,0,0,0.1); 
    z-index: 1001; 
    transition: right 0.3s ease; 
    overflow-y: auto; 
    padding: 20px; 
}
.menu-lateral.aberto { right: 0; }
.menu-lateral-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px; 
    padding-bottom: 15px; 
    border-bottom: 2px solid #e2e8f0; 
}
.menu-fechar { 
    width: 36px; 
    height: 36px; 
    background: #f1f5f9; 
    border: none; 
    border-radius: 8px; 
    font-size: 24px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

/* Estilização de usuário mobile */
.user-mobile-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
}

.user-mobile-info img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.user-mobile-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.favoritos-link {
    color: var(--primary);
    font-size: 14px;
    text-decoration: none;
}

.btn-login-mobile {
    width: 100%;
    margin-bottom: 20px;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.btn-login-mobile:hover {
    background: #f8fafc;
    border-color: var(--primary);
}

.btn-login-mobile img {
    width: 20px;
    height: 20px;
}

.nav-mobile { 
    display: flex; 
    flex-direction: column; 
    gap: 0; 
}

.nav-mobile a { 
    padding: 15px; 
    border-bottom: 1px solid #e2e8f0; 
    color: var(--text); 
    text-decoration: none; 
    display: block; 
    transition: 0.2s;
}

.nav-mobile a:hover { 
    background: #f8fafc; 
    color: var(--primary); 
}

.nav-mobile a.active {
    background: #f0fdf4;
    color: var(--primary);
    font-weight: 600;
}

.logout-link {
    color: #ef4444 !important;
}

.menu-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 1000; 
    display: none; 
}
.menu-overlay.ativo { display: block; }

/* YouTube Player */
.youtube-player { 
    background: white; 
    border-radius: 12px; 
    border: 1px solid #e2e8f0; 
    margin-bottom: 30px; 
    overflow: hidden; 
}
.youtube-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 20px; 
    background: #f8fafc; 
    border-bottom: 1px solid #e2e8f0; 
}
.youtube-header h3 { 
    font-size: 16px; 
    margin: 0; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
.youtube-controles { 
    display: flex; 
    gap: 8px; 
}
.youtube-controles button { 
    padding: 8px 15px; 
    background: var(--primary); 
    color: white; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 600; 
    transition: 0.2s;
}
.youtube-controles button:hover { 
    background: var(--primary-dark); 
    transform: scale(1.05);
}
.youtube-video { 
    position: relative; 
    padding-bottom: 56.25%; 
    height: 0; 
    display: none; 
}
.youtube-video.visivel { display: block; }
.youtube-video iframe { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    border: none; 
}

/* Efeito no botão Favoritar */
.btn-favoritar,
.btn-fav {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-favoritar:active,
.btn-fav:active {
    transform: scale(0.95);
}

.btn-favoritar.favoritado,
.btn-fav.favoritado {
    animation: pulso 0.5s ease;
}

@keyframes pulso {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.btn-favoritar::after,
.btn-fav::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-favoritar:active::after,
.btn-fav:active::after {
    width: 200px;
    height: 200px;
}

/* Corrigir Top 15 Cards no Mobile */
@media (max-width: 768px) {
    /* Top 15 - 1 coluna no mobile */
    .top15-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        grid-auto-flow: row !important;
    }
    
    .top15-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
    
    .top15-info h4,
    .top15-info p {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* Mobile Geral */
@media (max-width: 768px) {
    /* Mostrar menu hamburguer */
    .menu-hamburguer { display: flex; }
    
    /* Esconder elementos desktop */
    .nav-desktop,
    header .search-box, 
    header .user-area { 
        display: none !important; 
    }
    
    /* Header layout mobile */
    .header-inner { 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
    }
    
    /* Logo menor no mobile */
    .logo { 
        font-size: 1.2rem !important; 
    }
    
    /* Conteúdo principal */
    main { padding: 15px !important; }
    
    /* Hero */
    .hero { 
        padding: 20px 15px !important; 
        margin-left: 0 !important; 
        margin-right: 0 !important; 
    }
    .hero h1 { font-size: 1.6rem !important; }
    .hero p { font-size: 0.95rem !important; }
    
    /* Grids */
    .music-grid, .top10-grid { grid-template-columns: 1fr !important; }
    .generos-grid { grid-template-columns: repeat(2, 1fr) !important; }
    
    /* Controles */
    .controles { flex-direction: column !important; }
    .controle-grupo button { 
        min-width: 44px !important; 
        min-height: 44px !important; 
    }
    
    /* Forms touch-friendly */
    input, select, textarea, button { 
        min-height: 44px !important; 
        font-size: 16px !important; 
    }
    
    /* Páginas */
    .page-content { padding: 15px !important; }
    
    /* YouTube */
    .youtube-controles { 
        flex-direction: column; 
        gap: 5px; 
    }
    .youtube-controles button { width: 100%; }
}

@media (max-width: 480px) {
    .generos-grid { grid-template-columns: 1fr !important; }
    .hero-stats { flex-direction: column !important; }
}

/* Toast para feedback de favoritos */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.sucesso {
    border-left: 4px solid #10b981;
}

.toast.erro {
    border-left: 4px solid #ef4444;
}

.toast-icon {
    font-size: 24px;
}

.toast-msg {
    flex: 1;
    font-size: 14px;
}

@media (max-width: 768px) {
    .toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .toast {
        min-width: 0;
        width: 100%;
    }
}
