/* style.css */

/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* VARIÁVEIS */
:root {
  --primary-color: #7b69fc;
  --text-color: #333;
  --bg-color: #ffffff;
  --sidebar-width: 250px;
}

/* BODY */
body {
  font-family: Arial, sans-serif;
  background-color: #f9f9f9;
  color: var(--text-color);
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #2e2e2e;
  border-bottom: 1px solid #ddd;
  padding: 0.69rem 1rem;
  z-index: 2000;
}
.topbar-left {
  display: flex;
  align-items: center;
}
.topbar-logo {
  font-size: 1.2rem;
  margin-left: 1rem;
  color: #fff;
}
.toggle-btn {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  z-index: 3000;
  transition: transform 0.3s ease;
}
.profile-area {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}
.profile-icon {
  width: 32px;
  height: 32px;
  background-color: #ccc;
  border-radius: 50%;
}

/* SIDEBAR (menu lateral) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-color);
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);

  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 3000;

  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 1rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-color);
  border-bottom: 1px solid #eee;
  position: relative; /* Para posicionar o btn no canto */
}
/* Botão (3 risquinhos) no topo direito - mobile only */
.close-menu-btn {
  display: none; /* oculto no desktop */
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #333;
}

/* ÁREA ROLÁVEL DOS MENUS */
.sidebar-content {
  flex: 1;        
  overflow-y: auto; 
  overflow-x: hidden;
}
.sidebar-nav ul {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}
.sidebar-nav li {
  position: relative;
}
.sidebar-nav li a {
  display: block;
  padding: 0.8rem 1rem;
  margin: 0.25rem 0.5rem;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 6px;
  transition: background-color 0.3s, color 0.3s;
  font-weight: 500;
  font-size: 0.95rem;
}
.sidebar-nav li a i {
  margin-right: 8px;
  color: #999;
  transition: color 0.3s;
}
.sidebar-nav li a:hover {
  background-color: #f5f5ff;
  color: var(--primary-color);
}
.sidebar-nav li a:hover i {
  color: var(--primary-color);
}
.sidebar-nav li a.active {
  background-color: var(--primary-color);
  color: #fff;
}
.sidebar-nav li a.active i {
  color: #fff;
}
.submenu-indicator {
  float: right;
  margin-left: auto;
  color: #999;
  transition: color 0.3s;
}
.submenu {
  display: none;
  list-style: none;
  margin-left: 0;
  padding: 0 0.5rem;
  border-left: 3px solid #eee;
}
.sidebar-nav li.open > .submenu {
  display: block;
}

/* FOOTER (Logout) fixo no fim */
.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid #eee;
  padding: 1rem;
  background-color: #fff; 
  color: var(--text-color);
}
.sidebar-footer a {
  color: var(--text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  font-weight: 500;
  border-radius: 6px;
  padding: 0.6rem;
  transition: background-color 0.3s, color 0.3s;
}
.sidebar-footer a i {
  margin-right: 8px;
  color: #999;
  transition: color 0.3s;
}
.sidebar-footer a:hover {
  background-color: #f5f5ff; 
  color: var(--primary-color);
}
.sidebar-footer a:hover i {
  color: var(--primary-color);
}

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: #f9f9f9;
}

/* ESTILOS (index.php) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem;
}
.card {
  background-color: #fff;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
}
.stats,
.transactions,
.reports {
  margin: 1rem;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
}
.chart-placeholder {
  min-height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fafafa;
  border: 1px dashed #ccc;
  margin-top: 0.5rem;
}
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.report-card {
  background-color: #fafafa;
  padding: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-align: center;
}

/* Fechar menu no desktop */
.sidebar-closed {
  transform: translateX(-250px);
}
.main-content.expanded {
  margin-left: 0;
}

/* MOBILE (<=768px) */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    transform: translateX(-100%);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 3000;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .toggle-btn.menu-open {
    transform: none;
  }

  /* Exibir a logo no mobile */
  .logo-desktop {
    display: block !important;
    margin-bottom: 1rem;
  }
  .logo-desktop img {
    width: 65% !important; 
    height: auto !important;
    max-width: none !important;
    margin: 0 auto;
    display: block;
  }

  /* Exibir o botão (3 risquinhos) no mobile */
  .close-menu-btn {
    display: block; /* visível só no mobile */
  }

  /* Remover aumento de fonte do LOGOUT no mobile */
  .sidebar-footer a {
    font-size: 1rem !important;
  }
}
