/**
 * CamadaBase Admin - Standalone CSS
 */

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

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  min-height: 100vh;
  color: #e2e8f0;
}

.hidden {
  display: none !important;
}

/* ===== Login ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header .icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.login-header h1 {
  font-size: 1.5rem;
  color: #ef4444;
}

.login-header p {
  color: #64748b;
  font-size: 0.9rem;
}

.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  display: none;
  text-align: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: #ef4444;
}

.btn-login {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* ===== Admin App ===== */
.admin-app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: rgba(0, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header .logo {
  font-size: 1.5rem;
}

.sidebar-header h1 {
  font-size: 1.25rem;
  color: #ef4444;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #64748b;
  text-decoration: none;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.nav-icon {
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout {
  width: 100%;
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.main-header {
  margin-bottom: 2rem;
}

.main-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.page-content {
  width: 100%;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #e2e8f0;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
}

/* Card */
.card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.5rem;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table th {
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
}

.text-muted {
  color: #64748b;
  font-size: 0.8rem;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #6366f1;
}

/* Badges */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-pro {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.badge-basic {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

.badge-enterprise {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

/* Status */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

/* Buttons */
/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3), 0 2px 4px -1px rgba(220, 38, 38, 0.15);
  border-color: rgba(255,255,255,0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
  box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 0.5rem;
}

.btn-icon {
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}

.btn-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.1);
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* Activity */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.activity-time {
  font-size: 0.8rem;
  color: #64748b;
  font-family: monospace;
}

.activity-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
}

.activity-badge.success {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.activity-badge.info {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

/* Plans */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.plan-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2rem;
  text-align: center;
}

.plan-card.featured {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.plan-card h3 {
  margin-bottom: 0.5rem;
}

.plan-price {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.plan-price span {
  font-size: 0.9rem;
  color: #64748b;
}

.plan-features {
  list-style: none;
  text-align: left;
  margin-bottom: 1.5rem;
}

.plan-features li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Logs */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
}

.log-time {
  font-size: 0.8rem;
  color: #64748b;
  font-family: monospace;
}

.log-level {
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
}

.log-level.success {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.log-level.info {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.log-level.warning {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.log-msg {
  flex: 1;
  color: #94a3b8;
}

/* System */
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.system-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.system-card h4 {
  margin-bottom: 0.5rem;
}

.system-card p {
  color: #64748b;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.info-list {
  margin-top: 1rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row span {
  color: #64748b;
}

.info-row strong {
  color: #e2e8f0;
}

/* ===== COMPONENTS ===== */

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s,
    visibility 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-container {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(-20px);
  transition: transform 0.3s;
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal-container {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-content {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  max-height: 70vh;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.btn-confirm {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
}

/* Table Actions */
.btn-action {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 0.5rem;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-action.btn-edit:hover {
  color: #60a5fa;
}

.btn-action.btn-delete:hover {
  color: #f87171;
}

/* ===== Data Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.data-table th {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  color: #e2e8f0;
}

/* Primeira coluna (nome) pode ser maior */
.data-table td:first-child {
  max-width: 250px;
}

.data-table .actions-cell {
  text-align: right;
  width: 100px;
  white-space: nowrap;
}

/* ===== Mobile Responsivo ===== */
@media (max-width: 768px) {
  /* Sidebar mobile */
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .sidebar.open {
    left: 0;
  }

  /* Overlay quando sidebar está aberto */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
  }

  .sidebar-overlay.open {
    display: block;
  }

  /* Main content ocupa 100% */
  .main-content {
    padding: 1rem;
    margin-left: 0;
  }

  /* Botão hamburguer */
  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 998;
    background: rgba(99, 102, 241, 0.9);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    align-items: center;
    justify-content: center;
  }

  /* Header com espaço para o botão */
  .main-header {
    margin-left: 3rem;
  }

  /* Grids responsivos */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }



  /* Tabelas responsivas */
  .data-table {
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }

  /* Cards */
  .card {
    padding: 1rem;
  }

  /* Modais */
  .modal-container {
    width: 95%;
    max-width: none;
    margin: 1rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card .stat-value {
    font-size: 1.5rem;
  }
}

/* Botão mobile - escondido em desktop */
.mobile-menu-btn {
  display: none;
}

/* Tailwind Utilities (Global) */
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-bold { font-weight: 700; }
.text-white { color: #fff; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.mt-1 { margin-top: 0.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.border-b { border-bottom-width: 1px; }
.border-white\/10 { border-color: rgba(255, 255, 255, 0.1); }
.text-indigo-400 { color: #818cf8; }
.border-indigo-500 { border-color: #6366f1; }
.border-b-2 { border-bottom-width: 2px; }
.font-medium { font-weight: 500; }
.hover\:text-white:hover { color: #fff; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) { .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.p-4 { padding: 1rem; }
.text-green-400 { color: #4ade80; }
.text-blue-400 { color: #60a5fa; }
.w-full { width: 100%; }
.font-mono { font-family: monospace; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* =========================================
   HEADER HEALTH MONITOR (Added v2.3.0)
   ========================================= */
.main-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.main-header h2 {
  margin: 0;
}

.header-monitor {
  display: flex;
  gap: 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.monitor-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.monitor-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1;
}

.monitor-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.2;
}

.monitor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.monitor-dot.online {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: pulse-green 2s infinite;
}

.monitor-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.monitor-dot.warning {
  background: #eab308;
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

@media (max-width: 768px) {
  .header-monitor {
    width: 100%;
    justify-content: flex-start; /* Changed from space-between to allow scrolling start */
    overflow-x: auto;
    padding: 0.75rem;
    gap: 1rem; /* Reduce gap on mobile */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling iOS */
    scrollbar-width: none; /* Firefox hide scrollbar */
  }
  .header-monitor::-webkit-scrollbar {
    display: none; /* Chrome/Safari hide scrollbar */
  }
  .monitor-item {
    flex-shrink: 0; /* Prevent shrinking */
  }
}
