:root {
  --roxo-principal: #7b00ff;
  --gradiente-principal: linear-gradient(135deg, #6c63ff, #b366ff);
  --bg-escuro: radial-gradient(circle at top left, #1c1c28, #12121a 70%);
  --bg-light: #f5f5f5;
  --texto-escuro: #ffffff;
  --texto-claro: #000000;
  --gradiente-salvar: linear-gradient(135deg, #28a745, #6c63ff);
  --gradiente-excluir: linear-gradient(135deg, #e55353, #b82a2a);

  --cell-disciplina-bg: rgba(123, 0, 255, 0.5);
  --cell-pibic-bg: rgba(89, 23, 117, 0.7);
  --cell-pibiti-bg: rgba(144, 63, 160, 0.7);
  --cell-estagio-bg: rgba(32, 55, 185, 0.7);
  --cell-monitoria-bg: rgba(39, 134, 130, 0.7);
  --cell-outro-bg: rgba(219, 36, 137, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg-escuro);
  color: var(--texto-escuro);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition:
    background 0.3s,
    color 0.3s;
  overflow-x: hidden;
}
body.light-mode {
  background: var(--bg-light);
  color: var(--texto-claro);
}

/* Header */
.header {
  background: rgba(28, 28, 40, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1001;
  height: 72px;
  display: flex;
  align-items: center;
}
body.light-mode .header {
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid #ddd;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
}
.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}
.logo {
  height: 36px;
  border-radius: 50%;
}
.header-text h1 {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.animated-gradient-text {
  background-image: linear-gradient(90deg, #a5b4fc, #d8b4fe, #a5b4fc);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-flow 4s linear infinite;
}
@keyframes gradient-flow {
  0% {
    background-position: 200% center;
  }
  100% {
    background-position: 0% center;
  }
}
body.light-mode .animated-gradient-text {
  background-image: linear-gradient(90deg, #1c1c28, #7b00ff, #1c1c28);
}

.header-action-btn {
  background: transparent;
  border: none;
  color: inherit;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.2s ease;
}
.header-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}
#menuToggle {
  transition: transform 0.3s ease;
}
body.sidebar-collapsed #menuToggle {
  transform: rotate(90deg);
}

.simfluxo-header-btn {
  background: var(--roxo-principal);
  padding: 0.4rem 0.8rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.simfluxo-header-btn:hover {
  box-shadow: 0 4px 15px rgba(123, 0, 255, 0.4);
}

/* Layout */
.container {
  display: flex;
  flex: 1;
  gap: 0.5rem;
  padding: 0.5rem;
  transition:
    gap 0.4s ease,
    padding-left 0.4s ease;
  height: calc(100vh - 72px);
}
.form-card {
  flex: 0 0 320px;
  background: rgba(28, 28, 40, 0.6);
  backdrop-filter: blur(20px);
  padding: 1.2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition:
    margin-left 0.4s ease,
    opacity 0.4s ease;
  overflow-y: visible; /* IMPORTANTE: Para o dropdown sair pra fora */
  max-height: 100%;
  display: flex;
  flex-direction: column;
  z-index: 100;
}
body.light-mode .form-card {
  background: #fff;
  color: #000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.timetable-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

body.sidebar-collapsed .container {
  gap: 0;
  padding-left: 1rem;
}
body.sidebar-collapsed .form-card {
  margin-left: -340px;
  opacity: 0;
  pointer-events: none;
}

/* Form Elements */
.close-button {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
.form-card h2 {
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.2rem;
}
.form-card label {
  display: block;
  margin: 0.5rem 0 0.3rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: #ccc;
}
body.light-mode .form-card label {
  color: #555;
}

.form-card input {
  width: 100%;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: 0.3s;
  font-size: 0.95rem;
}
body.light-mode .form-card input {
  background-color: #f0f0f0;
  color: #000;
  border: 1px solid #ccc;
}
.form-card input:focus {
  outline: none;
  border-color: var(--roxo-principal);
  background-color: rgba(255, 255, 255, 0.1);
}
body.light-mode .form-card input:focus {
  background-color: #fff;
  border-color: var(--roxo-principal);
}

.row-inputs {
  display: flex;
  gap: 10px;
}
.input-group {
  display: flex;
  flex-direction: column;
}

/* Autocomplete & Scrollbar Custom */
.input-wrapper {
  position: relative;
}
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  background: #2a2a3a;
  border: 1px solid #444;
  border-top: none;
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: none;
  min-width: 100%;
  width: max-content;
  max-width: 320px; /* Largura dinâmica */
}
.autocomplete-list.visible {
  display: block;
}
.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover {
  background: var(--roxo-principal);
  color: white;
}
.suggestion-item strong {
  color: #a5b4fc;
}
.suggestion-item:hover strong {
  color: #fff;
}

body.light-mode .autocomplete-list {
  background: #fff;
  border-color: #ccc;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
body.light-mode .suggestion-item {
  border-bottom-color: #eee;
  color: #333;
}
body.light-mode .suggestion-item:hover {
  background: #f0f0f0;
  color: #000;
}

.autocomplete-list::-webkit-scrollbar {
  width: 5px;
}
.autocomplete-list::-webkit-scrollbar-track {
  background: transparent;
}
.autocomplete-list::-webkit-scrollbar-thumb {
  background: rgba(123, 0, 255, 0.3);
  border-radius: 3px;
}

.info {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #888;
}
.buttons {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
button {
  background: var(--gradiente-principal);
  color: #fff;
  padding: 0.7rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
button.danger {
  background: #e55353;
}
.btn-salvar {
  background: var(--gradiente-salvar);
}
.btn-excluir {
  background: var(--gradiente-excluir);
}
.btn-cancel {
  background: #555;
}
.btn-primary {
  background: var(--gradiente-principal);
}
.btn-download-modern {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: var(--gradiente-principal);
  color: #fff;
  font-size: 0.95rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.35);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.btn-download-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.5);
}
.btn-secondary {
  background: #4a4a5a;
}
body.light-mode .btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.import-export-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.import-export-buttons button {
  background: #333;
  font-size: 0.85rem;
  padding: 0.6rem;
}
body.light-mode .import-export-buttons button {
  background: #e0e0e0;
  color: #000;
}

/* TIMETABLE */
.timetable {
  display: grid;
  grid-template-columns: 60px repeat(6, 1fr);
  grid-template-rows: 25px repeat(16, minmax(25px, 1fr));
  gap: 2px;
  height: 100%;
  max-height: 100%;
}
.header-cell,
.time-cell,
.cell {
  padding: 2px 4px;
  text-align: center;
  font-size: 0.75rem;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  line-height: 1.1;
  word-break: break-word;
}
.header-cell {
  background: rgba(255, 255, 255, 0.06);
  color: #a5b4fc;
  font-weight: bold;
  font-size: 0.8rem;
}
.time-cell {
  background: rgba(255, 255, 255, 0.04);
  color: #ccc;
  font-size: 0.65rem;
  white-space: pre-wrap;
}
.cell {
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

body.light-mode .header-cell {
  background-color: #e0e0e0;
  color: #000;
}
body.light-mode .time-cell {
  background-color: #f5f5f5;
  color: #444;
  border: 1px solid #ddd;
}
body.light-mode .cell {
  background-color: #fff;
  color: #000;
  border: 1px solid #ddd;
}

/* TEMA ESCURO: Ocupado */
.cell.occupied {
  cursor: pointer;
  color: #fff !important;
  background-color: var(--cell-disciplina-bg);
  border: none;
  font-weight: 500;
  font-size: 0.7rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.cell.occupied:hover {
  filter: brightness(1.2);
  z-index: 10;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* TEMA CLARO: Ocupado */
body.light-mode .cell.occupied {
  background-color: var(--roxo-principal);
  color: #fff !important;
  border-color: transparent;
  box-shadow: none;
}

.cell.occupied strong {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cell.occupied span {
  font-size: 0.8rem;
  opacity: 0.9;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Cores Específicas */
.cell.pibic {
  background-color: var(--cell-pibic-bg);
}
.cell.pibiti {
  background-color: var(--cell-pibiti-bg);
}
.cell.estagio {
  background-color: var(--cell-estagio-bg);
}
.cell.monitoria {
  background-color: var(--cell-monitoria-bg);
}
.cell.outro {
  background-color: var(--cell-outro-bg);
}

/* Cores Específicas Light Mode */
body.light-mode .cell.pibic {
  background-color: #591775;
}
body.light-mode .cell.pibiti {
  background-color: #903fa0;
}
body.light-mode .cell.estagio {
  background-color: #2037b9;
}
body.light-mode .cell.monitoria {
  background-color: #278682;
}
body.light-mode .cell.outro {
  background-color: #db2489;
}

/* Modais */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.modal.open {
  display: flex;
  animation: fadeIn 0.2s;
}
.modal-content {
  background: rgba(28, 28, 40, 0.95);
  padding: 1.5rem;
  border-radius: 16px;
  width: 90%;
  max-width: 380px;
  color: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
body.light-mode .modal-content {
  background: #fff;
  color: #000;
  border-color: #ddd;
}
.modal-content h3 {
  margin-bottom: 1rem;
}
.modal-content input {
  margin-bottom: 0.8rem;
  width: 100%;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
}
body.light-mode .modal-content input {
  background-color: #f0f0f0;
  color: #000;
  border: 1px solid #ccc;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: inherit;
  cursor: pointer;
}
.modal-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Cor do texto do Alerta no Modo Claro */
body.light-mode #alertMessage {
  color: #333 !important;
}

/* Custom Select */
.custom-select-wrapper {
  position: relative;
  margin-bottom: 1rem;
}
.custom-select-wrapper select {
  display: none;
}
.custom-select__trigger {
  padding: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  color: inherit;
}
body.light-mode .custom-select__trigger {
  background: #f0f0f0;
  border-color: #ccc;
}
.custom-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #2a2a3a;
  z-index: 100;
  border: 1px solid #444;
  border-radius: 6px;
  display: none;
}
.custom-select.open .custom-options {
  display: block;
}
.custom-option {
  padding: 0.6rem;
  cursor: pointer;
}
.custom-option:hover {
  background: var(--roxo-principal);
}

/* QR, Scanner, etc mantidos... */
#qrcode-container {
  display: flex;
  justify-content: center;
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  min-height: 200px;
}
.scan-modal {
  background: #000;
}
.scan-modal-content {
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}
#qrVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}
.scan-box {
  width: 250px;
  height: 250px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.6);
}
.scan-modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  color: white;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 20;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}
.sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .form-card {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    z-index: 2000;
    transform: translateX(-100%);
    background: #1c1c28;
    overflow-y: auto;
  }
  body.light-mode .form-card {
    background: #fff;
  }
  .form-card.open {
    transform: translateX(0);
  }
  .close-button {
    display: block;
  }
  .simfluxo-header-btn span {
    display: none;
  }
  .timetable {
    grid-template-columns: 40px repeat(6, 1fr);
    font-size: 0.6rem;
  }
  .header-cell {
    font-size: 0.65rem;
  }
  .time-cell {
    font-size: 0.55rem;
    padding: 1px;
  }
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
  text-align: center;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}
.footer span {
  color: #888;
  font-size: 0.85rem;
}
body.light-mode .footer span {
  color: #999;
}

/* Sidebar links (Equipe, Instagram, LinkedIn) */
.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.sidebar-link-featured {
  background: var(--gradiente-principal) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-size: 0.85rem !important;
  padding: 0.55rem 0.6rem !important;
  box-shadow: 0 2px 8px rgba(123, 0, 255, 0.3);
}
.sidebar-link-featured:hover {
  box-shadow: 0 4px 16px rgba(123, 0, 255, 0.5) !important;
}
.sidebar-social-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.sidebar-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0.5rem 0.4rem;
  background: rgba(123, 0, 255, 0.15);
  border: 1px solid rgba(123, 0, 255, 0.25);
  color: #c4b5fd;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.sidebar-link-btn:hover {
  background: rgba(123, 0, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(123, 0, 255, 0.25);
  color: #fff;
}
body.light-mode .sidebar-link-btn {
  background: rgba(123, 0, 255, 0.08);
  border-color: rgba(123, 0, 255, 0.2);
  color: #7c3aed;
}
body.light-mode .sidebar-link-btn:hover {
  background: rgba(123, 0, 255, 0.15);
  color: #6d28d9;
}
body.light-mode .sidebar-link-featured {
  background: var(--gradiente-principal) !important;
  color: #fff !important;
}

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

#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 10px;
  color: #fff;
  font-weight: 500;
  font-size: 0.92rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  animation: toastSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 360px;
}
.toast.sliding-out {
  animation: toastSlideOut 0.35s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}
.toast i {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.toast.info {
  background: rgba(52, 152, 219, 0.92);
}
.toast.success {
  background: rgba(39, 174, 96, 0.92);
}
.toast.error {
  background: rgba(231, 76, 60, 0.92);
}
.toast.warning {
  background: rgba(243, 156, 18, 0.92);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}
