/* ==========================================================================
   MOVIX - CRM EXECUTIVO & INTEGRAÇÃO MERCADO PAGO (CHECKOUT & SPLIT R$ 0,50)
   Design System: Modern High-Tech Light Theme com elementos Mercado Pago
   ========================================================================== */

/* Sub-navegação interna do Painel Admin */
.admin-subnav {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-subnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.admin-subnav-btn:hover {
  color: var(--electric-cyan);
  background: #ffffff;
  border-color: var(--electric-cyan);
  transform: translateY(-1px);
}

.admin-subnav-btn.active {
  color: #ffffff;
  background: var(--blue-gradient);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0, 114, 255, 0.25);
}

.admin-subnav-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
}

.admin-subnav-btn.active .admin-subnav-badge {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* Painel de Métricas do CRM */
.crm-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.crm-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.crm-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-floating);
  border-color: var(--electric-azure);
}

.crm-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--border-subtle);
}

.crm-stat-card.accent-cyan::before { background: var(--electric-cyan); }
.crm-stat-card.accent-green::before { background: var(--status-apto); }
.crm-stat-card.accent-amber::before { background: var(--status-analise); }
.crm-stat-card.accent-red::before { background: var(--status-inapto); }
.crm-stat-card.accent-mp::before { background: #009ee3; }

.crm-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.crm-stat-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.crm-stat-icon {
  font-size: 1.4rem;
}

.crm-stat-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.crm-stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Barra de Filtros por Vencimento Semanal */
.crm-filter-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.crm-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.crm-search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 480px;
}

.crm-search-input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.crm-search-input:focus {
  border-color: var(--electric-cyan);
  outline: none;
  box-shadow: 0 0 0 3px var(--cyan-subtle);
}

.crm-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 0.95rem;
}

.crm-days-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.crm-day-pill {
  padding: 6px 13px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-heading);
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.crm-day-pill:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.crm-day-pill.active {
  background: var(--electric-cyan);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 114, 255, 0.25);
}

.crm-day-pill.highlight-today {
  border-color: #f59e0b;
  position: relative;
}

.crm-day-pill.highlight-today::after {
  content: 'HOJE';
  font-size: 0.58rem;
  background: #f59e0b;
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
}

.crm-day-pill.pill-overdue {
  color: #dc2626;
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.2);
}

.crm-day-pill.pill-overdue.active {
  background: #dc2626;
  color: #fff;
}

.crm-day-pill.pill-paid {
  color: #059669;
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, 0.2);
}

.crm-day-pill.pill-paid.active {
  background: #059669;
  color: #fff;
}

/* Badges de Vencimento e Status */
.crm-due-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--text-muted);
}

.crm-due-badge.due-today {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  animation: pulseAmber 2s infinite ease-in-out;
}

@keyframes pulseAmber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); }
}

.crm-billing-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.crm-billing-status.pago {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.crm-billing-status.pendente {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.crm-billing-status.atrasado {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

/* Badge de Split R$ 0,50 */
.crm-split-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(0, 158, 227, 0.1);
  color: #0077b6;
  border: 1px solid rgba(0, 158, 227, 0.25);
  margin-top: 3px;
}

/* Avatar do Motorista na Tabela CRM */
.crm-driver-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0072ff, #00c6ff);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 114, 255, 0.2);
}

/* ==========================================================================
   GAVETA LATERAL DO MOTORISTA (CRM SLIDE-OVER DRAWER)
   ========================================================================== */
.crm-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.crm-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.crm-drawer {
  position: fixed;
  top: 0;
  right: -580px;
  width: 100%;
  max-width: 560px;
  height: 100%;
  background: #ffffff;
  box-shadow: -10px 0 40px rgba(15, 23, 42, 0.2);
  z-index: 2501;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.crm-drawer.active {
  right: 0;
}

.crm-drawer-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.crm-drawer-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.crm-drawer-close:hover {
  color: var(--status-inapto);
  background: #fef2f2;
}

.crm-drawer-body {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.crm-section-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.crm-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-main);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Timeline de Notas do CRM */
.crm-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.crm-timeline-item {
  background: #f8fafc;
  border-left: 3px solid var(--electric-cyan);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
}

.crm-timeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.crm-timeline-text {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* ==========================================================================
   PAINEL DE INTEGRAÇÃO MERCADO PAGO (OAUTH & SPLIT R$ 0,50)
   ========================================================================== */
.mp-integration-card {
  background: #ffffff;
  border: 1px solid #cbe9ff;
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 36px;
  box-shadow: 0 10px 30px rgba(0, 158, 227, 0.08);
  position: relative;
  overflow: hidden;
}

.mp-integration-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #009ee3 0%, #00b4d8 50%, #0072ff 100%);
}

.mp-brand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e0f2fe;
}

.mp-logo-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mp-logo-icon {
  width: 44px;
  height: 44px;
  background: #009ee3;
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(0, 158, 227, 0.35);
}

/* Card de Estado Desconectado (1-Clique) */
.mp-disconnected-card {
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  border: 1.5px dashed #7dd3fc;
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.06);
}

/* Botão Oficial Conectar com Mercado Pago */
.btn-mp-connect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #009ee3;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 16px 36px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 158, 227, 0.35);
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
}

.btn-mp-connect:hover {
  background: #0081bb;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 158, 227, 0.45);
}

.btn-mp-connect:active {
  transform: translateY(0);
}

.btn-mp-connect:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Card de Conta Conectada */
.mp-connected-card {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.1);
}

/* Modal do Checkout Transparente Mercado Pago */
.mp-checkout-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
}

.mp-qr-container {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin: 20px 0;
}

.mp-qr-img {
  width: 220px;
  height: 220px;
  margin: 0 auto 12px;
  display: block;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.mp-copy-paste-input {
  width: 100%;
  padding: 10px 12px;
  font-family: monospace;
  font-size: 0.82rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
}

/* Responsividade do CRM */
@media (max-width: 768px) {
  .crm-drawer {
    max-width: 100%;
    right: -100%;
  }
  
  .crm-metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .crm-filter-header {
    flex-direction: column;
    align-items: stretch;
  }
}
