/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --primary-light: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

/* Header */
.header {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-bottom: 1px solid var(--primary);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  color: white;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
  flex-shrink: 0;
}

.logo-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
  background: var(--success);
  animation: none;
}

.connection-status.error .status-dot {
  background: var(--danger);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 2rem 0 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  padding-bottom: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section */
.section {
  padding: 1rem 0;
}

.section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-color: var(--primary);
}

.stat-icon {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.15rem;
  transition: all 0.3s;
}

@keyframes counterPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); color: var(--primary-light); }
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Install Section */
.install-section {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1) 0%, rgba(8, 145, 178, 0.05) 100%);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.1);
}

.install-section h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.code-block code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  color: var(--primary-light);
  font-size: 0.9375rem;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.feature-card h4 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Forms */
.form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

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

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.form-section.full-width {
  grid-column: 1 / -1;
}

.form-section h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: var(--primary-light);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
  background: rgba(8, 145, 178, 0.03);
}

.form-group input:hover:not(:focus),
.form-group select:hover:not(:focus),
.form-group textarea:hover:not(:focus) {
  border-color: var(--gray-500);
}

.form-group input:invalid:not(:focus):not(:placeholder-shown),
.form-group select:invalid:not(:focus),
.form-group textarea:invalid:not(:focus):not(:placeholder-shown) {
  border-color: var(--danger);
}

.form-group input:valid:not(:focus):not(:placeholder-shown),
.form-group select:valid:not(:focus),
.form-group textarea:valid:not(:focus):not(:placeholder-shown) {
  border-color: var(--success);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--gray-500);
  opacity: 0.6;
}

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

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

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  position: relative;
}

.btn-primary:disabled::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  top: 50%;
  right: 1rem;
  margin-top: -6px;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: buttonSpin 0.6s linear infinite;
}

@keyframes buttonSpin {
  to { transform: rotate(360deg); }
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.copy-btn,
.copy-btn-small {
  padding: 0.5rem 1rem;
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  font-weight: 500;
}

.copy-btn:hover,
.copy-btn-small:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.copy-btn:active,
.copy-btn-small:active {
  transform: translateY(0);
}

/* Result Section */
.result-section {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-section h3 {
  margin-bottom: 1rem;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-section h3::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--success);
  color: var(--bg);
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: bold;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item strong {
  color: var(--text-muted);
  font-weight: 500;
  min-width: 120px;
}

.payment-link {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
}

.payment-link::after {
  content: '↗';
  font-size: 0.875rem;
  opacity: 0.7;
}

.payment-link:hover {
  color: var(--primary-light);
  transform: translateX(2px);
}

/* Webhook Sections */
.webhook-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.2s;
}

.info-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.1);
}

.info-card strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 0.875rem;
}

.info-card code {
  color: var(--primary-light);
  background: var(--bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
}

.webhook-feed,
.webhook-history {
  margin-bottom: 2rem;
}

.webhook-feed h3,
.webhook-history h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.webhook-feed h3::before {
  content: '📡';
  font-size: 1.5rem;
}

.webhook-history h3::before {
  content: '📜';
  font-size: 1.5rem;
}

.webhook-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 500px;
  overflow-y: auto;
}

.webhook-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.webhook-empty::before {
  content: '📭';
  display: block;
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.webhook-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
  cursor: default;
}

.webhook-item:last-child {
  border-bottom: none;
}

.webhook-item:hover {
  background: var(--bg);
  padding-left: 1.5rem;
}

.webhook-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.webhook-time {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.webhook-body {
  font-size: 0.875rem;
}

.webhook-body strong {
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-failed {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.badge-cancelled {
  background: rgba(107, 114, 128, 0.2);
  color: var(--gray-400);
}

/* Code Examples */
.code-examples {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.example-section h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.example-section h3::before {
  content: '▸';
  color: var(--primary);
  font-size: 1.5rem;
}

.code-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  padding-right: 6rem;
  position: relative;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.code-container:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.1);
}

.code-container pre {
  margin: 0;
  overflow-x: auto;
  padding-right: 1rem;
}

.code-container code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text);
  display: block;
}

.code-container .copy-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* API Reference */
.api-reference {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.api-category h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  color: var(--primary-light);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.api-category h3::before {
  content: '▸';
  color: var(--primary);
  font-size: 1.5rem;
}

.api-endpoint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
  cursor: default;
}

.api-endpoint:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.15);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.method {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.method-get {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.method-post {
  background: rgba(8, 145, 178, 0.2);
  color: var(--primary);
}

.endpoint-header code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.api-endpoint p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0;
}

/* Test Cards Table */
.test-cards {
  margin-top: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.test-cards h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

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

.cards-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
}

.cards-table tbody tr {
  transition: background 0.2s;
}

.cards-table tbody tr:hover {
  background: var(--bg);
}

.cards-table code {
  background: var(--bg);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  color: var(--primary-light);
}

.note {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-top: 1px solid var(--primary);
  padding: 2rem 0;
  margin-top: auto;
  text-align: center;
}

.footer p {
  color: var(--text-muted);
  margin: 0.5rem 0;
  font-size: 0.9375rem;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.footer a:hover {
  color: var(--primary-light);
  transform: translateY(-1px);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(150%);
  transition: transform 0.3s;
  z-index: 1000;
  max-width: 400px;
}

.toast.show {
  transform: translateY(0);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 0.75rem;
  }

  .header {
    padding: 0.5rem 0;
  }

  .header-content {
    flex-direction: row;
    align-items: center;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    border-radius: 6px;
  }

  .logo-text h1 {
    font-size: 0.9rem;
  }

  .logo-text p {
    font-size: 0.65rem;
  }

  .connection-status {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }

  .tabs {
    gap: 0.25rem;
  }

  .tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }

  .section h2 {
    font-size: 1.1rem;
  }

  .subtitle {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.5rem;
  }

  .stat-icon {
    font-size: 1rem;
    margin-bottom: 0.15rem;
  }

  .stat-value {
    font-size: 0.85rem;
  }

  .stat-label {
    font-size: 0.65rem;
  }

  .features-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .webhook-info {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}
