/* ===== RESET & BASE STYLES ===== */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #1f2937;
  --dark-bg: #111827;
  --light: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-700: #374151;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #f5f7fb 0%, #f0f4ff 100%);
  color: var(--dark);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none" opacity="0.1"><path d="M0,0 L100,0 L100,100 Z" fill="white"/></svg>');
  background-size: cover;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  position: relative;
  letter-spacing: -0.5px;
}

.header span {
  color: #c7d2fe;
  font-weight: 600;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* ===== CONTAINER & LAYOUT ===== */
.container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ===== PANELS ===== */
.panel {
  background: white;
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  height: fit-content;
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
}

.panel-header i {
  font-size: 1.5rem;
  color: var(--primary);
}

.panel-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.95rem;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 0.25rem;
}

.form-select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: white;
  color: var(--dark);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 3rem;
  transition: var(--transition);
}

.form-select:hover {
  border-color: var(--primary-light);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: white;
  color: var(--dark);
  transition: var(--transition);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.9rem;
}

.form-input:hover, .form-textarea:hover {
  border-color: var(--primary-light);
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--gray-300);
}

/* ===== PREVIEW SECTION ===== */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
}

.preview-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-header h3 i {
  color: var(--primary);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
}

.btn i {
  font-size: 1.1rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.btn-success {
  background: var(--secondary);
  color: white;
}

.btn-success:hover {
  background: #0da271;
  transform: translateY(-2px);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: #e08b0a;
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--gray-700);
  color: white;
}

.btn-secondary:hover {
  background: var(--dark);
  transform: translateY(-2px);
}

.btn-icon {
  padding: 0.75rem;
  min-width: 45px;
  justify-content: center;
}

/* ===== TEST DROPDOWN ===== */
.test-wrapper {
  position: relative;
}

.test-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 100;
  border: 1px solid var(--gray-200);
}

.test-wrapper:hover .test-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.test-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--dark);
  text-decoration: none;
  transition: var(--transition);
  border-bottom: 1px solid var(--gray-100);
}

.test-dropdown a:last-child {
  border-bottom: none;
}

.test-dropdown a:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.test-dropdown a i {
  width: 20px;
  font-size: 1.1rem;
}

/* ===== CODE PREVIEW ===== */
.code-container {
  position: relative;
}

pre {
  background: var(--dark-bg);
  color: #e5e7eb;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  border: 1px solid #374151;
  max-height: 500px;
  position: relative;
}

pre::before {
  content: 'JSON';
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--dark);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: translateX(100px);
  opacity: 0;
  transition: var(--transition);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 350px;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast i {
  font-size: 1.25rem;
  color: var(--secondary);
}

/* ===== ADS CONTAINER ===== */
.ads-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.ads-container ins {
  border-radius: var(--radius);
  overflow: hidden;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }
  
  .container {
    padding: 0 1rem;
    margin: 1.5rem auto;
  }
  
  .panel {
    padding: 1.25rem;
  }
  
  .actions {
    justify-content: flex-start;
    margin-top: 1rem;
  }
  
  .preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 1.5rem 1rem;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }
  
  .btn-icon {
    min-width: 40px;
  }
}

/* ===== SCHEMA SELECT STYLING ===== */
.schema-select-container {
  position: relative;
}

/* ===== SCHEMA TYPE BADGES ===== */
.schema-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--gray-100);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-left: 0.5rem;
}

/* ===== FIELD GROUP STYLING ===== */
.field-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  display: block;
}

/* ===== LOADING INDICATOR ===== */
.loading {
  position: relative;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== SCHEMA COUNT BADGE ===== */
.schema-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}