/* ==========================================
   DESIGN SYSTEM - A&A LOTERIAS HUB
   ========================================== */

:root {
    /* Cores Principais */
    --azul-caixa: #00366D;
    --azul-claro: #005CA9;
    --laranja-caixa: #F08200;
    --laranja-escuro: #d97700;
    
    /* Cores de Fundo e Texto */
    --fundo: #F4F6F8;
    --fundo-card: #FFFFFF;
    --texto: #333333;
    --texto-secundario: #666666;
    --borda: #E0E0E0;
    
    /* Estados */
    --sucesso: #28a745;
    --perigo: #dc3545;
    --aviso: #ffc107;

    /* Efeitos */
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 50px;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================
   NORMALIZAÇÃO CROSS-BROWSER (iOS / Android)
   Garante aparência idêntica em Safari, Chrome,
   Firefox e navegadores embarcados (WebView).
   ========================================== */

/* Remove estilos nativos de select em todos os browsers */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300366D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

/* Remove estilos nativos de input date em todos os browsers */
input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Previne zoom automático do iOS ao focar em inputs com font-size < 16px */
@media screen and (max-width: 768px) {
    select,
    input[type="date"],
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    textarea {
        font-size: max(16px, 1em);
    }
}

body { 
    background-color: var(--fundo); 
    color: var(--texto); 
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================
   HEADER PADRÃO DO HUB
   ========================================== */
.hub-header {
    background-color: var(--azul-caixa);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 5px solid var(--laranja-caixa);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 100;
}

.hub-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hub-header-left img.logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    padding: 5px;
    border: 2px solid var(--laranja-caixa);
}

.hub-header h1 {
    font-size: 1.2rem;
    color: white;
    font-weight: 700;
    margin: 0;
}

.hub-header .subtitle {
    color: white;
    font-size: 0.8rem;
    opacity: 0.9;
    margin-top: 2px;
}

.hub-header .subtitle strong {
    color: var(--laranja-caixa);
}

.hub-btn-back {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hub-btn-back:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .hub-header {
        padding: 12px 15px !important;
        gap: 15px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .hub-header-left {
        width: 100% !important;
        justify-content: center !important;
        margin-bottom: 2px;
    }

    .hub-header-right {
        width: 100% !important;
        justify-content: center !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding-top: 12px;
    }
    
    #admin-simulation-panel {
        margin-right: 0 !important;
        border-right: none !important;
        padding-right: 0 !important;
        width: 100% !important;
        justify-content: center !important;
        gap: 8px !important;
    }

    #simulate-role {
        max-width: 220px !important;
        width: 100% !important;
    }
    
    .user-profile {
        justify-content: center !important;
        width: 100% !important;
    }
    
    .hub-header h1 {
        font-size: 1.1rem;
    }
    
    .hub-header .subtitle {
        font-size: 0.75rem;
    }
    
    .hub-header-left img.logo {
        width: 38px;
        height: 38px;
        padding: 3px;
    }
    
    .hub-btn-back {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .hub-header-left {
        gap: 10px;
    }
}

/* ==========================================
   BOTÕES GERAIS
   ========================================== */
.btn-primary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    background-color: var(--laranja-caixa);
    color: white;
    text-align: center;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(240, 130, 0, 0.4);
    transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--laranja-escuro);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background-color: #cccccc;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    background-color: transparent;
    color: var(--azul-caixa);
    text-align: center;
    text-decoration: none;
    font-size: 1rem;
    font-weight: bold;
    border-radius: var(--radius-pill);
    border: 2px solid var(--azul-caixa);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(0, 54, 109, 0.05);
}

.btn-danger {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    background-color: var(--perigo);
    color: white;
    text-align: center;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.35);
    transition: all 0.2s ease;
}

.btn-danger:hover:not(:disabled) {
    background-color: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.45);
}

.btn-danger:disabled {
    background-color: #cccccc;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Botão Destrutivo Secundário (Outline / Clean UI) */
.btn-danger-outline {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background-color: transparent;
    color: #dc2626;
    border: 1.5px solid #fca5a5;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-danger-outline:hover:not(:disabled),
.btn-danger-outline:active:not(:disabled) {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #ef4444;
    transform: translateY(-1px);
}

/* Rodapé de Modais Responsivo */
.hub-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--borda);
    width: 100%;
}

.hub-modal-footer .btn-danger-outline {
    flex: 1;
    max-width: 50%;
    justify-content: center;
}

.hub-modal-footer .btn-modal-close {
    flex: 1;
    max-width: 50%;
    width: auto;
    padding: 10px 16px;
    font-size: 0.9rem;
    margin-top: 0;
    justify-content: center;
}

/* ==========================================
   CARDS & CONTAINERS
   ========================================== */
.container {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.card {
    background: var(--fundo-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--borda);
    border-left: 5px solid var(--azul-caixa);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   FORMULÁRIOS
   ========================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--azul-caixa);
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--borda);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background-color: var(--fundo-card);
    color: var(--texto);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300366D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--laranja-caixa);
}

/* ==========================================
   UTILIDADES GERAIS
   ========================================== */
.text-center { text-align: center; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

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

.animate-fade {
    animation: fadeIn 0.4s ease-out;
}

/* ==========================================
   UTILITIES PARA DÉBITOS (LISTAS E GRIDS)
   ========================================== */
.grid-3-cols {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-gap-2 {
    display: flex;
    gap: 10px;
}

.badge {
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.badge-success {
    background-color: var(--sucesso);
    color: white;
}

.badge-danger {
    background-color: var(--erro);
    color: white;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--borda);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: var(--fundo-card);
    transition: all 0.2s;
}

.list-item:hover {
    border-color: #cbd5e1;
}

.list-item.pendente {
    background-color: #fff8eb;
    border: 1px dashed #fcd34d;
}

.text-success { color: var(--sucesso) !important; font-weight: bold; }
.text-danger { color: var(--erro) !important; font-weight: bold; }
.text-warning { color: #d97700 !important; font-weight: bold; }
.text-muted { color: var(--texto-secundario); font-size: 0.85rem; }

.history-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--borda);
}

.saldo-display {
    background-color: var(--fundo);
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: center;
    margin-bottom: 15px;
    border: 1px solid var(--borda);
}

.saldo-display span {
    display: block;
}

.saldo-display .label {
    font-size: 0.8rem;
    color: var(--texto-secundario);
    text-transform: uppercase;
    font-weight: bold;
}

.saldo-display .value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--azul-caixa);
}

.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--texto-secundario);
    padding: 5px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--azul-caixa);
}

.btn-icon.danger:hover {
    color: var(--erro);
}

/* ==========================================
   COMPONENTES GLOBAIS (MODAL E TOAST)
   ========================================== */
.hub-toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--sucesso);
    color: white;
    text-align: center;
    border-radius: var(--radius-sm);
    padding: 16px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

.hub-toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

.hub-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(3px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.hub-modal-content {
    background: var(--fundo-card);
    width: 100%; max-width: 450px;
    border-radius: var(--radius-lg);
    padding: 25px;
    position: relative;
    box-shadow: var(--shadow-lg);
    border-top: 5px solid var(--laranja-caixa);
    display: flex; flex-direction: column; gap: 15px;
    margin: auto;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease-out;
}

.hub-modal-close {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--texto-secundario);
    font-weight: bold;
    line-height: 1;
    background: none;
    border: none;
    transition: color 0.2s;
}

.hub-modal-close:hover {
    color: var(--perigo);
}

@media (max-width: 480px) {
    .hub-modal-overlay {
        padding: 10px;
        align-items: flex-start;
    }
    .hub-modal-content {
        padding: 20px 16px;
        border-radius: var(--radius-lg);
        max-height: 92vh;
        overflow-y: auto;
        margin: 10px auto 25px auto;
    }
}

/* ==========================================
   HUB PRINCIPAL (INDEX)
   ========================================== */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .hub-grid {
        grid-template-columns: 1fr;
    }
}

.hub-card {
    background: var(--fundo-card);
    border-radius: var(--radius-md);
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: var(--texto);
    box-shadow: var(--shadow-md);
    border-top: 5px solid var(--azul-caixa);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.hub-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--laranja-caixa);
}

.hub-card i {
    font-size: 3rem;
    color: var(--azul-caixa);
    transition: color 0.3s;
}

.hub-card:hover i {
    color: var(--laranja-caixa);
}

.hub-card h3 {
    font-size: 1.2rem;
    color: var(--azul-caixa);
    margin: 0;
}

.hub-card p {
    font-size: 0.9rem;
    color: var(--texto-secundario);
    margin: 0;
    line-height: 1.4;
}

.welcome-section {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.welcome-section h2 {
    color: var(--azul-caixa);
    margin-bottom: 10px;
}

.hub-login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(244, 246, 248, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 100%;
    border-top: 5px solid var(--azul-caixa);
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border: 2px solid var(--laranja-caixa);
    border-radius: 50%;
    padding: 5px;
    object-fit: contain;
}

.btn-google {
    background-color: white;
    color: #757575;
    border: 1px solid #ddd;
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
    margin-top: 25px;
}

.btn-google:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
    background-color: #f8f9fa;
}

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

#hub-content {
    display: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 0.9rem;
    text-align: left;
}

.user-profile img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--laranja-caixa);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: 0.2s;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
}
