@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #059669;
  --success-hover: #047857;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warning: #d97706;
  --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;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --transition: 150ms ease;
}

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

body {
  font-family: 'Manrope', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1000px; margin: 0 auto; padding: 24px; }

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
header p { opacity: 0.9; font-size: 14px; }

/* Card */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.card-title { font-size: 16px; font-weight: 600; color: var(--gray-800); margin-bottom: 16px; }

/* API Key Section */
.api-key-section { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.api-key-section .form-group { flex: 1; min-width: 250px; margin-bottom: 0; }
.api-key-actions { display: flex; gap: 8px; }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.tab {
  padding: 10px 20px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  transition: all var(--transition);
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.tab:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Panel */
.panel { display: none; }
.panel.active { display: block; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-group input.error { border-color: var(--danger); }
.form-group .error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-group .hint { color: var(--gray-500); font-size: 12px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

/* Password toggle */
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px;
}
.password-toggle:hover { color: var(--gray-700); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all var(--transition);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-outline { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* List */
.list { margin-top: 20px; }
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}
.list-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.list-filter input, .list-filter select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: border-color var(--transition);
}
.list-item:hover { border-color: var(--gray-300); }
.list-item-info h4 { font-size: 15px; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; }
.list-item-info p { font-size: 13px; color: var(--gray-500); }
.list-item-info .meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Status Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.toast-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { margin-bottom: 16px; }

/* Loading */
.loading-state { text-align: center; padding: 48px; color: var(--gray-500); }
.loading-spinner { width: 32px; height: 32px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }

/* DNS Table */
.dns-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 16px; }
.dns-table th, .dns-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.dns-table th { background: var(--gray-50); font-weight: 600; color: var(--gray-700); }
.dns-table code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', Monaco, monospace; font-size: 12px; }
.copy-btn { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 4px; }
.copy-btn:hover { color: var(--primary); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 24px; }

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 16px; }
  header { padding: 24px; }
  header h1 { font-size: 22px; }
  .tabs { gap: 6px; }
  .tab { padding: 8px 14px; font-size: 13px; }
  .list-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .list-item-actions { width: 100%; }
  .list-item-actions .btn { flex: 1; }
  .btn-block-mobile { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}
