/* Reset Total para App Mobile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body {
    height: auto;
    min-height: 100vh;
    width: 100vw;
    max-width: 100vw;
    overflow: visible;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: linear-gradient(135deg, #cbd4fd 0%, #edfaed 100%);
    background-attachment: fixed;
    background-size: cover;
}

/* Container Principal como App Mobile */
.app-container {
    width: 100vw;
    min-height: 100vh;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    position: relative;
    background: #f8f9fa;
    overflow: visible;
    display: flex;
    flex-direction: column;
    box-shadow: none;
}

/* Para tablets: centraliza com aparência de smartphone */
@media (min-width: 400px) and (max-width: 899px) {
    body {
        background: linear-gradient(135deg, #28A745 0%, #1E7E34 100%);
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        padding: 0px;
    }

    .app-container {
        width: 100%;
        /* Largura típica de smartphone */
        height: 100%;
        /* Altura típica de smartphone */
        min-height: 667px;
        border-radius: 30px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(116, 115, 115, 0.3);
        position: relative;
    }

    /* Simulação de notch/status bar para iPhone */
    .app-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40%;
        height: 25px;
        background: #000;
        border-radius: 0 0 15px 15px;
        z-index: 1001;
        pointer-events: none;
    }
}

/* Desktop: layout mais amplo, com grade/espacamento consistente */
@media (min-width: 900px) {
    body {
        background: linear-gradient(135deg, #f8f9fa 0%, #e8e8e8 100%);
        display: block;
        min-height: 100vh;
        /* padding: 24px; */
    }

    .app-container {
        max-width: 1200px;
        margin: 0 auto;
        min-height: 0;
        border-radius: 18px;
        overflow: hidden;
    }

    /* No desktop, evita "moldura"/notch e melhora navegação */
    .app-container::before {
        display: none;
    }

    .main-menu {
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: center;
    }

    .menu-btn {
        min-width: 140px;
    }

    .app-content {
        overflow-y: visible;
        padding: 24px 20px;
    }

    .app-container::before {
        content: none;
    }

    .main-menu {
        position: sticky;
        top: 60px;
        z-index: 999;
        padding: 12px 16px;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .menu-scroll-indicator {
        display: none;
    }

    .menu-btn {
        min-width: 0;
        padding: 10px 14px;
        font-size: 14px;
    }

    .app-content {
        padding: 24px;
        overflow: visible;
    }

    .app-card,
    .termos-container,
    .app-content>.container,
    .app-content>.card {
        max-width: 980px;
        margin-left: auto;
        margin-right: auto;
        padding: 22px 22px;
        margin-bottom: 20px;
    }

    .app-page-title {
        font-size: 26px;
        margin-bottom: 10px;
    }

    .app-page-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

/* Header do App - Fixo em todas páginas */
.app-header {
    background: linear-gradient(135deg, #0f172a 0%, #1f2a44 55%, #0b4c5f 100%);
    color: white;
    padding: 0 15px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    width: 100vw;
    max-width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.app-logo {
    height: 35px;
    width: auto;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botões de ação */
.icon-btn {
    background: none;
    border: none;
    color: white;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 40px;
    height: 40px;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Menu Principal (Abaixo do Header) */
.main-menu {
    background: white;
    padding: 10px 15px;
    display: flex;
    margin-top: 60px;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-bottom: 1px solid #eaeaea;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}

.main-menu::-webkit-scrollbar {
    display: none;
}

.menu-btn {
    flex: 0 0 auto;
    padding: 12px 18px;
    border-radius: 25px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    color: white;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.menu-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Cores específicas para cada loteria */
.btn-mega {
    background: linear-gradient(135deg, #209869 0%, #1a7a56 100%);
}

.btn-lotofacil {
    background: linear-gradient(135deg, #930089 0%, #7a006e 100%);
}

.btn-lotomania {
    background: linear-gradient(135deg, #F78100 0%, #d66d00 100%);
}

.btn-quina {
    background: linear-gradient(135deg, #260085 0%, #1d0068 100%);
}

.btn-dupla {
    background: linear-gradient(135deg, #8A8A09 0%, #707007 100%);
}
.btn-time-mania {
    background: linear-gradient(135deg, #FF5733 0%, #C70039 100%);
}
.btn-dia-da-sorte {
    background: linear-gradient(135deg, #28A745 0%, #1E7E34 100%);
}
.btn-super-sete {
    background: linear-gradient(135deg, #FFC300 0%, #FF5733 100%);
}
.btn-milionaria {
    background: linear-gradient(135deg, #800080 0%, #4B004B 100%);
}
.btn-federal {
    background: linear-gradient(135deg, #103099 0%, #8797cb 100%);
}
.btn-cercar {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-help {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

/* Menu Lateral (Drawer) */
.app-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;    
    height: 100%;
    background: white;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer-header {
    background: linear-gradient(135deg, #0f172a 0%, #1f2a44 55%, #0b4c5f 100%);
    color: white;
    padding: 20px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-email {
    font-size: 12px;
    opacity: 0.9;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

.drawer-item {
    display: block;
    padding: 18px 25px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.drawer-item:active {
    background: #f8f9fa;
    color: #209869;
    border-left-color: #209869;
}

.drawer-item .icon {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    display: inline-block;
}

.drawer-footer {
    padding: 20px 25px;
    border-top: 1px solid #eaeaea;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:active {
    transform: scale(0.98);
    box-shadow: 0 2px 5px rgba(220, 53, 69, 0.3);
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

/* Conteúdo Principal */
.app-content {
    flex: 1;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding: 20px 15px;
    position: relative;
    margin-top: 0;
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Classes utilitárias */
.drawer-open .app-drawer {
    transform: translateX(0);
}

.drawer-open .drawer-overlay {
    opacity: 1;
    visibility: visible;
}

/* Responsividade para telas muito pequenas */
@media (max-width: 320px) {
    .menu-btn {
        padding: 10px 15px;
        font-size: 13px;
        min-width: 90px;
    }

    .app-header {
        padding: 12px;
    }

    .app-title {
        font-size: 16px;
    }
}

/* Suporte a modo PWA */
@media (display-mode: standalone) {
    .app-header {
        padding-top: max(15px, env(safe-area-inset-top));
        padding-bottom: 15px;
        min-height: calc(60px + env(safe-area-inset-top));
    }

    .app-content {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .bottom-nav {
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        height: calc(64px + env(safe-area-inset-bottom));
    }
}

/* Prevenir seleção de texto em botões */
button,
a {
    user-select: none;
    -webkit-user-select: none;
}

/* Estados visuais (desktop): hover/focus claro e consistente */
@media (hover: hover) {
    .menu-btn:hover {
        filter: brightness(1.05);
        transform: translateY(-1px);
    }

    .icon-btn:hover {
        background: rgba(255, 255, 255, 0.12);
    }

    .drawer-item:hover {
        background: #f3f4f6;
    }

    .btn-logout:hover {
        filter: brightness(1.05);
    }
}

:where(a, button, input, select, textarea, .menu-btn, .icon-btn, .drawer-item):focus-visible {
    outline: 3px solid rgba(32, 152, 105, 0.45);
    outline-offset: 2px;
}

/* Feedback tátil para iOS */
@supports (-webkit-touch-callout: none) {

    .menu-btn:active,
    .icon-btn:active,
    .drawer-item:active {
        opacity: 0.7;
    }
}

/* Indicador de scroll para o menu */
.menu-scroll-indicator {
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(32, 152, 105, 0.2);
    border-radius: 2px;
    overflow: hidden;
    pointer-events: none;
}

.scroll-progress {
    height: 100%;
    background: #209869;
    width: 0%;
    transition: width 0.3s;
}

/* Navegacao inferior no fluxo da pagina */
.bottom-nav {
    position: static;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    z-index: 1000;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: #1f2937;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 4px;
    border-radius: 10px;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.bottom-nav-item svg {
    display: block;
}

.bottom-nav-item:active {
    transform: scale(0.98);
}

.bottom-nav-item.active {
    color: #209869;
    border-bottom: 3px solid #209869;
    font-weight: 700;
}

@media (hover: hover) {
    .bottom-nav-item:hover {
        background: #f3f4f6;
        color: #0f766e;
    }
    
    .bottom-nav-item.active:hover {
        background: rgba(32, 152, 105, 0.1);
        color: #209869;
    }
}

/* ==========================
           Layout padrao de paginas
           ========================== */

.app-content {
    padding: 16px 0px;
}

.app-page-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
    color: #111827;
}

.app-page-subtitle {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 16px;
}

.app-card,
.termos-container,
.app-content>.container,
.app-content>.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 14px;
    margin-bottom: 16px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
}

.app-card h2,
.termos-container h2,
.app-content>.container h2,
.app-content>.card h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.app-text,
.termos-container p,
.app-content p {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 10px;
}

.app-list {
    margin: 8px 0 8px 18px;
    font-size: 13px;
    color: #4b5563;
}

.app-list li {
    margin-bottom: 4px;
}

.app-image,
.app-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 10px 0;
}

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

.display-4 {
    font-size: 20px;
    font-weight: 700;
}

.display-6 {
    font-size: 16px;
    font-weight: 600;
}

.lead {
    font-size: 13px;
    color: #4b5563;
}

.card-header {
    margin-bottom: 10px;
}

.card-body {
    margin-bottom: 10px;
}

.card-footer {
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
}