/* ═════════════════════════════════════════════════════════════════════════════ */
/*                    MODAL & DIALOG SYSTEM — STYLES                            */
/*                      Diálogos, modais e painéis laterais                     */
/* ═════════════════════════════════════════════════════════════════════════════ */

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          BACKDROP (Fundo escuro)                             */
/* ═════════════════════════════════════════════════════════════════════════════ */

.modal-backdrop,
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  backdrop-filter: blur(2px);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          MODAL BASE                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  max-height: 90vh;
  overflow-y: auto;
  animation: none;
}

.modal-sm {
  width: 90%;
  max-width: 400px;
}

.modal-normal {
  width: 90%;
  max-width: 600px;
}

.modal-lg {
  width: 90%;
  max-width: 800px;
}

.modal-xl {
  width: 90%;
  max-width: 1000px;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          MODAL HEADER & BODY                                 */
/* ═════════════════════════════════════════════════════════════════════════════ */

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  gap: 1rem;
}

.modal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.modal-body {
  padding: 1.5rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
  line-height: 1.6;
  color: #374151;
}

.modal-close {
  background: none;
  border: none;
  border-radius: 12px;
  font-size: 2rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: Verdana, sans-serif;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #1f2937;
  transform: scale(1.1);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          DIALOG SPECIFIC                                     */
/* ═════════════════════════════════════════════════════════════════════════════ */

.dialog-message {
  margin: 0 0 1.5rem 0;
  font-size: 1rem;
  color: #374151;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.dialog-actions .btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  min-width: 100px;
  text-align: center;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          SIDEBAR                                             */
/* ═════════════════════════════════════════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  background: white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  overflow-y: auto;
  opacity: 0;
}

.sidebar-left {
  left: 0;
}

.sidebar-right {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  gap: 1rem;
}

.sidebar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.sidebar-content {
  padding: 1.5rem;
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
}

.sidebar-close {
  background: none;
  border: none;
  border-radius: 12px;
  font-size: 2rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: Verdana, sans-serif;
}

.sidebar-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          POPOVER                                             */
/* ═════════════════════════════════════════════════════════════════════════════ */

.popover {
  position: fixed;
  background: #1f2937;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  z-index: 1001;
  opacity: 0;
  max-width: 300px;
  word-wrap: break-word;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-family: Verdana, sans-serif;
  letter-spacing: 1pt;
  line-height: 1.5;
}

.popover::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: #1f2937;
  transform: rotate(45deg);
}

.popover-top::before {
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.popover-bottom::before {
  top: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.popover-left::before {
  right: -4px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.popover-right::before {
  left: -4px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          DARK MODE                                           */
/* ═════════════════════════════════════════════════════════════════════════════ */

:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .sidebar {
  background: #111b3c;
  color: #e8ecf1;
}

:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .sidebar-header {
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

:root[data-theme="dark"] .modal-title,
:root[data-theme="dark"] .sidebar-title {
  color: #e8ecf1;
}

:root[data-theme="dark"] .modal-body,
:root[data-theme="dark"] .sidebar-content {
  color: #a0aec0;
}

:root[data-theme="dark"] .modal-close,
:root[data-theme="dark"] .sidebar-close {
  color: #64748b;
}

:root[data-theme="dark"] .modal-close:hover,
:root[data-theme="dark"] .sidebar-close:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #e8ecf1;
}

:root[data-theme="dark"] .dialog-message {
  color: #a0aec0;
}

:root[data-theme="dark"] .popover {
  background: #334155;
  color: #e8ecf1;
}

:root[data-theme="dark"] .popover::before {
  background: #334155;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          TRANSIÇÕES                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

.modal,
.sidebar,
.modal-backdrop,
.sidebar-backdrop,
.popover {
  transition: all 0.3s ease;
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          RESPONSIVE                                          */
/* ═════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .modal-sm,
  .modal-normal,
  .modal-lg,
  .modal-xl {
    width: 95%;
    max-width: none;
    max-height: 80vh;
  }

  .sidebar {
    width: 80%;
    max-width: 320px;
  }

  .modal-header,
  .modal-body,
  .sidebar-header,
  .sidebar-content {
    padding: 1rem;
  }

  .modal-title,
  .sidebar-title {
    font-size: 1.1rem;
  }

  .popover {
    max-width: 250px;
    font-size: 0.85rem;
  }
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          ACESSIBILIDADE                                      */
/* ═════════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .modal,
  .sidebar,
  .modal-backdrop,
  .sidebar-backdrop,
  .popover {
    animation: none;
    transition: none;
  }
}

/* ═════════════════════════════════════════════════════════════════════════════ */
/*                          SCROLLBAR — MODAL/SIDEBAR                           */
/* ═════════════════════════════════════════════════════════════════════════════ */

.modal::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 8px;
}

.modal::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.modal::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.modal::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

:root[data-theme="dark"] .modal::-webkit-scrollbar-track,
:root[data-theme="dark"] .sidebar::-webkit-scrollbar-track {
  background: #1a2548;
}

:root[data-theme="dark"] .modal::-webkit-scrollbar-thumb,
:root[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb {
  background: #475569;
}

:root[data-theme="dark"] .modal::-webkit-scrollbar-thumb:hover,
:root[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
