/* ==========================================================================
   ACHADINHOS VIP — PAINEL ADMINISTRATIVO & DASHBOARD STYLES (STANDALONE)
   ========================================================================== */

:root {
  --admin-primary: #FF385C;
  --admin-primary-hover: #E01E43;
  --admin-sidebar-bg: #0F172A;
  --admin-sidebar-text: #94A3B8;
  --admin-sidebar-active: #FFFFFF;
  --admin-bg: #F8FAFC;
  --admin-card-bg: #FFFFFF;
  --admin-border: #E2E8F0;
  --admin-text-main: #0F172A;
  --admin-text-muted: #64748B;
  --admin-success: #10B981;
  --admin-warning: #F59E0B;
  --admin-info: #0284C7;
  --admin-danger: #EF4444;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  display: flex !important;
  flex-direction: row !important;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   1. SIDEBAR
   ========================================================================== */
.admin-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  background-color: var(--admin-sidebar-bg);
  color: var(--admin-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 50;
}

.admin-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-sidebar-header img {
  height: 32px;
  width: auto;
}

.admin-sidebar-header h2 {
  color: #FFFFFF;
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}

.admin-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--admin-sidebar-text);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
}

.admin-nav-item:hover {
  background: #1E293B;
  color: #FFFFFF;
}

.admin-nav-item.active {
  background: var(--admin-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(255, 56, 92, 0.3);
}

.admin-sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1E293B;
}

.btn-view-site {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: #1E293B;
  color: #FFFFFF;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.2s;
}

.btn-view-site:hover {
  background: #334155;
}

/* ==========================================================================
   2. ÁREA PRINCIPAL
   ========================================================================== */
.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--admin-bg);
}

.admin-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--admin-border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.admin-topbar-title h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-content {
  padding: 32px;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

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

/* ==========================================================================
   3. CARDS DE MÉTRICAS
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.metric-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.icon-visits { background: #EEF2FF; color: #4F46E5; }
.icon-clicks { background: #ECFDF5; color: #10B981; }
.icon-coupons { background: #FFFBEB; color: #F59E0B; }
.icon-shares { background: #F0FDF4; color: #16A34A; }

.metric-info h4 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  margin: 0 0 4px;
}

.metric-value {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--admin-text-main);
  margin: 0;
}

/* ==========================================================================
   4. TABELAS E PAINÉIS
   ========================================================================== */
.admin-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 28px;
  overflow: hidden;
}

.admin-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-card-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: #F8FAFC;
  padding: 12px 18px;
  font-weight: 700;
  color: var(--admin-text-muted);
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background-color: #F8FAFC;
}

.table-product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-product-cell img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--admin-border);
  flex-shrink: 0;
}

.table-product-name {
  font-weight: 700;
  color: var(--admin-text-main);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   5. BADGES & STATUS
   ========================================================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-active { background: #ECFDF5; color: #065F46; }
.status-inactive { background: #FEF2F2; color: #991B1B; }
.status-featured { background: #FFFBEB; color: #B45309; }

/* ==========================================================================
   6. BOTÕES
   ========================================================================== */
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-admin-primary {
  background: var(--admin-primary);
  color: #FFFFFF;
}

.btn-admin-primary:hover {
  background: var(--admin-primary-hover);
}

.btn-admin-secondary {
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  color: var(--admin-text-main);
}

.btn-admin-secondary:hover {
  background: #F1F5F9;
}

.btn-admin-danger {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
}

.btn-admin-danger:hover {
  background: #FEE2E2;
}

.btn-icon-action {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--admin-border);
  background: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-text-muted);
  transition: all 0.15s;
}

.btn-icon-action:hover {
  background: #F1F5F9;
  color: var(--admin-text-main);
}

/* ==========================================================================
   7. UPLOAD & DROPZONE
   ========================================================================== */
.dropzone-box {
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--admin-primary);
  background: #FFF0F2;
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.dropzone-text h4 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 6px;
}

.dropzone-text p {
  color: var(--admin-text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ==========================================================================
   8. FORMULÁRIOS
   ========================================================================== */
.admin-form-group {
  margin-bottom: 16px;
}

.admin-form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--admin-text-main);
  margin-bottom: 6px;
}

.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: #FFFFFF;
  font-size: 0.9rem;
  font-family: inherit;
  box-sizing: border-box;
}

.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  border-color: var(--admin-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 56, 92, 0.15);
}

.admin-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==========================================================================
   9. MODAL & TOAST
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--admin-border);
  background: #F8FAFC;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--admin-text-main);
  z-index: 20;
}

.modal-close-btn:hover {
  background: #E2E8F0;
}

.modal-body {
  padding: 28px;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast-item {
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

/* ==========================================================================
   10. TELA DE AUTENTICAÇÃO / BLOQUEIO POR SENHA
   ========================================================================== */
.admin-auth-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #1E293B, #0F172A);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.admin-auth-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.auth-icon-wrap {
  width: 64px;
  height: 64px;
  background: #FFF0F2;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 16px;
}

.auth-header h2 {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--admin-text-main);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 0.9rem;
  color: var(--admin-text-muted);
  margin-bottom: 24px;
}

.auth-error-text {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FCA5A5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn-logout {
  width: 100%;
  background: #334155;
  color: #F87171;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #475569;
  color: #EF4444;
}

/* ==========================================================================
   10. RESPONSIVIDADE
   ========================================================================== */
@media (max-width: 900px) {
  body.admin-body {
    flex-direction: column !important;
  }
  .admin-sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    position: static;
  }
  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
  }
  .admin-nav-item {
    white-space: nowrap;
    width: auto;
  }
  .admin-topbar {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .admin-content {
    padding: 16px;
  }
  .admin-grid-2col {
    grid-template-columns: 1fr;
  }
}
