/* =========================================================
   HEADER STYLES - FutstatsBR
   Responsivo sem quebrar o desktop
   v3: nav compacto + mantém estilo original
   Atualizado em 2025-10-25
   ========================================================= */

/* ===========================
   HEADER BASE (DESKTOP DEFAULT)
   Mantém exatamente o visual atual do desktop
   =========================== */

header,
.site-header {
    background: linear-gradient(to bottom, #000000 0%, #0a0a0a 100%);
    padding: 0 20px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    line-height: 25.6px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    width: 100%;
    box-sizing: border-box;
    color: rgb(240, 240, 240);
    margin: 0;
    background-color: rgba(0, 0, 0, 0);
}

/* LOGO */
.logo-area a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.logo-area img {
    height: 70px;
}

.logo-area span {
    font-weight: bold;
    font-size: 1.2rem;
    margin-left: 10px;
}

/* ===========================
   NAV / MENU PRINCIPAL
   =========================== */
.main-nav,
nav.main-nav {
    display: flex;
    flex-wrap: nowrap;          /* todos itens em uma linha */
    align-items: center;
    justify-content: center;
    height: 100%;
    order: 0;

    white-space: nowrap;
    text-wrap: nowrap;
    overflow-x: hidden;         /* nunca mostra barra de rolagem horizontal */
    max-width: 100%;

    padding-bottom: 0;
    width: auto;
    box-sizing: border-box;
    color: rgb(240, 240, 240);
    font-family: inherit;
    line-height: 25.6px;
}

.main-nav a,
nav.main-nav a {
    color: rgb(240, 240, 240);
    text-decoration: none;
    padding: 0 20px;                    /* padding horizontal desktop */
    border-radius: 0;
    transition: all 0.3s ease;
    font-size: 1rem;
    background: transparent !important;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    line-height: 1.2;
    flex-shrink: 1;                     /* pode apertar um pouco em telas menores */
}

header a:hover,
.main-nav a:hover,
nav.main-nav a:hover {
    color: #1DB954 !important;
    border-bottom-color: #1DB954 !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.main-nav a.is-active,
nav.main-nav a.is-active {
    background: transparent !important;
    color: #1DB954 !important;
    border-bottom: 2px solid #1DB954 !important;
}

/* ===========================
   AÇÕES DO USUÁRIO (lado direito)
   =========================== */

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.welcome-message {
    font-size: 0.9rem;
    color: #ccc;
    margin-left: 15px;
}

.user-name {
    color: #1DB954;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14ch;
}

/* ===========================
   BOTÕES PADRÃO DO HEADER
   =========================== */
   
.btn-login{ margin-left: 20px;}

.header-btn,
.btn-subscription,
.btn-login,
.btn-signup,
.btn-logout,
.btn-profile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    color: #fff;
    line-height: 1.2;
}

/* variantes de cor */
.btn-subscription { background: #ff8800; }
.btn-login,
.btn-profile { background: #1a73e8; }
.btn-signup { background: #5cb85c; }
.btn-logout { background: #d9534f; }

.header-btn:hover,
.btn-subscription:hover,
.btn-login:hover,
.btn-signup:hover,
.btn-logout:hover,
.btn-profile:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.header-btn:active,
.btn-subscription:active,
.btn-login:active,
.btn-signup:active,
.btn-logout:active,
.btn-profile:active {
    transform: translateY(1px);
}
.header-btn:focus-visible,
.btn-subscription:focus-visible,
.btn-login:focus-visible,
.btn-signup:focus-visible,
.btn-logout:focus-visible,
.btn-profile:focus-visible {
    outline: 2px solid #ffffff33;
    outline-offset: 2px;
}

/* ===========================
   BUSCA
   =========================== */

.search-container {
    position: relative;
    margin-left: 10px;
    height: 40px;
    width: 300px;
    order: 0;
}

#search-form {
    width: 100% !important;
    height: 100%;
}

#search-input {
    padding: 10px 15px 10px 40px;
    border-radius: 20px;
    border: none;
    width: 100% !important;
    box-sizing: border-box;
    background-color: #2c2c2c;
    color: white;
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
    height: 100%;
    font-family: inherit !important;
}
#search-input:focus {
    background-color: #333;
    box-shadow: 0 0 0 2px #1DB954;
}

.fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
    z-index: 1;
    font-size: 1rem;
}

/* --------- Sugestões de busca dropdown --------- */

#search-suggestions {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    text-align: left;
    color: #fff;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    transition: background 0.2s ease-in-out;
    cursor: pointer;
    text-align: left;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background-color: #2d2d2d;
}
.search-result-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    background: #1f1f1f;
    padding: 4px;
    display: inline-block;
}
.search-result-info {
    width: 100%;
    display: flex;
    flex-direction: column;
}
.search-result-name {
    font-size: 15px;
    font-weight: 500;
    color: #f1f1f1;
    margin-bottom: 2px;
}
.search-result-meta {
    font-size: 12px;
    color: #aaa;
}
.no-results {
    padding: 15px;
    color: #aaa;
    text-align: center;
    font-size: 14px;
}

/* ===========================
   NOTIFICAÇÕES
   =========================== */

.notification-container {
    position: relative;
    margin-left: 15px;
}

.notification-icon {
    color: white;
    font-size: 1.2rem;
    position: relative;
    text-decoration: none;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.notification-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff4757;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s infinite;
}

.notification-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 350px;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    text-align: left;
}
.notification-header {
    padding: 15px;
    border-bottom: 1px solid #333;
    font-weight: bold;
    color: #1DB954;
    font-size: 1.1rem;
    background-color: #2a2a2a;
    border-radius: 8px 8px 0 0;
}
.notification-list {
    max-height: 400px;
    overflow-y: auto;
}
.notification-list::-webkit-scrollbar {
    width: 10px;
    background-color: #2c2c2c;
}
.notification-list::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 6px;
    border: 2px solid #2c2c2c;
}
.notification-list::-webkit-scrollbar-thumb:hover {
    background-color: #777;
}
.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid #333;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
}
.notification-item:hover {
    background-color: #2a2a2a;
}
.notification-link {
    display: inline-block;
    margin-top: 8px;
    color: #1DB954;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border: 1px solid #1DB954;
    border-radius: 4px;
    transition: all 0.2s;
}
.notification-link:hover {
    background-color: #1DB954;
    color: white;
    text-decoration: none;
}
.notification-empty {
    padding: 20px;
    color: #aaa;
    text-align: center;
    font-size: 0.9rem;
}
.notification-actions {
    padding: 12px 15px;
    text-align: center;
    border-top: 1px solid #333;
    background-color: #2a2a2a;
    border-radius: 0 0 8px 8px;
}
.mark-all-read-btn {
    background-color: #1DB954;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.3s;
}
.mark-all-read-btn:hover {
    background-color: #179c46;
}

.notification-read {
    opacity: 0.7;
    background-color: #1a1a1a !important;
}
.notification-read .notification-link {
    color: #777 !important;
    border-color: #777;
}
.notification-read .notification-link:hover {
    background-color: #777;
    color: white !important;
}

/* badge pulsando */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ===========================
   UTILITÁRIOS
   =========================== */

.logout-inline {
    display:inline-block;
    margin:0;
}

.logo-img {
    height: 20px;
    vertical-align: middle;
}

.is-hidden {
    display: none !important;
}

/* —— Distribuição de espaço no header (desktop) —— */
.main-nav, nav.main-nav {
    flex: 1 1 auto;   /* o menu ocupa o espaço elástico */
    min-width: 0;     /* permite encolher sem quebrar layout */
}

.search-container {
    flex: 0 1 clamp(220px, 24vw, 320px);  /* busca encolhe antes de atropelar o menu */
    width: auto;                           /* não fixa em 300px quando apertado */
}

.user-actions {
    flex: 0 0 auto;  /* botões/saudação não esticam o layout */
}

/* ====== DESKTOP COMPACTO (monitores tipo 1366x768) ======
   Objetivo:
   - liberar espaço pro menu (não esconder "Início" / "Financeiro")
   - impedir quebra bizarra no nome do usuário
   - deixar botões menores
   - encolher a busca

   OBS: isso ainda mantém tudo em uma linha.
========================================================== */
@media (max-width: 1480px) {

    /* 1. Menu principal ocupa um pouco menos de largura por item */
    .main-nav a,
    nav.main-nav a {
        padding: 0 12px;                 /* era 20px / 14px */
        font-size: 0.9rem;               /* levemente menor */
    }

    /* 2. Campo de busca reduz a largura máxima e cede espaço pro menu */
    .search-container {
        flex: 0 1 clamp(170px, 20vw, 240px);   /* antes 220px~320px */
    }

    /* 3. Saudação mais curta (some o "Olá,") e nome mais compacto */
    .welcome-message {
        display: none;                   /* esconde o "Olá," nessas larguras */
    }

    .user-name {
        max-width: 10ch;                 /* corta nomes grandes mais cedo */
        font-size: 0.85rem;              /* texto menor */
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 4. Grupo da direita ocupa menos espaço horizontal */
    .user-actions {
        gap: 10px;                       /* era ~15px */
    }

    /* 5. Botões Assinatura / Perfil / Sair ficam mais curtinhos */
    .header-btn,
    .btn-subscription,
    .btn-login,
    .btn-signup,
    .btn-logout,
    .btn-profile {
        height: 32px;        /* antes 36px */
        padding: 0 12px;     /* antes 16px */
        min-width: 70px;
        font-size: 0.8rem;   /* fonte menor */
        border-radius: 6px;
        line-height: 1.2;
    }

    /* 6. Sininho mais próximo, menos dispersão */
    .notification-container {
        margin-left: 5px;
    }

    .notification-icon {
        font-size: 1rem;
        padding: 6px;
    }
}

/* ====== LIMITE EXTRA (opcional, caso ainda falte espaço perto de 1280px)
   Se em algum monitor com 1280px de largura ainda estiver sumindo coisa,
   ativa essa segunda redução.
   Isso NÃO quebra em 2 linhas ainda, só aperta mais um pouco.
========================================================== */
@media (max-width: 1280px) {

    .main-nav a,
    nav.main-nav a {
        padding: 0 10px;
        font-size: 0.8rem;
    }

    .search-container {
        flex: 0 1 clamp(150px, 18vw, 210px);
    }

    .user-actions {
        gap: 8px;
    }

    .header-btn,
    .btn-subscription,
    .btn-login,
    .btn-signup,
    .btn-logout,
    .btn-profile {
        height: 30px;
        padding: 0 10px;
        min-width: 60px;
        font-size: 0.75rem;
    }

    .user-name {
        max-width: 9ch;
        font-size: 0.8rem;
    }
}

/* =====================================================
   BREAKPOINT <= 1024px (tablet / celular grande)
   Quebra o header em múltiplas linhas e reordena as seções
   ===================================================== */

  @media (max-width: 1120px) {

    header,
    .site-header {
        flex-wrap: wrap;
        padding: 8px 15px 20px 15px;
        height: auto;
        gap: 8px;
    }

    /* ORDEM DAS ÁREAS NO MOBILE:
       1 - logo
       2 - ações do usuário / notificações
       3 - nav
       4 - busca
    */

    .logo-area {
        order: 1;
        flex: 0 0 auto;
    }
    .logo-area img {
        height: 45px;
    }
    .logo-area span {
        font-size: 0.95rem;
        margin-left: 8px;
    }

    .user-actions {
        order: 2;
        flex-direction: row;
        gap: 6px;
        justify-content: flex-end;
        align-items: center;
        flex: 1;
        flex-wrap: nowrap;
        min-width: 0;
    }

    .welcome-message {
        display: none;
    }

    .notification-container {
        order: 1;
        margin-left: 0;
    }

    /* MENU PRINCIPAL - centralizado */
    .main-nav,
    nav.main-nav {
        order: 3;
        width: 100%;
        max-width: 100%;
        justify-content: center;
        margin: 4px 0 0 0;
        padding: 0 0 4px 0;
        border-bottom: 1px solid #444;
        height: auto;
        min-height: 32px;
        overflow-x: hidden;
        white-space: nowrap;
        flex-wrap: nowrap;
        gap: 0;
    }

    .main-nav a,
    nav.main-nav a {
        padding: 6px 10px 4px 10px;
        font-size: clamp(0.8rem, 1vw, 0.9rem);
        height: auto;
        line-height: 1.2;
        flex-shrink: 1;
        min-width: auto;
        display: flex;
        align-items: center;
        border-bottom: 2px solid transparent;
        position: relative;
        background: transparent !important;
    }

    .main-nav a.is-active,
    nav.main-nav a.is-active {
        color: #1DB954 !important;
        border-bottom-color: #1DB954 !important;
        padding-bottom: 4px;
        background: transparent !important;
    }

    /* BUSCA CENTRALIZADA (linha inteira) */
    .search-container {
        order: 4;
        width: 100%;
        max-width: none;
        margin: 0;
        height: 32px;
        flex: none !important; /* Remove qualquer flex do desktop */
    }
    
    #search-input {
        font-size: 0.85rem;
        padding: 8px 15px 8px 35px;
        height: 100%;
    }
    
    .fa-search {
        left: 12px;
        font-size: 0.85rem;
    }

    /* BOTÕES compactos */
    .header-btn,
    .btn-subscription,
    .btn-login,
    .btn-signup,
    .btn-logout,
    .btn-profile {
        height: 30px;
        padding: 0 10px;
        font-size: 0.8rem;
        border-radius: 6px;
        min-width: 60px;
    }

    /* Notificações dropdown ajustado */
    .notification-dropdown {
        right: -10px;
        width: 320px;
    }
}

/* =====================================================
   BREAKPOINT <= 768px (celular "normal")
   Reduz um pouco mais tipografia e espaços
   ===================================================== */

@media (max-width: 768px) {

    header,
    .site-header {
        padding: 6px 12px 18px 12px; /* bottom reduzido mas ainda com respiro */
        gap: 6px;
    }

    .logo-area img {
        height: 40px;
    }
    .logo-area span {
        font-size: 0.85rem;
    }

    .user-actions {
        gap: 5px;
    }

    .header-btn,
    .btn-subscription,
    .btn-login,
    .btn-signup,
    .btn-logout,
    .btn-profile {
        height: 28px;
        padding: 0 8px;
        font-size: 0.75rem;
        min-width: 55px;
        border-radius: 6px;
    }

    .main-nav,
    nav.main-nav {
        order: 3;
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 0 0 4px 0;
        margin: 4px 0;
        border-bottom: 1px solid #444;

        height: auto;
        min-height: 30px;

        overflow-x: hidden;
        white-space: nowrap;
        flex-wrap: nowrap;
        gap: 0;
    }
    .main-nav a,
    nav.main-nav a {
        padding: 5px 10px 4px 10px;
        font-size: clamp(0.7rem, 2vw, 0.8rem); /* encolhe mais */
        line-height: 1.2;
        flex-shrink: 1;
        min-width: auto;
        background: transparent !important;
        border-bottom: 2px solid transparent;
    }
    .main-nav a.is-active,
    nav.main-nav a.is-active {
        padding-bottom: 4px;
        color: #1DB954 !important;
        border-bottom-color: #1DB954 !important;
        background: transparent !important;
    }

    .search-container {
        height: 30px;
        width: 100%;
        margin: 0 auto;
    }
    #search-input {
        font-size: 0.8rem;
        padding: 6px 12px 6px 32px;
    }
    .fa-search {
        left: 10px;
        font-size: 0.8rem;
    }

    .notification-dropdown {
        width: 320px;
    }
}


/* =====================================================
   BREAKPOINT <= 480px (celular pequeno)
   Encolhe ainda mais texto e botões
   ===================================================== */

@media (max-width: 480px) {

    header,
    .site-header {
        padding: 5px 10px 16px 10px; /* bottom reduzido */
        gap: 5px;
    }

    .logo-area img {
        height: 38px;
    }
    .logo-area span {
        font-size: 0.8rem;
        margin-left: 5px;
    }

    .user-actions {
        gap: 4px;
    }

    .header-btn,
    .btn-subscription,
    .btn-login,
    .btn-signup,
    .btn-logout,
    .btn-profile {
        padding: 0 7px;
        font-size: 0.7rem;
        height: 26px;
        min-width: 50px;
        border-radius: 6px;
    }

    .main-nav,
    nav.main-nav {
        margin: 4px 0;
        padding: 0 0 4px 0;
        justify-content: center;
        gap: 0;
        border-bottom: 1px solid #444;

        height: auto;
        min-height: 28px;

        overflow-x: hidden;
        white-space: nowrap;
        flex-wrap: nowrap;
        max-width: 100%;
    }

    .main-nav a,
    nav.main-nav a {
        padding: 4px 8px 4px 8px;
        font-size: clamp(0.6rem, 2.5vw, 0.7rem);
        line-height: 1.2;
        flex-shrink: 1;
        min-width: auto;
        background: transparent !important;
        border-bottom: 2px solid transparent;
    }

    .main-nav a.is-active,
    nav.main-nav a.is-active {
        color: #1DB954 !important;
        border-bottom-color: #1DB954 !important;
        padding-bottom: 4px;
        background: transparent !important;
    }

    .search-container {
        height: 28px;
        max-width: none;
    }
    #search-input {
        padding: 6px 12px 6px 30px;
        font-size: 0.8rem;
    }

    .notification-dropdown {
        width: 280px;
        right: -15px;
    }
}


/* =====================================================
   BREAKPOINT <= 370px (ultra compacto)
   Pensado pra tela minúscula, tipo celular muito estreito
   ===================================================== */

@media (max-width: 370px) {

    header,
    .site-header {
        padding: 4px 8px 14px 8px; /* bottom reduzido */
        gap: 4px;
    }

    .logo-area img {
        height: 32px;
    }

    .logo-area span {
        font-size: 0.7rem;
        margin-left: 4px;
        line-height: 1.2;
    }

    .user-actions {
        gap: 3px;
        flex-wrap: nowrap;
        flex: 1 1 auto;
        justify-content: flex-end;
        min-width: 0;
    }

    .notification-container {
        margin-left: 3px;
    }

    .notification-icon {
        font-size: 1rem;
        padding: 4px;
    }

    .header-btn,
    .btn-subscription,
    .btn-login,
    .btn-signup,
    .btn-logout,
    .btn-profile {
        height: 24px;
        padding: 0 4px;
        min-width: auto;
        font-size: 0.6rem;
        line-height: 1.2;
        border-radius: 4px;
    }

    .main-nav,
    nav.main-nav {
        padding: 0 0 4px 0;
        margin: 4px 0;
        gap: 0;
        justify-content: center;
        overflow-x: hidden;
        white-space: nowrap;
        flex-wrap: nowrap;
        max-width: 100%;
        border-bottom: 1px solid #444;

        height: auto;
        min-height: 26px;
    }

    .main-nav a,
    nav.main-nav a {
        padding: 3px 6px 3px 6px;
        line-height: 1.1;
        font-size: clamp(0.5rem, 3vw, 0.65rem);
        flex-shrink: 1;
        background: transparent !important;
        border-bottom: 2px solid transparent;
    }

    .main-nav a.is-active,
    nav.main-nav a.is-active {
        padding-bottom: 2px;
        color: #1DB954 !important;
        border-bottom-color: #1DB954 !important;
        background: transparent !important;
    }

    .search-container {
        height: 26px;
        max-width: none;
    }
    #search-input {
        padding: 5px 10px 5px 28px;
        font-size: 0.7rem;
    }
    .fa-search {
        left: 8px;
        font-size: 0.7rem;
    }
}