/**
 * Estilos Customizados - CRM Maker AI
 */

/* ============================================
   RESET E BASE
   ============================================ */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   NAVEGAÇÃO
   ============================================ */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  transition: all 0.2s;
  text-decoration: none;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-link.active {
  background-color: #3b82f6;
  color: white;
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  color: #64748b;
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.2s;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: #3b82f6;
}

.mobile-nav-link i {
  font-size: 1.25rem;
}

/* ============================================
   KANBAN
   ============================================ */
.kanban-container {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: calc(100vh - 200px);
}

.kanban-column {
  flex: 0 0 320px;
  background: white;
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.dark .kanban-column {
  background: #1e293b;
}

.kanban-column-header {
  padding: 1rem;
  border-radius: 0.75rem 0.75rem 0 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.kanban-column-body {
  flex: 1;
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ============================================
   CARDS
   ============================================ */
.deal-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .deal-card {
  background: #0f172a;
  border-color: #334155;
}

.deal-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.deal-card.dragging {
  opacity: 0.5;
  transform: rotate(3deg);
}

.deal-card-title {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.dark .deal-card-title {
  color: white;
}

.deal-card-owner {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.deal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.deal-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-orange {
  background: #ffedd5;
  color: #c2410c;
}

.badge-red {
  background: #fee2e2;
  color: #dc2626;
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

.dark .badge-blue {
  background: #1e3a8a;
  color: #93c5fd;
}

.dark .badge-green {
  background: #14532d;
  color: #86efac;
}

.dark .badge-orange {
  background: #7c2d12;
  color: #fdba74;
}

.dark .badge-red {
  background: #7f1d1d;
  color: #fca5a5;
}

.dark .badge-gray {
  background: #334155;
  color: #94a3b8;
}

/* ============================================
   AVATAR
   ============================================ */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.avatar-placeholder {
  background: #64748b;
}

/* ============================================
   FORMS
   ============================================ */
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  background: white;
  color: #1e293b;
}

.dark .form-input {
  background: #0f172a;
  border-color: #334155;
  color: white;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.375rem;
}

.dark .form-label {
  color: #94a3b8;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.dark .btn-secondary {
  background: #334155;
  color: #e2e8f0;
}

.dark .btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: #22c55e;
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.btn-outline:hover {
  background: #f1f5f9;
}

.dark .btn-outline {
  border-color: #334155;
  color: #94a3b8;
}

.dark .btn-outline:hover {
  background: #334155;
}

/* ============================================
   TOASTS
   ============================================ */
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.5rem;
  background: white;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
  max-width: 400px;
}

.dark .toast {
  background: #1e293b;
}

.toast.toast-out {
  animation: toast-out 0.3s ease-out forwards;
}

.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-warning {
  border-left: 4px solid #f59e0b;
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-success .toast-icon {
  color: #22c55e;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-info .toast-icon {
  color: #3b82f6;
}

.toast-message {
  flex: 1;
  color: #1e293b;
  font-size: 0.875rem;
}

.dark .toast-message {
  color: #e2e8f0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ============================================
   MODAL
   ============================================ */
#modal-drawer.open {
  transform: translateX(0);
}

#notifications-drawer>div {
  transform: translateX(100%);
  transition: transform 0.3s;
}

#notifications-drawer.open>div {
  transform: translateX(0);
}

/* ============================================
   TABELA
   ============================================ */
.table-container {
  overflow-x: auto;
  background: white;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
}

.dark .table-container {
  background: #1e293b;
  border-color: #334155;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.dark .data-table th {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

.dark .data-table td {
  border-color: #334155;
  color: #e2e8f0;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.dark .data-table tr:hover td {
  background: #0f172a;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stat-card {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.dark .stat-card {
  background: #1e293b;
  border-color: #334155;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
}

.dark .stat-value {
  color: white;
}

.stat-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* ============================================
   LOADING
   ============================================ */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 768px) {
  .kanban-column {
    flex: 0 0 280px;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  /* Footer mobile sempre fixo */
  #mobile-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    transform: translateZ(0);
    /* Força camada de composição */
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  /* Prevenir overscroll no body */
  html,
  body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
  }

  /* Garantir padding no conteúdo para não ficar atrás do footer */
  #page-content {
    padding-bottom: 80px !important;
  }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}