@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    color: #0F172A; /* Slate 900 for modern deep text */
    background: #F8FAFC; /* Slate 50 for premium soft background */
    --primary: #4F46E5; /* Indigo 600 */
    --primary-hover: #4338CA; /* Indigo 700 */
    --card-bg: #FFFFFF;
    --border: #E2E8F0; /* Slate 200 */
    --text-muted: #64748B; /* Slate 500 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }

/* Cabeçalho Premium */
.topo { 
    background: linear-gradient(135deg, #1E1B4B, #312E81); 
    color: #fff; 
    padding: 24px 24px; 
    border-bottom-left-radius: 20px; 
    border-bottom-right-radius: 20px; 
    margin-bottom: 32px; 
    box-shadow: var(--shadow-md); 
}
.topo-conteudo { max-width: 1100px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topo h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.topo-acoes { display: flex; gap: 10px; align-items: center; }

.conteudo { width: min(94%, 1100px); margin: 32px auto 60px; }
.login-caixa { width: min(100%, 460px); margin: 60px auto; padding: 40px 32px; background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.login-caixa h1 { text-align: center; margin-top: 0; font-size: 32px; font-weight: 900; letter-spacing: -0.03em; color: var(--primary); }
.subtitulo { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-weight: 500; }

.usuarios { display: grid; gap: 16px; margin-bottom: 28px; }
.usuario-opcao input { position: absolute; opacity: 0; }
.usuario-cartao { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 2px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: all .2s ease; background: var(--card-bg); }
.usuario-opcao input:checked + .usuario-cartao { border-color: var(--primary); background: #F5F3FF; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.12); transform: translateY(-2px); }
.avatar { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: #E0E7FF; font-size: 24px; }

.campo { margin-bottom: 20px; }
.campo label, .form-empilhado > label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: #334155; }
.campo input, .campo select, .campo textarea, .form-empilhado input, .form-empilhado select, .controle-linha input { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; transition: all 0.2s; font-size: 15px; color: #0F172A; box-shadow: var(--shadow-sm); }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); }
.campo input[type="password"], .form-empilhado input[type="password"] { text-align: center; letter-spacing: 8px; font-size: 20px; font-weight: 700; }
textarea { resize: vertical; }
small { color: var(--text-muted); font-size: 13px; }

/* Botões Modernos */
.botao { width: 100%; padding: 14px 20px; border: 0; border-radius: var(--radius-md); background: var(--primary); color: #fff; font-weight: 600; font-size: 15px; letter-spacing: 0.01em; cursor: pointer; box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25); transition: all 0.2s ease; }
.botao:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3); }
.botao:active { transform: translateY(1px); box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2); }
.botao-secundario { width: auto; background: transparent; border: 1px solid rgba(255,255,255,.4); box-shadow: none; }
.botao-secundario:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,.8); box-shadow: none; }
.botao-claro { width: auto; background: rgba(255,255,255,0.15); color: #fff; border: 1px solid transparent; box-shadow: none; }
.botao-claro:hover { background: rgba(255,255,255,0.25); box-shadow: none; }
.botao-sucesso { background: #10B981; box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25); }
.botao-sucesso:hover { background: #059669; box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3); }
.botao-perigo { background: #EF4444; box-shadow: 0 4px 6px rgba(239, 68, 68, 0.25); }
.botao-perigo:hover { background: #DC2626; box-shadow: 0 6px 12px rgba(239, 68, 68, 0.3); }
.botao-aviso { background: #F59E0B; }

.alerta { margin-bottom: 20px; padding: 14px 18px; border-radius: var(--radius-md); font-size: 14px; font-weight: 500; display: flex; align-items: center; border: 1px solid transparent; }
.alerta-erro { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.alerta-sucesso { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }

.semana { margin-bottom: 24px; padding: 16px 20px; background: var(--card-bg); border-radius: var(--radius-lg); color: var(--text-muted); box-shadow: var(--shadow-sm); border: 1px solid var(--border); font-size: 14px; }
.semana strong { color: #0F172A; }
.separador { margin: 0 10px; opacity: 0.5; }
.uso-liberado { color: #059669; font-weight: 600; }
.uso-bloqueado { color: #D97706; font-weight: 600; }

.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.grade-filho { align-items: start; }

/* Cartões */
.cartao { padding: 24px; background: var(--card-bg); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); border: 1px solid var(--border); transition: box-shadow 0.2s ease; }
.cartao:hover { box-shadow: var(--shadow-lg); }
.cartao h2, .cartao h3 { margin-top: 0; color: #0F172A; font-weight: 700; letter-spacing: -0.01em; }
.cartao h2 { font-size: 20px; margin-bottom: 16px; }
.cartao h3 { font-size: 18px; }
.cartao-titulo-linha, .pedido-cabecalho { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.saldo { margin: 12px 0 8px; color: var(--primary); font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.secao { margin-top: 40px; }
.secao > h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 20px; color: #0F172A; }
.mensagem-vazia { color: var(--text-muted); font-size: 15px; }
.texto-alerta { color: #EF4444; font-size: 14px; font-weight: 500; }

.lista-pedidos { display: grid; gap: 16px; }
.pedido-cartao { padding: 20px 24px; border-radius: var(--radius-lg); }
.pedido-cabecalho h3 { margin: 6px 0 0; font-size: 17px; }
.etiqueta { display: inline-flex; align-items: center; justify-content: center; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; letter-spacing: 0.02em; text-transform: uppercase; }
.status-pendente { background: #FEF3C7; color: #92400E; }
.status-aprovado { background: #D1FAE5; color: #065F46; }
.status-recusado { background: #FEE2E2; color: #991B1B; }

.aviso-inline { margin: 12px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: #FEF3C7; color: #92400E; font-size: 14px; border: 1px solid #FDE68A; }
.observacao { margin-top: 12px; padding: 14px; background: #F8FAFC; border-radius: var(--radius-md); font-size: 14px; color: #475569; border: 1px solid var(--border); }

.form-grade { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: end; margin-top: 20px; }
.form-empilhado { display: grid; gap: 16px; }
.form-empilhado > label { margin: 0; }
.acoes { grid-column: 1 / -1; display: flex; gap: 12px; margin-top: 8px; }
.acoes form { flex: 1; }
.acoes .botao { min-width: 140px; }
.controle-linha { display: grid; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.controle-linha:last-child { border-bottom: 0; }

.sessao-card { text-align: center; }
.cronometro { font-size: clamp(40px, 9vw, 72px); font-weight: 900; letter-spacing: 1px; color: var(--primary); margin: 12px 0; font-variant-numeric: tabular-nums; }

.filtros { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end; margin-bottom: 24px; }
.filtros .campo { margin: 0; }
.resumo-grade { margin-bottom: 24px; }
.resumo-lista { margin: 0; }
.resumo-lista > div { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid #F1F5F9; font-size: 15px; }
.resumo-lista dt { color: var(--text-muted); }
.resumo-lista dd { margin: 0; font-weight: 600; color: #0F172A; }

.tabela-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--text-muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; background: #F8FAFC; }
.tempo-positivo { color: #059669; font-weight: 700; }
.tempo-negativo { color: #DC2626; font-weight: 700; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
    .topo-conteudo { align-items: flex-start; flex-direction: column; gap: 16px; }
    .topo-acoes { width: 100%; }
    .topo-acoes .botao { flex: 1; justify-content: center; }
    .login-caixa { padding: 32px 24px; margin: 30px auto; border-radius: 20px; border: none; box-shadow: var(--shadow-md); }
    .form-grade, .filtros { grid-template-columns: 1fr; }
    .acoes { grid-column: auto; flex-direction: column; }
    .acoes .botao { width: 100%; }
    .pedido-cabecalho { flex-direction: column; gap: 8px; }
}

/* ADMIN TABS */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: var(--card-bg);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-btn {
    flex: 1;
    white-space: nowrap;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.tab-btn:hover {
    background: #F1F5F9;
    color: #334155;
}
.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}
.tab-content {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Select Bonito Customizado */
.select-bonito {
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #fff;
    font-size: 15px;
    font-weight: 600;
    color: #0F172A;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2364748B" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position-x: calc(100% - 12px);
    background-position-y: 50%;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}
.select-bonito:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ========================================= */
/* TROCATEMPO 2.0 - GAMIFIED MOBILE-FIRST UI */
/* ========================================= */
body:not([data-perfil="responsavel"]):not([data-perfil=""]) .topo { display: none !important; }
body:not([data-perfil="responsavel"]):not([data-perfil=""]) .conteudo { margin-top: 0; padding-top: 16px; padding-bottom: 90px; width: 100%; max-width: 800px; }

/* Top App Bar */
.child-app-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px 24px;
}
.child-avatar-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    box-shadow: var(--shadow-md);
}
.child-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.child-app-bar h2 {
    margin: 0;
    font-size: 24px;
    color: #0F172A;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Gamified Circular Balance Card */
.gamified-balance-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 32px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin: 0 20px 28px;
    position: relative;
    overflow: hidden;
}
.gamified-balance-card::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -40px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.circular-progress-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.circular-progress {
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--progress) * 1%), #F1F5F9 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 0 0 10px rgba(79, 70, 229, 0.05);
}
.inner-circle {
    width: 180px;
    height: 180px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}
.balance-number {
    font-size: 48px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -0.03em;
}
.balance-label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}
.balance-subtitle {
    color: var(--text-muted);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    padding: 0 16px;
    font-weight: 500;
}

/* Gamified Actions Grid */
.gamified-actions {
    gap: 16px;
    padding: 0 20px;
}
.btn-gamified-ganhar, .btn-gamified-usar {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px !important;
    border-radius: var(--radius-xl) !important;
    border: 1px solid var(--border) !important;
    background: #fff !important;
    box-shadow: var(--shadow-sm) !important;
    transition: all 0.2s ease !important;
}
.btn-gamified-ganhar:hover, .btn-gamified-usar:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px) !important;
}
.btn-gamified-ganhar .atalho-icone, .btn-gamified-usar .atalho-icone {
    width: 60px;
    height: 60px;
    font-size: 28px;
    border-radius: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-gamified-ganhar .atalho-icone {
    background: #FEF3C7;
    color: #D97706;
}
.btn-gamified-usar .atalho-icone {
    background: #ECFDF5;
    color: #059669;
}
.btn-gamified-ganhar h3, .btn-gamified-usar h3 {
    margin: 0 0 6px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #0F172A !important;
}
.btn-gamified-ganhar p, .btn-gamified-usar p {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--text-muted) !important;
    font-weight: 500;
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
}
body:not([data-perfil="responsavel"]):not([data-perfil=""]) .bottom-nav {
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
    padding: 12px 10px 24px;
    z-index: 1000;
    border-top: 1px solid var(--border);
}
.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    gap: 6px;
    transition: 0.2s ease;
    padding: 8px 20px;
    border-radius: var(--radius-lg);
    letter-spacing: 0.02em;
}
.bottom-nav .nav-icon {
    font-size: 22px;
    opacity: 0.6;
    transition: 0.2s ease;
}
.bottom-nav .nav-item.ativo {
    color: var(--primary);
    background: #EEF2FF;
}
.bottom-nav .nav-item.ativo .nav-icon {
    opacity: 1;
}

body:not([data-perfil="responsavel"]):not([data-perfil=""]) .secao {
    padding: 0 20px;
}
