/* ==================================================
   RL GESTÃO – APP CSS
   Baseado em login.php + home.php
   Mobile First | PWA
================================================== */

/* =========================
   VARIÁVEIS
========================= */
:root {
  /* Cores principais */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Backgrounds e Superfícies */
  --bg: #f5f6f8;
  --card: #ffffff;
  --border-color: #e5e7eb;

  /* Texto */
  --text: #111827;
  --muted: #6b7280;

  /* Variáveis extras mapeadas do Dashboard de Ponto */
  --cor-primaria: var(--primary);
  --cor-primaria-hover: var(--primary-dark);
  --cor-branca: var(--card);
  --cor-texto: var(--text);
  --cor-borda: var(--border-color);
  --cor-sombra: rgba(0, 0, 0, .06);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Espaçamento */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;

  /* Sombras */
  --shadow-sm: 0 2px 6px rgba(0,0,0,.08);
  --shadow-md: 0 6px 16px rgba(0,0,0,.12);

  /* Layout */
  --header-h: 72px;
  --bottom-h: 82px;

  /* Transição */
  --transition: .2s ease;
}

/* =========================
   RESET
========================= */
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body{
  height: 100%;
}

body{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  overflow-x: hidden; /* remove scroll horizontal global */
}

/* =========================
   UTILITÁRIOS
========================= */
.hidden{ display: none; }
.text-center{ text-align: center; }

.mt-1{ margin-top: var(--space-1); }
.mt-2{ margin-top: var(--space-2); }
.mt-3{ margin-top: var(--space-3); }
.mt-4{ margin-top: var(--space-4); }

/* =========================
   LAYOUT
========================= */
.container{
  height: calc(100vh - var(--header-h) - var(--bottom-h));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--space-4);
  padding-bottom: 130px !important; /* evita esconder conteúdo */
  max-width: 100%;
}

/* =========================
   TIPOGRAFIA
========================= */
h1, h2, h3{ font-weight: 600; }

p{
  font-size: 14px;
  color: var(--muted);
}

/* =========================
   HEADER (home.php)
========================= */
.header{
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--space-4);
  background: var(--card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left{
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-left strong{ 
  display: block;
  font-size: 15px; 
}

.header-left small{
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   LOGOUT BUTTON
========================= */
.logout-btn{
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  background: #fee2e2;
  color: var(--danger);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.logout-btn:hover{
  background: var(--danger);
  color: var(--card);
}

.logout-btn:active{
  transform: scale(.92);
}

/* =========================
   SECTION TITLE
========================= */
.section-title{
  font-size: 14px;
  color: #334155;
  margin-bottom: 12px;
  font-weight: 600;
  text-align: center;
}

/* =========================
   GRID (home.php)
========================= */
.grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  width: 100%;
  max-width: 100%;
  height: calc(100vh - var(--header-h) - var(--bottom-h) - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 20px;
}

.grid-item{
  aspect-ratio: 1/1;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  min-width: 0;
  overflow: hidden;
  padding: var(--space-4);
}

.grid-item i{
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 8px;
}

.grid-item p{
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.grid-item:active{
  transform: scale(.96);
}

@media (hover:hover){
  .grid-item:hover{
    box-shadow: var(--shadow-md);
  }
}

/* =========================
   BOTTOM NAV
========================= */
.bottom-nav{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: var(--bottom-h);
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--card);
  border-top: 1px solid var(--border-color);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -8px 20px rgba(0,0,0,.08);
  z-index: 100;
}

.nav-item{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 70px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 12px;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item i{ font-size: 20px; }

.nav-item.active{
  color: var(--primary);
  font-weight: 600;
}

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

/* =========================
   LOGIN (login.php)
========================= */
.login-wrapper{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: var(--bg);
}

.login-card{
  width: 100%;
  max-width: 360px;
  background: var(--card);
  padding: 28px var(--space-5) 32px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
  text-align: center;
  animation: fadeIn .25s ease;
}

/* 🔥 CONTROLE DEFINITIVO DA LOGO */
.login-card img.logo{
  width: 250px !important;
  max-width: 60% !important;
  height: auto !important;
  margin: 0 auto 12px !important;
  display: block;
}

.login-card p{
  color: var(--muted);
  margin: 12px 0 16px;
  font-size: 14px;
}

/* =========================
   FEEDBACK (login.php)
========================= */
.feedback{
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  text-align: left;
  animation: fadeIn .2s ease;
}

.feedback.error{
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.feedback.success{
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

/* 🔥 BOTÃO GOOGLE CENTRALIZADO */
#googleBtn{
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* =========================
   ANIMAÇÕES
========================= */
@keyframes fadeIn{
  from{
    opacity: 0;
    transform: translateY(10px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   FIXES LOGIN + HOME
===================================================== */

/* Garante que views não gerem scroll lateral */
#homeView,
#menuView{
  overflow-x: hidden;
}

/* ==================================================
   PAGE HEADER
================================================== */
.page-header{
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--header-h);
    background: var(--card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 20;
}

.page-title{
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

/* ==================================================
   LISTA MODERNA (VERSÃO MELHORADA UI)
================================================== */
.list{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
}

/* CARD PRINCIPAL */
.list-card{
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 18px;
  padding: 18px var(--space-4);
  min-height: 92px;
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(0,0,0,.06),
    0 1px 2px rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.04);
  transition: all .18s ease;
  position: relative;
  overflow: hidden;
}

/* leve destaque lateral (toque moderno) */
.list-card::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: transparent;
  transition: var(--transition);
}

/* efeito toque mobile */
.list-card:active{
  transform: scale(.985);
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}

/* hover desktop */
@media (hover:hover){
  .list-card:hover{
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0,0,0,.10);
  }

  .list-card:hover::before{
    background: var(--primary);
  }
}

/* lado esquerdo */
.list-info{
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* título */
.list-title{
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: .2px;
}

/* subtítulo */
.list-subtitle{
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ícone avatar */
.list-title i{
  font-size: 20px;
  color: var(--primary);
  opacity: .9;
}

/* seta direita */
.list-arrow{
  font-size: 20px;
  color: #94a3b8;
  transition: var(--transition);
}

/* animação leve na seta */
.list-card:hover .list-arrow{
  transform: translateX(2px);
  color: var(--primary);
}

.list-card:last-child{
    margin-bottom: 20px;
}

/* ==================================================
   FORM COMPONENTS
================================================== */
.form{
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-card{
    background: var(--card);
    border-radius: 18px;
    padding: 20px;
    border: 1px solid rgba(0,0,0,.05);
    box-shadow:
        0 2px 8px rgba(0,0,0,.05),
        0 1px 2px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ---------- LINHAS ---------- */
.form-row{
    display: flex;
    gap: 14px;
}

.form-row .form-group{
    flex: 1;
}

/* ---------- CAMPOS ---------- */
.form-group{
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-label{
    font-size: 13px;
    font-weight: 700 !important;
    color: #475569 !important;
}

/* ---------- INPUT / SELECT ---------- */
.form-input{
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid #dbe2ea;
    background: var(--card);
    color: var(--text);
    font-size: 15px;
    transition: var(--transition);
}

.form-input::placeholder{
    color: #9ca3af;
}

.form-input:focus{
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

/* ---------- TEXTAREA ---------- */
textarea.form-input{
    min-height: 120px;
    padding: 14px 16px;
    resize: vertical;
    line-height: 1.5;
}

/* ---------- SELECT ---------- */
select.form-input{
    appearance: none;
    -webkit-appearance: none;
    padding-right: 46px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* ---------- INPUT PEQUENO ---------- */
.form-input-sm{
    height: 42px;
    font-size: 14px;
}

/* ---------- INPUT GRANDE ---------- */
.form-input-lg{
    height: 60px;
    font-size: 16px;
}

/* ---------- CHECKBOX ---------- */
.form-check{
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text);
}

.form-check input{
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ---------- RADIO ---------- */
.form-radio{
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.form-radio input{
    accent-color: var(--primary);
}

/* ---------- SWITCH ---------- */
.form-switch{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}

.form-switch label{
    font-size: 15px;
    font-weight: 500;
}

/* ---------- AJUDA ---------- */
.form-help{
    font-size: 12px;
    color: var(--muted);
}

/* ---------- ERRO ---------- */
.form-error{
    font-size: 12px;
    color: var(--danger);
}

/* ---------- DIVISOR ---------- */
.form-divider{
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

/* ---------- TÍTULO ---------- */
.form-title{
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.form-subtitle{
    font-size: 13px;
    color: var(--muted);
}

/* ---------- BOTÃO ---------- */
.form-button{
    height: 52px;
    border: none;
    border-radius: 14px;
    background: var(--primary);
    color: var(--card);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.form-button:active{
    transform: scale(.98);
}

/* ---------- DESABILITADO ---------- */
.form-input:disabled{
    background: #f3f4f6;
    color: #9ca3af;
}

.nav-item.danger{
    color: var(--danger);
}

.nav-item.danger i{
    color: var(--danger);
}

@media (hover:hover){
    .nav-item.danger:hover{
        color: #b91c1c;
    }
}

/* =====================================================
   DETALHES DO USUÁRIO (INPUTS DESABILITADOS)
===================================================== */
.form-input[disabled],
.form-input[readonly] {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    opacity: 1 !important;
    border: 1px solid #cbd5e1 !important;
    font-weight: 600;
    -webkit-text-fill-color: #0f172a;
    box-shadow: none !important;
}

/* CARD mais limpo e moderno */
.form-card {
    background: var(--card) !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.05) !important;
}

/* separação visual entre blocos */
.form-card + .form-card {
    margin-top: 16px;
}

/* melhora leitura em telas pequenas */
@media (max-width: 480px) {
    .form-input[disabled] {
        font-size: 15px;
    }
    .form-label {
        font-size: 12px;
    }
}

/* ===============================
   DASHBOARD DE PONTO
================================ */
.dashboard-card {
    flex: 1;
    background: var(--cor-branca);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px var(--cor-sombra);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.dashboard-card strong {
    font-size: 28px;
    color: var(--cor-primaria);
    font-weight: 700;
}

.dashboard-card span {
    font-size: 14px;
    color: var(--cor-texto);
}

/* Status do ponto */
.ponto-status {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 20px;
}

.ponto-status.pendente {
    background: #fff3cd;
    color: #856404;
}

.ponto-status.andamento {
    background: #cfe2ff;
    color: #084298;
}

.ponto-status.finalizado {
    background: #d1e7dd;
    color: #0f5132;
}

/* Ajuste dos gráficos */
.form-card canvas {
    width: 100% !important;
    max-height: 300px;
    margin-top: 15px;
}

/* Botão principal */
.btn-primary {
    width: 100%;
    border: none;
    padding: 15px;
    border-radius: 12px;
    background: grey;
    color: var(--card);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--cor-primaria-hover);
}

/* Select do filtro */
select.form-input {
    appearance: auto;
}

/* ===============================
   BOTÃO FILTRO
================================ */
.btn-filter {
    width: 100%;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--cor-primaria);
    color: var(--card);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-filter:hover {
    background: var(--cor-primaria-hover);
}

.btn-filter:active {
    transform: scale(0.98);
}

/* Responsividade de formulários (Mobile) */
@media(max-width:600px){
    .form-row {
        flex-direction: column;
    }
    .dashboard-card strong {
        font-size: 24px;
    }
}

/* =================================
   PONTO - CARDS DE INFORMAÇÃO
================================= */
.ponto-info-grid{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.ponto-info-card{
    background: var(--cor-branca);
    border: 1px solid var(--cor-borda);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 120px;
    box-shadow: 0 4px 12px var(--cor-sombra);
}

.ponto-info-card i{
    font-size: 28px;
    color: var(--cor-primaria);
    margin-bottom: 10px;
}

.ponto-info-card span{
    font-size: 14px;
    color: var(--cor-texto);
    opacity: .7;
}

.ponto-info-card strong{
    font-size: 24px;
    margin-top: 5px;
    color: var(--cor-texto);
}

/* CARD DE HORAS */
.ponto-info-card.destaque{
    grid-column: span 2;
}

.ponto-info-card.destaque strong{
    font-size: 32px;
}

/* STATUS DO PONTO */
.ponto-status{
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    text-align: center;
    font-weight: bold;
    margin: 20px 0;
    font-size: 16px;
}

.ponto-status.pendente{
    background: #fff3cd;
    color: #856404;
}

.ponto-status.andamento{
    background: #d1ecf1;
    color: #0c5460;
}

.ponto-status.finalizado{
    background: #d4edda;
    color: #155724;
}

/* RESPONSIVO MOBILE */
@media(max-width:600px){
    .ponto-info-grid{
        grid-template-columns: 1fr;
    }
    .ponto-info-card.destaque{
        grid-column: span 1;
    }
}

/* =====================================================
   AJUSTE FINAL - SCROLL + BOTTOM NAV
   Histórico de ponto e listas
===================================================== */

/* Lista com rolagem própria */
.lista-scroll{
    max-height: calc(100vh - 360px);
    overflow-y: auto;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Ajuste mobile */
@media(max-width:600px){
    .lista-scroll{
        max-height: calc(100vh - 340px);
    }
}

/* =================================
   PONTO INFO CARD - LAYOUT HORIZONTAL
================================= */
.ponto-info-card{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    text-align: left;
    min-height: 80px;
    padding: 16px;
}

.ponto-info-card i{
    margin: 0;
    font-size: 28px;
}

.ponto-info-card span{
    font-size: 13px;
}

.ponto-info-card strong{
    font-size: 22px;
    margin: 0;
}

/* Mantém o card de horas destacado */
.ponto-info-card.destaque{
    grid-column: span 2;
}

@media(max-width:600px){
    .ponto-info-card.destaque{
        grid-column: span 1;
    }
}


/* =====================================================
   🖥️ RESPONSIVIDADE PARA PC / TABLET (Telas maiores)
===================================================== */
@media (min-width: 768px) {
  
  /* Centraliza a estrutura principal e define um limite confortável */
  .header,
  .container,
  .page-header {
    max-width: 1024px;
    margin-left: auto;
    margin-right: auto;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }

  /* Ajusta a barra de topo para não flutuar solta no desktop */
  .header, .page-header {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }

  /* Transforma o menu inferior em um dock centralizado */
  .bottom-nav {
    max-width: 1024px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* Distribui o menu em 4 colunas em vez de apenas 2 enormes */
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    height: auto; /* Deixa o conteúdo ditar a altura no desktop */
  }

  /* Expande os itens do grid para uma proporção melhor */
  .grid-item {
    aspect-ratio: auto;
    padding: var(--space-5) var(--space-4);
  }

  /* Reduz o scroll excessivo de listas limitando a altura de forma ideal */
  .lista-scroll {
    max-height: 60vh;
  }

  /* Ajuste inteligente no Grid de Informações de Ponto */
  .ponto-info-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Ajusta o card de destaque do ponto */
  .ponto-info-card.destaque {
    grid-column: span 2;
  }
}

