/* AI SiteGen v6.0 - Frontend styles */
.aisg-wrapper {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.aisg-form-panel {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.aisg-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: #1a1a2e;
}

.aisg-subtitle {
  color: #888;
  font-size: 0.9rem;
  margin: 0 0 24px;
}

.aisg-form { display: flex; flex-direction: column; gap: 18px; }

.aisg-field { display: flex; flex-direction: column; gap: 6px; }
.aisg-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}
.aisg-field input[type="text"],
.aisg-field input[type="tel"],
.aisg-field textarea,
.aisg-field select {
  padding: 10px 14px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.aisg-field input:focus,
.aisg-field textarea:focus,
.aisg-field select:focus { border-color: #667eea; }

.aisg-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.aisg-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.aisg-chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f8f9fa;
  transition: background 0.2s;
}
.aisg-chk:hover { background: #eef0f5; }
.aisg-chk input { accent-color: #667eea; }

.aisg-dropzone {
  border: 2px dashed #d0d0d0;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.aisg-dropzone:hover, .aisg-dropzone.dragover {
  border-color: #667eea;
  background: #f0f3ff;
}
.aisg-dropzone p { margin: 0; color: #888; font-size: 0.9rem; }

.aisg-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.aisg-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
}
.aisg-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.aisg-preview-item .remove {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: none; border-radius: 50%;
  width: 20px; height: 20px; font-size: 0.7rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.aisg-btn-generate {
  padding: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.aisg-btn-generate:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(102,126,234,0.35); }
.aisg-btn-generate:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Result panel */
.aisg-result-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 48px);
}

.aisg-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 10px;
}

.aisg-device-toggle {
  display: flex;
  gap: 4px;
  background: #f0f0f5;
  border-radius: 10px;
  padding: 4px;
}
.aisg-device-btn {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  color: #888;
  transition: all 0.2s;
}
.aisg-device-btn.active { background: #fff; color: #667eea; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.aisg-device-btn:hover:not(.active) { color: #555; }

.aisg-actions { display: flex; gap: 10px; }
.aisg-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: all 0.2s;
}
.aisg-action-btn:hover:not(:disabled) { background: #667eea; color: #fff; border-color: #667eea; }
.aisg-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.aisg-preview-container {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  background: #f5f5f8;
}

.aisg-iframe {
  width: 100%;
  max-width: 1400px;
  min-height: 800px;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  transition: max-width 0.3s, max-height 0.3s;
}
.aisg-iframe.device-tablet { max-width: 768px; }
.aisg-iframe.device-mobile { max-width: 375px; }

.aisg-placeholder {
  text-align: center;
  color: #aaa;
  padding: 80px 20px;
}
.aisg-placeholder-icon { font-size: 3rem; margin-bottom: 15px; }
.aisg-placeholder p { margin: 0 0 5px; font-size: 1.1rem; }
.aisg-placeholder-hint { font-size: 0.9rem !important; color: #ccc; }

.aisg-loading {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}
.aisg-spinner {
  width: 50px; height: 50px;
  border: 4px solid #e8e8e8;
  border-top-color: #667eea;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: aisg-spin 0.8s linear infinite;
}
@keyframes aisg-spin { to { transform: rotate(360deg); } }

.aisg-error-msg {
  background: #fff0f0;
  color: #c0392b;
  padding: 16px 20px;
  border-radius: 10px;
  margin: 20px;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .aisg-wrapper { grid-template-columns: 1fr; }
  .aisg-form-panel { max-height: none; }
  .aisg-result-panel { max-height: none; }
  .aisg-iframe { min-height: 600px; }
}
