/* ==================== Variáveis CSS ==================== */
:root {
  /* Cores - Tema Claro */
  --primary-color: #9fcfe9;
  --primary-dark: #7ab8d9;
  --primary-light: #c8e5f4;
  --background-color: #efedeb;
  --background-color2: #a6d8f3;
  --surface-color: #9fcfe9;
  --surface-color2: #d8dfe0;
  --secondary-color: #2f81a9;
  --text-color: #333333;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --icon-color: #121111;
  --text-button: #121111;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  --login-color1: #7ab8d9;
  --login-color2: #9fcfe9;

  /* Cores de Estado */
  --success-color: #4caf50;
  --error-color: #f44336;
  --warning-color: #ff9800;
  --info-color: #2196f3;

  /* Transições */
  --transition: all 0.3s ease;

  /* Espaçamentos */
  --navbar-height: 70px;
  --border-radius: 12px;
  --border-radius-large: 20px;
}

/* Tema Escuro */
[data-theme="dark"] {
  --primary-color: #9fcfe9;
  --primary-dark: #7ab8d9;
  --primary-light: #2f81a9;
  --background-color: #121212;
  --background-color2: #121212;
  --surface-color: #212121;
  --surface-color2: #212121;
  --secondary-color: #9fcfe9;
  --text-color: #e0e0e0;
  --text-secondary: #b0b0b0;
  --border-color: #333333;
  --icon-color: #121111;
  --text-button: #373535;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.5);
  --login-color1: #212121;
  --login-color2: #373535;
}

/* ==================== Reset e Base ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==================== Navbar ==================== */
.navbar {
  background: var(--surface-color);
  height: var(--navbar-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px var(--shadow);
  border-bottom-left-radius: var(--border-radius-large);
  border-bottom-right-radius: var(--border-radius-large);
  transition: var(--transition);
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
}

.navbar-brand i {
  font-size: 1.75rem;
  color: var(--text-color);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: var(--transition);
  font-weight: 500;
}

.nav-link:hover {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  transform: translateY(-2px);
}

.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.nav-link.active:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.nav-link i {
  color: var(--text-color);
  font-size: 1.1rem;
}

.nav-link span {
  color: var(--text-color);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ==================== Toggle Tema ==================== */
.theme-toggle {
  background: var(--primary-color);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 2px 8px var(--shadow);
}

.theme-toggle:hover {
  background: var(--primary-dark);
  transform: scale(1.1) rotate(20deg);
}

.fa-moon {
  color: var(--text-color);
}

.fa-calendar-alt {
  color: var(--text-color);
}

/* ==================== User Menu ==================== */
.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius);
  color: var(--primary-dark);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.user-button:hover {
  border-color: #ffffff;
  background: #ffffff;
}

.user-button i:first-child {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px var(--shadow);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
}

.user-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* ==================== Main Content ==================== */
.main-content {
  margin-top: calc(var(--navbar-height) + 2rem);
  padding: 2rem;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Remove as setas do input number - Chrome, Edge, Safari */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove as setas do input number - Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ==================== Modal de Mensagens ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(4px);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--surface-color);
  border-radius: var(--border-radius-large);
  box-shadow: 0 10px 40px var(--shadow);
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.modal-icon.success {
  color: var(--success-color);
}

.modal-icon.error {
  color: var(--error-color);
}

.modal-icon.warning {
  color: var(--warning-color);
}

.modal-icon.info {
  color: var(--info-color);
}

.modal-title {
  flex: 1;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-color);
}

.modal-body {
  padding: 1.5rem;
  color: var(--text-color);
  line-height: 1.6;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.modal-btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.modal-btn-primary {
  background: var(--secondary-color);
  color: white;
}

.modal-btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.modal-btn-secondary {
  background: var(--text-secondary);
  color: white;
}

.modal-btn-secondary:hover {
  background: var(--text-color);
  transform: translateY(-2px);
}

.modal-btn-danger {
  background: var(--error-color);
  color: white;
}

.modal-btn-danger:hover {
  background: #d32f2f;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

/* ==================== Footer ==================== */
.footer {
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
  margin-top: 4rem;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.theme-switch {
  position: relative;
  width: 45px;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-right: 2rem;
}

.theme-switch input {
  display: none;
}

.switch-slider {
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--primary-light);
  border-radius: 20px;
  transition: 0.25s ease;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.switch-slider::before {
  content: "";
  font-size: 12px;
  color: #333;
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === ÍCONES COMO SVG NO FUNDO DA BOLINHA === */

/* LUA — modo claro */
[data-theme="light"] .theme-switch .switch-slider::before {
  background-image: url("/static/img/lua.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 15px;
}

/* SOL — modo escuro */
[data-theme="dark"] .theme-switch .switch-slider::before {
  background-image: url("/static/img/sol.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 15px;
}

input:checked + .switch-slider::before {
  transform: translateX(22px);
}

.user-menu {
  position: relative;
}

.user-avatar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.user-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-initial {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--secondary-color);
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar i.fa-chevron-down {
  font-size: 0.7rem;
  color: var(--text-color);
}

.user-menu-mobile {
  display: none; /* Esconde no desktop */
}

/* ==================== Modal de Loading ==================== */
.modal-loading {
  padding: 3rem;
  text-align: center;
  color: var(--text-secondary);
}

.modal-loading i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.modal-loading p {
  font-size: 1rem;
  margin: 0;
}

/* ==================== Password Rules ==================== */
.password-rules {
  list-style: none;
  padding: 1rem;
  margin: 0.5rem 0 0 0;
  background: var(--background-color);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--info-color);
}

.password-rules li {
  padding: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.password-rules li::before {
  content: "•";
  color: var(--info-color);
  font-weight: bold;
}

/* ==================== Form Errors ==================== */
.form-input.error {
  border-color: var(--error-color);
  background: rgba(244, 67, 54, 0.05);
}

.form-error {
  display: block;
  color: var(--error-color);
  font-size: 0.85rem;
  margin-top: 0.25rem;
  padding: 0.25rem 0;
}

/* ==================== Form Help Text ==================== */
.form-help {
  margin-top: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.form-label {
  display: block;
  text-align: left;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
  color: var(--text-color);
  font-weight: 600;
  font-size: 0.95rem;
}

html.preload * {
  transition: none !important;
}
