/**
 * webhook-management.css
 *
 * Styling for Webhook Management Panel
 * Pattern: dashboard-builder.css color scheme and spacing
 */

/* ========================================
   Panel Header
   ======================================== */

.webhook-management {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.webhook-management .panel-header {
  margin-bottom: 2rem;
}

.webhook-management .panel-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.webhook-management .panel-header .subtitle {
  font-size: 1rem;
  color: #64748b;
  margin: 0;
}

/* ========================================
   Platform Cards Section
   ======================================== */

.platform-cards-section {
  margin-bottom: 3rem;
}

.platform-cards-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #1e293b;
}

.platform-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.platform-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}

.platform-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  transform: translateY(-2px);
}

.platform-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.platform-card h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.platform-description {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 0.75rem;
  min-height: 3em;
}

.platform-pricing {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.platform-active-badge {
  display: inline-block;
  background: #10b981;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.platform-guide-link {
  display: inline-block;
  font-size: 0.875rem;
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.platform-guide-link:hover {
  color: #5568d3;
  text-decoration: underline;
}

/* ========================================
   Webhooks List Section
   ======================================== */

.webhooks-list-section {
  margin-bottom: 2rem;
}

.webhooks-list-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #1e293b;
}

/* Empty State */
.empty-state {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.empty-state p {
  color: #64748b;
  margin: 0;
}

/* Webhooks Table */
.webhooks-table-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.webhooks-table {
  width: 100%;
  border-collapse: collapse;
}

.webhooks-table thead {
  background: #f8fafc;
}

.webhooks-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}

.webhooks-table tbody tr {
  transition: background-color 0.15s ease;
}

.webhooks-table tbody tr:hover {
  background: #f8fafc;
}

.webhooks-table tbody tr.webhook-inactive {
  opacity: 0.6;
}

.webhooks-table td {
  padding: 1rem;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.875rem;
}

.webhooks-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status Icon */
.status-icon {
  font-size: 1.25rem;
  display: inline-block;
}

.status-update-flash {
  animation: flash-pulse 1s ease;
}

@keyframes flash-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* Webhook URL */
.webhook-url {
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s ease;
}

.webhook-url:hover {
  color: #5568d3;
  text-decoration: underline;
}

/* Event Count Badge */
.event-count {
  display: inline-block;
  background: #e0e7ff;
  color: #4338ca;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Success Rate */
.success-rate {
  font-weight: 600;
  margin-right: 0.5rem;
}

.delivery-count {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Webhook Actions */
.webhook-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.btn-icon {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: scale(1.1);
}

.btn-icon.btn-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* ========================================
   Add Webhook Section
   ======================================== */

.add-webhook-section {
  text-align: center;
  margin-top: 2rem;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .webhook-management {
    padding: 1rem;
  }

  .platform-cards-grid {
    grid-template-columns: 1fr;
  }

  .webhooks-table-wrapper {
    overflow-x: auto;
  }

  .webhooks-table {
    min-width: 800px;
  }

  .webhook-actions {
    flex-wrap: wrap;
  }
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
  .webhook-management .panel-header h2 {
    color: #e2e8f0;
  }

  .webhook-management .panel-header .subtitle {
    color: #94a3b8;
  }

  .platform-card {
    background: #1e293b;
    border-color: #334155;
  }

  .platform-card h4 {
    color: #e2e8f0;
  }

  .platform-description {
    color: #94a3b8;
  }

  .webhooks-table-wrapper {
    background: #1e293b;
    border-color: #334155;
  }

  .webhooks-table th {
    background: #0f172a;
    color: #cbd5e1;
    border-color: #334155;
  }

  .webhooks-table td {
    border-color: #334155;
    color: #cbd5e1;
  }

  .webhooks-table tbody tr:hover {
    background: #0f172a;
  }

  .empty-state {
    background: #0f172a;
    border-color: #334155;
  }

  .empty-state h4 {
    color: #e2e8f0;
  }

  .empty-state p {
    color: #94a3b8;
  }
}

/* ========================================
   Webhook Type Buttons
   ======================================== */

.webhook-type-buttons {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.webhook-type-buttons .btn-large {
  flex: 1;
  padding: 0.875rem 1.25rem;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.webhook-type-hint {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0;
}

/* Success Box (Incoming Webhook Created) */
.success-box {
  background: #dcfce7;
  border: 2px solid #22c55e;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.success-box p {
  margin: 0.5rem 0;
  color: #166534;
}

.success-box strong {
  color: #15803d;
}

/* Info Box */
.info-box {
  background: #f0f9ff;
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.info-box strong {
  color: #0369a1;
  display: block;
  margin-bottom: 0.5rem;
}

.info-box p {
  margin: 0.5rem 0;
  color: #075985;
  font-size: 0.875rem;
  line-height: 1.5;
}

.info-box ol {
  margin: 0.5rem 0 0 1.5rem;
  color: #075985;
  font-size: 0.875rem;
}

.info-box ul {
  margin: 0.25rem 0 0 1.5rem;
  font-size: 0.875rem;
}

.info-box a {
  color: #0284c7;
  text-decoration: none;
}

.info-box a:hover {
  text-decoration: underline;
}

/* Copy Input Group */
.copy-input-group {
  display: flex;
  gap: 0.5rem;
}

.copy-input-group input {
  flex: 1;
  font-family: monospace;
  font-size: 0.875rem;
}

.copy-input-group .btn-icon {
  flex-shrink: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.copy-input-group .btn-icon:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

/* Warning Hint */
.form-hint.warning {
  color: #dc2626;
  font-weight: 600;
}
