/* Auth Container */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}

.auth-card {
  background: var(--white);
  padding: 40px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header .logo {
  justify-content: center;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--gray);
}

.auth-card h2 {
  margin-bottom: 24px;
  text-align: center;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  color: var(--gray);
}

.auth-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
  color: var(--white);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: var(--gray-light);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--white);
}

.nav-item.active {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border-left-color: var(--primary);
}

.nav-icon {
  font-size: 20px;
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .btn-outline {
  border-color: rgba(255,255,255,0.3);
  color: var(--white);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  background: var(--light);
  min-height: 100vh;
}

.content-header {
  background: var(--white);
  padding: 20px 32px;
  border-bottom: 1px solid var(--gray-lighter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.content-header h1 {
  font-size: 24px;
}

.business-badge {
  background: var(--primary-light);
  color: var(--white);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.section {
  padding: 32px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  font-size: 40px;
  opacity: 0.9;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
}

.stat-label {
  color: var(--gray);
  font-size: 14px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* QR Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
}

.qr-display {
  background: var(--light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.qr-display img {
  max-width: 300px;
  border-radius: var(--radius-sm);
}

.qr-placeholder {
  width: 300px;
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray);
}

.qr-placeholder span {
  font-size: 64px;
  margin-bottom: 16px;
}

.qr-actions {
  text-align: center;
}

.qr-expiry {
  margin-top: 16px;
  color: var(--gray);
  font-size: 14px;
}

/* QR Grid */
.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.qr-status {
  text-align: center;
  margin-bottom: 16px;
}

.status-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.status-badge.active {
  background: #dcfce7;
  color: #166534;
}

.status-badge.used {
  background: #fef2f2;
  color: #dc2626;
}

.qr-display.qr-used {
  opacity: 0.5;
  position: relative;
}

.qr-display.qr-used::after {
  content: 'USADO';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  background: rgba(220, 38, 38, 0.9);
  color: white;
  padding: 8px 24px;
  font-size: 24px;
  font-weight: 700;
  border-radius: 8px;
}

/* Scan Feed */
.scan-feed {
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
}

.empty-feed {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}

.empty-feed span {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.empty-feed p {
  font-size: 16px;
  margin-bottom: 4px;
}

.empty-feed small {
  font-size: 13px;
  opacity: 0.7;
}

.scan-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.scan-item.new {
  animation: slideIn 0.5s ease;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scan-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.scan-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scan-phone {
  font-weight: 600;
  font-size: 16px;
  color: var(--dark);
}

.scan-detail {
  font-size: 14px;
  color: var(--gray);
}

.scan-time {
  font-size: 13px;
  color: var(--gray);
  flex-shrink: 0;
}

.qr-preview {
  padding: 20px;
  text-align: center;
}

.qr-preview img {
  max-width: 200px;
  margin-bottom: 16px;
}

/* WhatsApp */
.whatsapp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.whatsapp-quick-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.connected {
  background: var(--success);
}

.status-dot.disconnected {
  background: var(--danger);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.status-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.status-indicator.connected {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-indicator.disconnected {
  background: var(--danger);
}

#wa-qr-container {
  margin: 24px 0;
  text-align: center;
}

#wa-qr-container img {
  max-width: 250px;
  border-radius: var(--radius-sm);
}

.connection-actions {
  display: flex;
  gap: 12px;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.logo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.logo-preview {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  background: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stamp-preview {
  border-radius: 50%;
}

/* Filters Bar */
.filters-bar {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: var(--light);
  border-radius: var(--radius-sm);
  margin: 0 20px 16px 20px;
  align-items: center;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.6;
}

.search-box .form-control {
  padding-left: 40px;
  width: 100%;
}

.filter-group {
  min-width: 180px;
}

.filter-group .form-control {
  width: 100%;
}

.customers-count {
  font-size: 14px;
  color: var(--gray);
  font-weight: 500;
  margin-left: auto;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

mark {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

/* Table */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-lighter);
}

.data-table th {
  background: var(--light);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--gray);
}

.data-table tr:hover {
  background: var(--light);
}

.empty-state {
  text-align: center;
  color: var(--gray);
  padding: 40px !important;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-primary {
  background: #e0e7ff;
  color: #3730a3;
}

/* Connection Tabs */
.connection-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  border-bottom: 2px solid var(--gray-lighter);
  padding-bottom: 0;
}

.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  padding: 20px 0;
}

.tab-content:not(.active) {
  display: none;
}

/* Pairing Code Display */
.pairing-code {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 24px;
  border-radius: var(--radius);
  text-align: center;
  margin: 16px 0;
}

.pairing-code h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  opacity: 0.9;
}

.pairing-code .code {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 8px;
  font-family: monospace;
}

.pairing-code p {
  margin-top: 16px;
  font-size: 13px;
  opacity: 0.8;
}

.pairing-steps {
  background: var(--light);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.pairing-steps ol {
  margin: 0;
  padding-left: 20px;
}

.pairing-steps li {
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--gray);
}

/* Subscription Info */
.subscription-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--light);
  padding: 8px 16px;
  border-radius: 20px;
  margin-right: 16px;
}

.subscription-status {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
}

.subscription-status.active {
  background: #dcfce7;
  color: #166534;
}

.subscription-status.warning {
  background: #fef3c7;
  color: #92400e;
}

.subscription-status.expired {
  background: #fef2f2;
  color: #dc2626;
}

.subscription-days {
  font-size: 13px;
  color: var(--gray);
}

#subscription-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid var(--primary-light);
}

#subscription-card .card-header {
  border-bottom-color: var(--primary-light);
}

.subscription-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-lighter);
}

.subscription-detail:last-of-type {
  border-bottom: none;
}

.subscription-detail .label {
  color: var(--gray);
  font-size: 14px;
}

.subscription-detail .value {
  font-weight: 600;
  font-size: 14px;
}

.subscription-detail .badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.subscription-detail .badge.active {
  background: #dcfce7;
  color: #166534;
}

.subscription-detail .badge.trial {
  background: #fef3c7;
  color: #92400e;
}

.subscription-detail .badge.expired {
  background: #fef2f2;
  color: #dc2626;
}

.subscription-progress .progress-bar {
  height: 8px;
  background: var(--gray-lighter);
  border-radius: 4px;
  overflow: hidden;
}

.subscription-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.subscription-progress .progress-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.subscription-progress .progress-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-grid,
  .whatsapp-grid,
  .settings-grid,
  .qr-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .section {
    padding: 16px;
  }
}
