/* ============================================
   SERP Simulator - Styles
   ============================================ */

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

:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-success: #16a34a;
  --color-warning: #ea580c;
  --color-danger: #dc2626;
  --color-google-title: #1a0dab;
  --color-google-url: #4d5156;
  --color-google-snippet: #4d5156;
  --color-google-site-name: #202124;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  padding: 24px 32px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.header-logo-link,
.header-spacer {
  flex: 0 0 auto;
  width: 120px;
}

.header-text {
  flex: 1;
  text-align: center;
}

.header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

.header-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.header-logo {
  height: 32px;
  width: auto;
}

/* --- Container / Layout --- */
.container {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 85px);
}

/* --- Linkes Panel: Eingabe --- */
.input-panel {
  padding: 24px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}

.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-group input[type="text"],
.field-group input[type="url"],
.field-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-group textarea {
  resize: vertical;
  min-height: 60px;
}

/* Counter */
.counter {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary);
  transition: color 0.2s;
}

.counter.danger {
  color: var(--color-danger);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-small {
  padding: 5px 12px;
  font-size: 12px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  margin-top: 6px;
}

.btn-small:hover {
  background: var(--color-border);
  color: var(--color-text);
}

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

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

/* Action-Buttons */
.action-buttons {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
}

/* --- Rechtes Panel: Preview --- */
.preview-panel {
  padding: 24px 32px;
  background: var(--color-bg);
  overflow-y: auto;
}

/* Preview Controls */
.preview-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 20px;
}

.device-toggle {
  display: flex;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toggle-btn {
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.toggle-btn.active {
  background: var(--color-primary);
  color: #fff;
}

.toggle-btn:not(.active):hover {
  background: var(--color-bg);
}

/* SERP Preview Wrapper */
.serp-preview-wrapper {
  display: flex;
  justify-content: center;
}

.serp-preview {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px 28px 28px;
  width: 100%;
  max-width: 700px;
  transition: max-width 0.3s ease;
}

/* Mobile-Layout: wird via .serp-preview.mobile Klasse unten gesteuert */

/* --- Google Suchleiste (dekorativ) --- */
.google-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 12px;
}

.google-logo {
  flex-shrink: 0;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  font-size: 14px;
  font-family: arial, sans-serif;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  outline: none;
  color: #202124;
  background: #fff;
}

.search-input:hover,
.search-input:focus {
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
  border-color: rgba(223, 225, 229, 0);
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* --- Google Tabs (dekorativ) --- */
.google-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #ebebeb;
  margin-bottom: 20px;
  padding-bottom: 0;
}

.google-tabs .tab {
  font-family: arial, sans-serif;
  font-size: 13px;
  color: #70757a;
  padding: 8px 12px;
  cursor: default;
  border-bottom: 3px solid transparent;
  transition: color 0.15s;
}

.google-tabs .tab.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}

/* --- SERP Ergebnis --- */
.serp-result {
  margin-bottom: 24px;
}

.serp-attribution {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.serp-favicon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.serp-attribution-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.serp-site-name {
  font-family: arial, sans-serif;
  font-size: 14px;
  color: var(--color-google-site-name);
  font-weight: 400;
}

.serp-url {
  font-family: arial, sans-serif;
  font-size: 12px;
  color: var(--color-google-url);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serp-title {
  margin: 0 0 4px 0;
}

.serp-title a {
  font-family: arial, sans-serif;
  font-size: 20px;
  line-height: 1.3;
  color: var(--color-google-title);
  text-decoration: none;
  font-weight: 400;
  cursor: pointer;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serp-title a:hover {
  text-decoration: underline;
}

.serp-snippet {
  font-family: arial, sans-serif;
  font-size: 14px;
  line-height: 1.58;
  color: var(--color-google-snippet);
  word-wrap: break-word;
}

.serp-snippet strong {
  font-weight: 700;
  color: #3c4043;
}

/* --- Platzhalter-Ergebnisse --- */
.placeholder-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.placeholder-result {
  padding-top: 0;
}

.ph-attribution {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.ph-favicon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e8eaed;
  flex-shrink: 0;
}

.ph-site-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ph-bar {
  border-radius: 3px;
  background: #e8eaed;
}

.ph-bar-name {
  width: 80px;
  height: 10px;
}

.ph-bar-url {
  width: 120px;
  height: 8px;
  background: #f0f0f0;
}

.ph-bar-title {
  width: 75%;
  height: 18px;
  margin-bottom: 6px;
  background: #c8cdf0;
}

.ph-bar-desc {
  width: 100%;
  height: 12px;
  margin-bottom: 4px;
  background: #e8eaed;
}

.ph-bar-desc.short {
  width: 65%;
}

/* --- Mobil-Anpassungen für Preview --- */

/* Container: schmaler, grauer Hintergrund, kein Padding/Radius */
.serp-preview.mobile {
  max-width: 400px;
  padding: 0;
  background: #f1f3f4;
  border-radius: 12px;
  overflow: hidden;
}

/* Google-Bar: Logo zentriert, Suchleiste volle Breite darunter */
.serp-preview.mobile .google-bar {
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: #fff;
  padding: 16px 16px 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.serp-preview.mobile .google-logo {
  width: 74px;
  height: 24px;
}

.serp-preview.mobile .search-input-wrapper {
  width: 100%;
}

.serp-preview.mobile .search-input {
  border-radius: 20px;
  font-size: 14px;
  background: #f1f3f4;
  border: none;
  padding: 10px 40px 10px 16px;
}

.serp-preview.mobile .search-input:hover,
.serp-preview.mobile .search-input:focus {
  box-shadow: none;
}

/* Tabs: weißer Hintergrund, kompakter */
.serp-preview.mobile .google-tabs {
  background: #fff;
  padding: 0 12px;
  margin-bottom: 0;
  border-bottom: 1px solid #ebebeb;
}

.serp-preview.mobile .google-tabs .tab {
  font-size: 12px;
  padding: 8px 10px;
}

/* Haupt-Ergebnis als Karte */
.serp-preview.mobile .serp-result {
  background: #fff;
  padding: 16px;
  margin: 8px 0 0 0;
  border-radius: 0;
}

.serp-preview.mobile .serp-title a {
  font-size: 18px;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.serp-preview.mobile .serp-snippet {
  font-size: 14px;
  line-height: 1.54;
}

/* Platzhalter-Ergebnisse als separate Karten */
.serp-preview.mobile .placeholder-results {
  gap: 0;
}

.serp-preview.mobile .placeholder-result {
  background: #fff;
  padding: 16px;
  margin-top: 8px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }

  .input-panel {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .preview-panel {
    padding: 24px 16px;
  }
}

@media (max-width: 500px) {
  .header {
    padding: 16px 16px;
  }

  .input-panel {
    padding: 16px;
  }

  .url-row {
    flex-direction: column;
  }
}
