/* dVPN Custom Stylesheet - Premium Glassmorphism Theme */

:root {
  /* HSL Color Palette */
  --bg-color: hsl(230, 35%, 8%);
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 75%);
  --glass-bg: hsla(225, 25%, 12%, 0.55);
  --glass-border: hsla(215, 30%, 40%, 0.15);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
  
  --primary: hsl(265, 85%, 65%);
  --primary-hover: hsl(265, 85%, 72%);
  --secondary: hsla(220, 20%, 40%, 0.25);
  --secondary-hover: hsla(220, 20%, 45%, 0.35);
  
  --success: hsl(150, 75%, 45%);
  --success-glow: hsla(150, 75%, 45%, 0.3);
  --error: hsl(350, 85%, 55%);
  --warning: hsl(40, 90%, 55%);
  
  /* Fonts */
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

/* Background Floating Orbs */
.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  animation: float 25s infinite ease-in-out;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, hsl(265, 80%, 50%) 0%, transparent 70%);
  top: -10%;
  left: -10%;
}

.orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, hsl(190, 80%, 50%) 0%, transparent 70%);
  bottom: -15%;
  right: -10%;
  animation-delay: -5s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, hsl(330, 80%, 50%) 0%, transparent 70%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(50px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-30px, 30px) scale(0.95);
  }
}

/* Glassmorphism Card Style */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--border-radius-lg);
  padding: 24px;
}

/* Buttons styling */
.btn {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, hsl(285, 80%, 60%) 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.6);
  background: linear-gradient(135deg, var(--primary-hover) 0%, hsl(285, 80%, 65%) 100%);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--error);
  color: #fff;
}

.btn-danger:hover {
  background-color: hsl(350, 85%, 62%);
  transform: translateY(-1px);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-hover);
  padding: 0;
  text-decoration: underline;
}

.btn-link:hover {
  color: #fff;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.icon-left {
  margin-right: 8px;
}

/* Forms and Inputs */
.input-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-group label {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-group input, .input-group select {
  font-family: var(--font-body);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px;
  font-size: 14px;
  border-radius: var(--border-radius-md);
  outline: none;
  transition: var(--transition);
}

.input-group input:focus, .input-group select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.25);
}

.input-group small {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 5px;
}

.input-group select option {
  background-color: var(--bg-color);
  color: #fff;
}

/* Error message */
.error-message {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 15px;
  text-align: center;
  font-weight: 500;
  display: none;
}

/* ======================================================== */
/* TELA DE LOGIN CSS */
/* ======================================================== */
.login-container {
  display: none;
  width: 100%;
  max-width: 400px;
  align-self: center;
  margin-top: 10vh;
}

.login-container.active {
  display: block;
}

.login-illustration-container {
  width: 100%;
  height: 120px;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.2);
}

.login-illustration {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  filter: brightness(0.9);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease, filter 0.5s ease;
}

.login-illustration-container:hover .login-illustration {
  transform: scale(1.04);
  opacity: 1;
  filter: brightness(1);
}

.login-header {
  text-align: center;
  margin-bottom: 25px;
}

.login-header .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary) 0%, hsl(190, 80%, 50%) 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px auto;
  box-shadow: 0 8px 24px rgba(138, 43, 226, 0.3);
}

.login-header .logo-icon svg {
  width: 32px;
  height: 32px;
  color: #fff;
}

.login-header h1 {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ======================================================== */
/* INTERFACE DASHBOARD PRINCIPAL */
/* ======================================================== */
.dashboard-container {
  display: none;
  width: 100%;
  max-width: 1350px;
  flex-direction: column;
  gap: 24px;
}

.dashboard-container.active {
  display: flex;
}

/* Top Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

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

.header-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, hsl(190, 80%, 50%) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo .logo-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.logo-text h2 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.logo-text span {
  font-size: 11px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

@media (min-width: 1024px) {
  .view-desktop .metrics-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 18px;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.location-icon {
  background: linear-gradient(135deg, hsl(200, 85%, 55%) 0%, hsl(220, 80%, 45%) 100%);
}

.timer-icon {
  background: linear-gradient(135deg, hsl(45, 95%, 50%) 0%, hsl(20, 90%, 45%) 100%);
}

.users-icon {
  background: linear-gradient(135deg, hsl(140, 70%, 45%) 0%, hsl(160, 80%, 35%) 100%);
}

.bandwidth-icon {
  background: linear-gradient(135deg, hsl(270, 85%, 60%) 0%, hsl(290, 80%, 45%) 100%);
}

.server-icon {
  background: linear-gradient(135deg, hsl(330, 85%, 55%) 0%, hsl(270, 80%, 45%) 100%);
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

.metric-info h3 {
  font-family: var(--font-title);
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.metric-info p {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.metric-info span {
  font-size: 11px;
  color: var(--text-secondary);
}

/* VPS Stats Card custom styles */
.server-info-card {
  align-items: flex-start !important;
}

.server-specs-info {
  width: 100%;
  overflow: hidden;
}

.server-cpu-model {
  font-size: 11px !important;
  font-weight: 500 !important;
  color: var(--text-secondary);
  margin-top: 2px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.server-details-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.server-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-val {
  color: var(--text-primary);
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, hsl(330, 85%, 55%) 0%, hsl(270, 80%, 45%) 100%);
  transition: width 0.4s ease;
  width: 0%;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: var(--primary);
  color: #fff;
}

/* Main Layout Grid */
.dashboard-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media(min-width: 1024px) {
  .dashboard-main {
    grid-template-columns: 1.35fr 0.65fr;
  }
  .span-full {
    grid-column: span 2;
  }
  
  /* Compact widths for #clients-table on desktop */
  .view-desktop #clients-table {
    table-layout: fixed !important;
    width: 100% !important;
  }
  .view-desktop #clients-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .view-desktop #clients-table th:nth-child(1),
  .view-desktop #clients-table td:nth-child(1) { width: 35%; }
  .view-desktop #clients-table th:nth-child(2),
  .view-desktop #clients-table td:nth-child(2) { width: 22%; }
  .view-desktop #clients-table th:nth-child(3),
  .view-desktop #clients-table td:nth-child(3) { width: 15%; }
  .view-desktop #clients-table th:nth-child(4),
  .view-desktop #clients-table td:nth-child(4) { width: 28%; }
}

.dashboard-section {
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.section-header h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--success);
}

.pulse-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success);
  animation: pulse-glow 1.5s infinite;
}

/* Tables and Data list */
.table-container {
  overflow-x: auto;
  width: 100%;
  padding: 4px; /* Breathing room for hover elevation */
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  text-align: left;
}

th {
  font-family: var(--font-title);
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  padding: 8px 16px;
  white-space: nowrap;
}

td {
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

td:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

td:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

tbody tr {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

tbody tr:hover {
  transform: translateY(-2px);
}

tbody tr:hover td {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-top-color: rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12), 0 8px 25px rgba(0, 0, 0, 0.35);
}

.table-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 0;
  font-style: italic;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--secondary);
  border: 1px solid var(--glass-border);
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--success);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Small switch for upstreams */
.switch-sm {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 18px;
}

.switch-sm input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-sm .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--secondary);
  border: 1px solid var(--glass-border);
  transition: .3s;
  border-radius: 18px;
}

.switch-sm .slider:before {
  position: absolute;
  content: "";
  height: 10px;
  width: 10px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.switch-sm input:checked + .slider {
  background-color: var(--success);
}

.switch-sm input:checked + .slider:before {
  transform: translateX(18px);
}

/* User config list cards */
.actions-cell {
  display: flex;
  gap: 8px;
}

.actions-cell button, .actions-cell a {
  padding: 6px 10px;
  font-size: 11px;
}

/* Log and Upstream Section Tabs */
.section-tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 20px;
  gap: 10px;
}

.tab-btn {
  background: none;
  border: none;
  font-family: var(--font-title);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  color: var(--text-primary);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* Upstream server list */
.upstream-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.upstream-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.upstream-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.upstream-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.15);
  background: rgba(138, 43, 226, 0.05);
}

/* Upstream status badges */
.upstream-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.upstream-badge.status-active {
  background: rgba(76, 175, 80, 0.12);
  color: var(--success);
  border-color: rgba(76, 175, 80, 0.35);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.1);
  animation: pulse-badge-glow 2.5s infinite;
}

.upstream-badge.status-inactive {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

@keyframes pulse-badge-glow {
  0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.35); }
  70% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.upstream-info h4 {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.upstream-info span {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Status colors in logs */
.status-success {
  color: var(--success);
  font-weight: 600;
}

.status-failed {
  color: var(--error);
  font-weight: 600;
}

/* ======================================================== */
/* MODAIS E OVERLAY */
/* ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  overflow: hidden;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
}

.text-center {
  text-align: center;
}

/* QR Code center styling */
.qr-container {
  background-color: #fff;
  padding: 16px;
  border-radius: var(--border-radius-md);
  display: inline-block;
  margin: 20px auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

#qrcode img {
  display: block;
}

.modal-actions {
  margin-top: 15px;
}

/* Helper styles */
.text-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Warning alert box */
.warning-box {
  background: rgba(230, 160, 30, 0.1);
  border: 1px solid var(--warning);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  padding: 16px;
  margin: 15px 0;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.55;
}
.warning-box strong {
  color: var(--warning);
}
.warning-box code {
  user-select: all;
  font-family: monospace;
}

/* Destinations Pill & Layout */
/* Destinations Pill & Layout with Hover Tooltip */
.destinations-cell {
  position: relative;
}

.destinations-tooltip-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.destinations-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.destinations-badge:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.destinations-tooltip-content {
  position: absolute;
  bottom: 125%; /* Show above the badge */
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background: hsla(225, 25%, 10%, 0.98) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px;
  padding: 10px 12px;
  width: 250px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 999; /* Higher z-index to overlay active tables/sections */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.destinations-tooltip-wrapper:hover .destinations-tooltip-content {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

.destinations-tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%; /* At the bottom of the tooltip */
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: hsla(225, 25%, 10%, 0.98) transparent transparent transparent;
}

.tooltip-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
  text-align: left;
}

.tooltip-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.tooltip-list::-webkit-scrollbar {
  width: 4px;
}
.tooltip-list::-webkit-scrollbar-track {
  background: transparent;
}
.tooltip-list::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 2px;
}

.destination-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.destination-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.destination-pill img {
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dest-host {
  font-family: monospace;
  font-size: 11px;
  margin-left: 4px;
  color: var(--text-secondary);
}

/* ======================================================== */
/* ADAPTAÇÕES DE DISPOSITIVO MÓVEL E CLASSES RESPONSIVAS */
/* ======================================================== */

/* Seletor de visualização de dispositivo no Header */
.device-selector {
  margin-right: 5px;
}

.device-selector .btn {
  gap: 6px;
  background: hsla(220, 20%, 30%, 0.15);
  border: 1px solid var(--glass-border);
}

.device-selector .btn:hover {
  background: hsla(220, 20%, 35%, 0.25);
  transform: translateY(-1px);
}

/* Ocultar tabelas em modo mobile e cartões em modo desktop */
.view-desktop .mobile-cards-container {
  display: none !important;
}

.view-desktop table {
  display: table !important;
}

.view-mobile table {
  display: none !important;
}

.view-mobile .mobile-cards-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  margin-top: 10px;
}

/* Estilo do Card Mobile */
.mobile-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: var(--border-radius-md);
  background: hsla(225, 25%, 12%, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  padding: 16px;
  transition: var(--transition);
}

.mobile-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  background: hsla(225, 25%, 15%, 0.7);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

/* Para sessões ativas */
.mobile-card.live-session-card {
  border-left: 4px solid var(--success);
}

.mobile-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.mobile-card .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-card .card-title strong {
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--text-primary);
}

.mobile-card .card-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.mobile-card .session-time {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.mobile-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-card .card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mobile-card .grid-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-card .grid-item.span-2 {
  grid-column: span 2;
}

.mobile-card .meta-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mobile-card .meta-val {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.mobile-card .meta-val code {
  font-family: monospace;
  background: rgba(255,255,255,0.06);
  padding: 2px 4px;
  border-radius: 4px;
}

.mobile-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.mobile-card .destinations-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.mobile-card .card-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.mobile-card .card-actions .btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
}

/* Modificação no layout dos Modais no Mobile */
@media (max-width: 576px) {
  .modal-card {
    max-width: 92% !important;
    border-radius: var(--border-radius-md);
  }
  
  .input-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

/* Adaptação responsiva no Header da página */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    padding: 16px;
  }
  
  .header-actions {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  /* Esconder texto dos botões no mobile para não amontoar */
  .header-actions .btn-text {
    display: none !important;
  }
  
  .header-actions .btn {
    padding: 10px 14px;
  }
  
  .header-actions .icon-left {
    margin-right: 0 !important;
  }
  
  .tab-header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    text-align: center;
  }
  
  .section-tabs {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
  }
  
  .tab-btn {
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* Estilo para avisos vazios de cartão */
.card-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 30px 16px;
  font-style: italic;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-md);
  border: 1px dashed var(--glass-border);
}

.log-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.log-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Cores de status nos logs e sessões */
.status-success {
  color: var(--success) !important;
}

.status-failed {
  color: var(--error) !important;
}

/* ======================================================== */
/* TABELAS COMPACTAS COM ALTURA FIXA E ROLAGEM (OPÇÃO 1) */
/* ======================================================== */

/* Limitar a altura e permitir rolagem interna para contêineres de tabela no desktop */
.view-desktop .table-container {
  max-height: 350px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 6px;
}

.view-desktop #sessions-table {
  table-layout: fixed !important;
  width: 100% !important;
}

.view-desktop #sessions-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-desktop #sessions-table th:nth-child(1),
.view-desktop #sessions-table td:nth-child(1) { width: 18%; }
.view-desktop #sessions-table th:nth-child(2),
.view-desktop #sessions-table td:nth-child(2) { width: 12%; }
.view-desktop #sessions-table th:nth-child(3),
.view-desktop #sessions-table td:nth-child(3) { width: 18%; }
.view-desktop #sessions-table th:nth-child(4),
.view-desktop #sessions-table td:nth-child(4) { width: 12%; }
.view-desktop #sessions-table th:nth-child(5),
.view-desktop #sessions-table td:nth-child(5) { width: 15%; }
.view-desktop #sessions-table th:nth-child(6),
.view-desktop #sessions-table td:nth-child(6) { width: 25%; }

/* Reduzir paddings de th e td no desktop para compactar as tabelas */
.view-desktop th {
  padding: 6px 8px !important;
  font-size: 11px !important;
}

.view-desktop td {
  padding: 8px 8px !important;
  font-size: 12.5px !important;
}

.view-desktop #sessions-table th {
  white-space: normal !important;
  vertical-align: bottom;
  line-height: 1.2;
}

/* Compactar botões dentro de tabelas */
.view-desktop .table-container .btn {
  padding: 5px 10px !important;
  font-size: 11px !important;
}

/* Barra de rolagem customizada e minimalista para contêineres de tabela no desktop */
.view-desktop .table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.view-desktop .table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}

.view-desktop .table-container::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.view-desktop .table-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.view-desktop #sessions-table td.destinations-cell {
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Align tooltip content for desktop table to prevent clipping at the right edge */
.view-desktop td.destinations-cell .destinations-tooltip-content {
  left: auto;
  right: 0;
  transform: scale(0.95);
  transform-origin: bottom right;
}

.view-desktop td.destinations-cell .destinations-tooltip-wrapper:hover .destinations-tooltip-content {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.view-desktop td.destinations-cell .destinations-tooltip-content::after {
  left: auto;
  right: 20px;
  margin-left: 0;
}

/* Flag Stack styling */
.destinations-preview-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.flag-stack {
  display: inline-flex;
  align-items: center;
}

.flag-stack-item {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid hsl(230, 35%, 10%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  object-fit: cover;
  margin-right: -6px;
  transition: all 0.2s ease;
  position: relative;
}

.flag-stack-item:hover {
  transform: translateY(-2px) scale(1.1);
  z-index: 10 !important;
}

.flag-stack-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.flag-stack-more {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  background: hsla(265, 85%, 65%, 0.25);
  border: 1px solid hsla(265, 85%, 65%, 0.4);
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 8px;
  font-family: var(--font-title);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Client controls: Search and filters container */
.client-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

@media(min-width: 1200px) {
  .client-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Search box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 240px;
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-body);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Filter pills */
.filter-pills {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.filter-pill.active {
  background: hsla(265, 85%, 65%, 0.15);
  border-color: var(--primary);
  color: var(--text-primary);
  box-shadow: 0 0 8px rgba(138, 43, 226, 0.1);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot-active {
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.dot-inactive {
  background-color: hsl(220, 10%, 40%);
}

/* Status indicator dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-online 2s infinite;
}

.status-dot.offline {
  background-color: hsl(220, 10%, 40%);
}

@keyframes pulse-online {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}

/* Device OS/Icon container */
.client-name-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  font-size: 15px;
  flex-shrink: 0;
}

.client-meta-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.client-last-active {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.75;
  margin-top: 1px;
}

/* Premium micro-icon action buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0 !important;
  font-size: 14px !important;
  transition: var(--transition);
  border: 1px solid var(--glass-border);
  cursor: pointer;
}

.btn-icon-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-icon-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(138, 43, 226, 0.2);
  transform: translateY(-1px);
}

.btn-icon-danger {
  background: rgba(239, 83, 80, 0.08);
  border-color: rgba(239, 83, 80, 0.2);
  color: hsl(350, 85%, 65%);
}

.btn-icon-danger:hover {
  background: rgba(239, 83, 80, 0.25);
  border-color: var(--error);
  box-shadow: 0 0 8px rgba(239, 83, 80, 0.2);
  transform: translateY(-1px);
  color: #fff;
}


