/* ==========================================================================
   cURL to IntelliJ HTTP Client - Modern Stylesheet
   JetBrains-inspired theme with Dark and Light mode support
   ========================================================================== */

:root {
  /* Dark Theme (Default) */
  --bg-primary: #1e1f22;
  --bg-secondary: #2b2d30;
  --bg-tertiary: #313438;
  --bg-input: #18191c;
  --bg-hover: #393b40;
  --bg-card: #26282b;
  
  --border-color: #393b40;
  --border-focus: #3574f0;
  --border-subtle: #2e3034;

  --text-primary: #dfe1e5;
  --text-secondary: #9da0a8;
  --text-muted: #6f737a;
  --text-inverse: #ffffff;

  --accent-primary: #3574f0;
  --accent-primary-hover: #4884f5;
  --accent-secondary: #7c4dff;
  --accent-gradient: linear-gradient(135deg, #3574f0 0%, #7c4dff 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4884f5 0%, #8e62ff 100%);

  --success: #3ac769;
  --success-bg: rgba(58, 199, 105, 0.15);
  --warning: #f5a623;
  --warning-bg: rgba(245, 166, 35, 0.15);
  --error: #f75454;
  --error-bg: rgba(247, 84, 84, 0.15);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg-primary: #f4f6f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;
  --bg-input: #ffffff;
  --bg-hover: #e2e6ea;
  --bg-card: #ffffff;

  --border-color: #d1d5db;
  --border-focus: #2563eb;
  --border-subtle: #e5e7eb;

  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-secondary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
  --accent-gradient-hover: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 100%);

  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px 16px 48px;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
header {
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(53, 116, 240, 0.4);
}

.title-group h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.title-group p {
  font-size: 13px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

.btn-icon {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* Two-Panel Layout */
.converter-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.converter-grid > .editor-card:first-of-type {
  z-index: 20;
}

.editor-card:has(.dropdown-menu.show) {
  z-index: 1000;
}

.editor-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(53, 116, 240, 0.2), var(--shadow-md);
}

/* Card Header Toolbar */
.card-header {
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  border-top-left-radius: calc(var(--radius-lg) - 1px);
  border-top-right-radius: calc(var(--radius-lg) - 1px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-title svg {
  color: var(--accent-primary);
}

.method-tag {
  display: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.method-tag.visible {
  display: inline-block;
}

.method-tag.GET { background: rgba(58, 199, 105, 0.2); color: #3ac769; }
.method-tag.POST { background: rgba(245, 166, 35, 0.2); color: #f5a623; }
.method-tag.PUT { background: rgba(53, 116, 240, 0.2); color: #3574f0; }
.method-tag.DELETE { background: rgba(247, 84, 84, 0.2); color: #f75454; }
.method-tag.PATCH { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.method-tag.HEAD, .method-tag.OPTIONS { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
  font-family: var(--font-sans);
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-primary-action {
  background: var(--accent-gradient);
  color: #ffffff;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(53, 116, 240, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary-action:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(53, 116, 240, 0.45);
}

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

.btn.success {
  background: var(--success) !important;
  color: #ffffff !important;
  border-color: var(--success) !important;
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.15);
  min-width: 260px;
  max-height: min(440px, 70vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1000;
  display: none;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

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

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  width: 100%;
  display: block;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-hover);
}

.dropdown-item:last-child {
  margin-bottom: 2px;
}

.dropdown-item span {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

/* Textareas */
.textarea-wrapper {
  position: relative;
  width: 100%;
}

textarea {
  width: 100%;
  min-height: 220px;
  max-height: 500px;
  resize: vertical;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  border: none;
  outline: none;
  tab-size: 2;
  white-space: pre;
  word-break: normal;
}

textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Card Footer */
.card-footer {
  padding: 8px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  border-bottom-left-radius: calc(var(--radius-lg) - 1px);
  border-bottom-right-radius: calc(var(--radius-lg) - 1px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.status-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.active {
  background: var(--success);
}

.counter-group {
  display: flex;
  gap: 12px;
}

/* Middle Transform Action Bar */
.action-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.action-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.kbd-shortcut {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.options-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-label:hover {
  color: var(--text-primary);
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Info Section / Guide */
.guide-card {
  margin-top: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.guide-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.guide-step {
  display: flex;
  gap: 12px;
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.step-content p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.step-content code {
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent-primary);
}

/* Privacy Note */
.privacy-note {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.privacy-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(58, 199, 105, 0.15);
  color: var(--success);
  flex-shrink: 0;
}

.privacy-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
}

.toast.success {
  border-color: var(--success);
}

.toast.success svg {
  color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.error svg {
  color: var(--error);
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    padding: 16px 12px 32px;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-divider {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary-action {
    justify-content: center;
    width: 100%;
  }

  .options-group {
    justify-content: flex-start;
  }
}
