/* ===== RESET E BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  min-height: 100vh;
}

.container {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid #e1e8ed;
  padding: 2rem 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.logo {
  padding: 0 2rem;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  padding: 0 2rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.user-avatar {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
}

.user-details h3 {
  font-size: 0.95rem;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.user-details p {
  font-size: 0.8rem;
  color: #7f8c8d;
}

.nav-tabs {
  padding: 0 1rem;
}

.nav-tabs p {
  padding: 0 1rem;
  font-size: 0.75rem;
  color: #7f8c8d;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.tab-button {
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #2c3e50;
  font-size: 0.9rem;
  transition: all 0.3s;
  margin-bottom: 0.25rem;
}

.tab-button:hover {
  background: #f5f7fa;
}

.tab-button.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 280px;
  padding: 2rem;
  flex: 1;
}

.section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ===== TABS INTERNAS ===== */
.internal-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e1e8ed;
}

.internal-tab-button {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  color: #7f8c8d;
  font-weight: 600;
  transition: all 0.3s;
}

.internal-tab-button.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  font-size: 0.9rem;
}

.readonly-input {
  background: #f5f7fa;
  color: #2c3e50;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== QR CODE ===== */
.qr-container {
  background: #f5f7fa;
  border-radius: 12px;
  padding: 2rem;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.qr-container img {
  max-width: 300px;
  border-radius: 12px;
  border: 4px solid #667eea;
}

.loading {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.status-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 1rem;
}

.status-connected {
  background: #d4edda;
  color: #155724;
}

.status-qr {
  background: #fff3cd;
  color: #856404;
}

.status-disconnected {
  background: #f8d7da;
  color: #721c24;
}

.status-connecting {
  background: #d1ecf1;
  color: #0c5460;
}

.success-icon {
  font-size: 80px;
  color: #28a745;
  margin-bottom: 1rem;
}

.info-text {
  color: #666;
  margin: 10px 0;
  font-size: 0.95em;
}

/* ===== ALERT ===== */
.alert-warning {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 1rem;
  border-radius: 8px;
  margin: 2rem 0;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-secondary {
  background: #e1e8ed;
  color: #2c3e50;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.btn-link {
  background: none;
  border: none;
  color: #3498db;
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
}

/* ===== WEBHOOKS ===== */
.webhooks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
}

/* ===== LOGS ===== */
.logs-container {
  background: #f5f7fa;
  border-radius: 8px;
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.logs {
  display: flex;
  flex-direction: column;
}

.log-item {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.log-item.info {
  background: #d1ecf1;
  color: #0c5460;
}

.log-item.success {
  background: #d4edda;
  color: #155724;
}

.log-item.error {
  background: #f8d7da;
  color: #721c24;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-bottom: 1rem;
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active {
  display: flex;
}

.loading-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .tab-content.active {
    grid-template-columns: 1fr;
  }
  
  .webhooks-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}