/* ========================================
   Zaptomater API Tester - Dark Theme
   Postman-inspired design
   ======================================== */

:root {
  /* Background colors */
  --bg-darkest: #0d0d0d;
  --bg-darker: #1a1a1a;
  --bg-dark: #212121;
  --bg-medium: #2d2d2d;
  --bg-light: #3d3d3d;
  --bg-hover: #404040;

  /* Text colors */
  --text-primary: #e6e6e6;
  --text-secondary: #a0a0a0;
  --text-muted: #6b6b6b;

  /* Accent colors */
  --accent-orange: #ff6c37;
  --accent-green: #00c853;
  --accent-blue: #2196f3;
  --accent-purple: #9c27b0;
  --accent-yellow: #ffc107;
  --accent-red: #f44336;
  --accent-cyan: #00bcd4;

  /* Method colors */
  --method-get: #00c853;
  --method-post: #ffc107;
  --method-put: #2196f3;
  --method-delete: #f44336;
  --method-patch: #9c27b0;

  /* Status colors */
  --status-success: #00c853;
  --status-error: #f44336;
  --status-warning: #ffc107;

  /* Border */
  --border-color: #3d3d3d;
  --border-light: #4a4a4a;

  /* Font */
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Sizing */
  --sidebar-width: 280px;
  --header-height: 50px;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-darkest);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

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

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

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

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

/* ========================================
   Layout
   ======================================== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-darker);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-orange);
  letter-spacing: -0.5px;
}

.sidebar-header .logo span {
  color: var(--text-primary);
}

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.sidebar-search input:focus {
  border-color: var(--accent-orange);
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Collections/Folders */
.collection {
  margin-bottom: 4px;
}

.collection-header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background 0.15s;
}

.collection-header:hover {
  background: var(--bg-dark);
}

.collection-header .arrow {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.collection-header .arrow.expanded {
  transform: rotate(90deg);
}

.collection-items {
  display: none;
  padding-left: 8px;
}

.collection-items.expanded {
  display: block;
}

/* API Items */
.api-item {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 28px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 2px solid transparent;
}

.api-item:hover {
  background: var(--bg-dark);
}

.api-item.active {
  background: var(--bg-dark);
  border-left-color: var(--accent-orange);
}

.api-item .method {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 10px;
  min-width: 45px;
  text-align: center;
  font-family: var(--font-mono);
}

.api-item .method.get {
  background: rgba(0, 200, 83, 0.15);
  color: var(--method-get);
}
.api-item .method.post {
  background: rgba(255, 193, 7, 0.15);
  color: var(--method-post);
}
.api-item .method.put {
  background: rgba(33, 150, 243, 0.15);
  color: var(--method-put);
}
.api-item .method.delete {
  background: rgba(244, 67, 54, 0.15);
  color: var(--method-delete);
}
.api-item .method.patch {
  background: rgba(156, 39, 176, 0.15);
  color: var(--method-patch);
}

.api-item .name {
  color: var(--text-primary);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Settings Button */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

.settings-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.settings-btn svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   Main Content Area
   ======================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-darkest);
}

/* Request Header Bar */
.request-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.request-path {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.request-path .category {
  color: var(--text-secondary);
}

.request-path .separator {
  color: var(--text-muted);
}

.request-path .endpoint-name {
  color: var(--text-primary);
  font-weight: 500;
}

/* URL Bar */
.url-bar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.method-selector {
  position: relative;
}

.method-selector select {
  appearance: none;
  padding: 10px 32px 10px 12px;
  background: var(--bg-medium);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--method-get);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  outline: none;
  min-width: 90px;
}

.method-selector select:focus {
  border-color: var(--accent-orange);
}

.method-selector::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

.url-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-medium);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.url-base {
  padding: 10px 12px;
  background: var(--bg-light);
  color: var(--accent-orange);
  font-family: var(--font-mono);
  font-size: 13px;
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.url-base:hover {
  background: var(--bg-hover);
}

.url-endpoint {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}

.url-endpoint::placeholder {
  color: var(--text-muted);
}

.send-btn {
  padding: 10px 24px;
  background: var(--accent-orange);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

.send-btn:disabled {
  background: var(--bg-light);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   Tabs
   ======================================== */
.tabs-container {
  display: flex;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
}

.tab {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

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

.tab .badge {
  background: var(--bg-light);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

.tab.active .badge {
  background: var(--accent-orange);
  color: white;
}

/* ========================================
   Tab Content Panels
   ======================================== */
.tab-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel {
  display: none;
  flex: 1;
  overflow: auto;
  padding: 20px;
}

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

/* Docs Panel */
.docs-panel {
  max-width: 800px;
}

.docs-panel h3 {
  color: var(--text-primary);
  font-size: 16px;
  margin-bottom: 12px;
}

.docs-panel p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.docs-panel .endpoint-info {
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.docs-panel .info-row {
  display: flex;
  margin-bottom: 8px;
}

.docs-panel .info-label {
  width: 120px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
}

.docs-panel .info-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Body Panel */
.body-panel .body-type-selector {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.body-panel .body-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.body-panel .body-type-option input {
  accent-color: var(--accent-orange);
}

.body-panel .body-type-option.active {
  color: var(--text-primary);
}

.body-editor {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.body-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-medium);
  border-bottom: 1px solid var(--border-color);
}

.body-editor-header span {
  color: var(--accent-green);
  font-size: 12px;
  font-weight: 600;
}

.body-editor textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  background: var(--bg-dark);
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.body-editor textarea::placeholder {
  color: var(--text-muted);
}

/* Authorization Panel */
.auth-panel .auth-info {
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 16px;
}

.auth-panel .auth-type {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-panel .auth-type-badge {
  background: var(--accent-green);
  color: var(--bg-darkest);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
}

.auth-panel .auth-type span {
  color: var(--text-primary);
  font-weight: 500;
}

.auth-panel .token-display {
  background: var(--bg-medium);
  border-radius: 6px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  max-height: 100px;
  overflow-y: auto;
}

.auth-panel .no-token {
  color: var(--status-warning);
  font-size: 13px;
}

/* Headers Panel */
.headers-panel table {
  width: 100%;
  border-collapse: collapse;
}

.headers-panel th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-dark);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.headers-panel td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 13px;
}

.headers-panel .header-key {
  color: var(--accent-cyan);
}

.headers-panel .header-value {
  color: var(--text-secondary);
}

/* ========================================
   Response Section
   ======================================== */
.response-section {
  border-top: 1px solid var(--border-color);
  background: var(--bg-darker);
  display: flex;
  flex-direction: column;
  height: 300px;
  min-height: 100px;
  position: relative;
}

.response-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  background: transparent;
  z-index: 10;
  transition: background 0.15s;
}

.response-resize-handle:hover,
.response-resize-handle:active {
  background: var(--accent-orange);
}

.response-resize-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 4px;
  background: var(--bg-light);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.response-resize-handle:hover::before {
  opacity: 1;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.response-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.response-meta {
  display: flex;
  gap: 20px;
}

.response-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.response-meta-item .label {
  color: var(--text-muted);
}

.response-meta-item .value {
  font-family: var(--font-mono);
  font-weight: 600;
}

.response-meta-item .value.success {
  color: var(--status-success);
}

.response-meta-item .value.error {
  color: var(--status-error);
}

.response-meta-item .value.warning {
  color: var(--status-warning);
}

.response-body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px;
}

.response-body pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.response-body .json-key {
  color: var(--accent-cyan);
}

.response-body .json-string {
  color: var(--accent-green);
}

.response-body .json-number {
  color: var(--accent-yellow);
}

.response-body .json-boolean {
  color: var(--accent-purple);
}

.response-body .json-null {
  color: var(--text-muted);
}

/* Empty/Placeholder States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  max-width: 300px;
}

/* Loading State */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-light);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  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: var(--bg-darker);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 16px;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-dark);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-orange);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-mono);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary:hover {
  background: #ff8555;
}

.btn-secondary {
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-medium);
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.toast.error {
  border-left: 3px solid var(--status-error);
}

.toast.warning {
  border-left: 3px solid var(--status-warning);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

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

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

.toast.warning .toast-icon {
  color: var(--status-warning);
}

.toast-message {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

/* ========================================
   Sign In Page
   ======================================== */
.signin-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-darkest);
}

.signin-card {
  background: var(--bg-darker);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.signin-card .logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-orange);
  margin-bottom: 8px;
}

.signin-card .logo span {
  color: var(--text-primary);
}

.signin-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.signin-card h2 {
  color: var(--text-primary);
  font-size: 20px;
  margin-bottom: 24px;
}

.oauth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.oauth-btn:hover {
  background: var(--bg-medium);
  border-color: var(--border-light);
}

.oauth-btn svg {
  width: 20px;
  height: 20px;
}

.oauth-btn.google:hover {
  border-color: #4285f4;
}

.oauth-btn.github:hover {
  border-color: #fff;
}

.oauth-btn.zoho:hover {
  border-color: #e42527;
}

.signin-error {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--status-error);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  color: var(--status-error);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

/* Keyboard shortcut styling */
kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border-color);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100%;
    z-index: 100;
    transition: left 0.3s;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    cursor: pointer;
  }
}
