/* Reset e Variáveis */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --bg-main: #f9fafb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #10b981;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* =========================================
   Auth View
   ========================================= */
.auth-wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  background-color: var(--bg-card);
  padding: 2.5rem 2rem;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 28rem;
  text-align: center;
  transition: all 0.3s ease;
}

.auth-icon-wrapper {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
}

.auth-icon {
  width: 4rem;
  height: 4rem;
  background-color: var(--primary-light);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 2rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.btn-google:hover {
  background-color: #f3f4f6;
}

.google-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.auth-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 1rem;
}

/* =========================================
   App Layout
   ========================================= */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .app-layout {
    flex-direction: row;
  }
}

/* Sidebar */
.sidebar {
  width: 100%;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .sidebar {
    width: 16rem; /* 256px */
  }
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--primary);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.brand-text h2 {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1rem;
  line-height: 1.2;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex-grow: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  border-radius: 0.5rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-item i {
  font-size: 1.125rem;
}

.nav-item:hover {
  background-color: #f3f4f6;
  color: var(--text-main);
}

.nav-item.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  margin-top: 1rem;
}

.avatar {
  width: 2rem;
  height: 2rem;
  background-color: #e5e7eb;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar i {
  color: var(--text-muted);
}

.user-info {
  flex-grow: 1;
  min-width: 0;
}

.user-info p {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-icon {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon i {
  font-size: 1.125rem;
}

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

/* Main Content */
.main-content {
  flex-grow: 1;
  background-color: var(--bg-main);
  position: relative;
  overflow-y: auto;
}

.topbar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.content-area {
  padding: 2rem;
}

/* Components that will be used inside content-area */
.card {
  background-color: var(--bg-card);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.nav-group-children.collapsed { display: none; }
.sub-nav-item { padding-left: 3rem !important; font-size: 0.875rem !important; opacity: 0.9; border-left: 2px solid transparent; }
.sub-nav-item:hover, .sub-nav-item.active { background-color: var(--bg-body) !important; border-left: 2px solid var(--primary); color: var(--primary) !important; }
.sub-nav-item i { font-size: 1.1rem !important; }
