*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f5;
  --panel: #fff;
  --border: #ddd;
  --label-bg: #ececec;
  --text: #333;
  --muted: #666;
  --google-blue: #1a0dab;
  --google-green: #006621;
  --counter-bg: #d4edda;
  --counter-text: #155724;
  --btn-reset: #e8a54b;
  --btn-share: #5cb85c;
  --zalo: #0068ff;
  --facebook: #1877f2;
  --brand-red: #d93025;
  --brand-dark: #2c2c2c;
  --call-blue: #1558d6;
  --ttg-zalo: #0180c7;
  --ttg-zalo-hover: #0172b1;
  --ttg-call-float: #4a6578;
  --ttg-call-float-hover: #3d5566;
  --ttg-hotline-blue: #1a73e8;
  --ttg-cta-orange: #f79a1f;
  --ttg-cta-orange-dark: #e8890b;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  font-family: Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header — giống trungtamgoogle.com */
.ttg-header {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 900;
}

.ttg-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.ttg-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.ttg-logo-img {
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

.ttg-header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.ttg-header-nav a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.ttg-nav-phone a {
  color: var(--ttg-hotline-blue);
  padding: 8px 12px;
  border-radius: 6px;
}

.ttg-nav-phone a:hover {
  background: #e8f0fe;
}

.ttg-nav-icon {
  flex-shrink: 0;
}

.ttg-nav-zalo a {
  color: var(--ttg-zalo);
  padding: 6px 10px;
  border-radius: 6px;
}

.ttg-nav-zalo a:hover {
  color: var(--ttg-zalo-hover);
  background: #e6f4fc;
}

.ttg-zalo-icon {
  flex-shrink: 0;
}

.ttg-btn-dangky {
  background: linear-gradient(180deg, var(--ttg-cta-orange) 0%, var(--ttg-cta-orange-dark) 100%);
  color: #fff !important;
  padding: 10px 18px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(247, 154, 31, 0.45);
}

.ttg-btn-dangky:hover {
  filter: brightness(1.06);
  box-shadow: 0 3px 10px rgba(247, 154, 31, 0.55);
}

/* Nút nổi bên phải — Chat Zalo + Gọi Miễn Phí */
.ttg-float-contact {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 850;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ttg-float-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 140px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, filter 0.15s;
}

.ttg-float-btn:hover {
  transform: translateX(-2px);
  filter: brightness(1.05);
}

.ttg-float-zalo {
  background: var(--ttg-zalo);
}

.ttg-float-zalo:hover {
  background: var(--ttg-zalo-hover);
}

.ttg-float-call {
  background: var(--ttg-call-float);
}

.ttg-float-call:hover {
  background: var(--ttg-call-float-hover);
}

/* Thanh hotline dưới cùng (mobile) */
.ttg-hotline-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 860;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  background: #fff;
  border-top: 2px solid var(--ttg-hotline-blue);
  color: var(--ttg-hotline-blue);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.ttg-hotline-bar svg {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .ttg-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .ttg-header-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .ttg-float-contact {
    right: 8px;
    top: auto;
    bottom: 72px;
    transform: none;
  }

  .ttg-float-btn {
    min-width: 120px;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .ttg-hotline-bar {
    display: flex;
  }

  body {
    padding-bottom: 64px;
  }
}

@media (max-width: 520px) {
  .ttg-nav-zalo span,
  .ttg-float-btn span {
    font-size: 0.75rem;
  }

  .ttg-btn-dangky {
    padding: 8px 12px;
    font-size: 0.7rem;
  }
}

.site-header {
  background: #e8e8e8;
  padding: 28px 0 24px;
  border-bottom: 1px solid #ccc;
}

.site-header h1 {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #444;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 900px;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 28px 20px 48px;
  align-items: start;
}

@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Form */
.ad-form {
  background: var(--panel);
  border: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 130px 1fr 42px;
  border-bottom: 1px solid var(--border);
  align-items: stretch;
}

.form-row label {
  background: var(--label-bg);
  padding: 10px 12px;
  font-weight: 500;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.form-row input,
.form-row textarea {
  border: none;
  padding: 10px 12px;
  font: inherit;
  width: 100%;
  resize: vertical;
  min-height: 42px;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: 2px solid #4285f4;
  outline-offset: -2px;
}

.char-counter {
  background: var(--counter-bg);
  color: var(--counter-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  border-left: 1px solid var(--border);
}

.char-counter.warn {
  background: #fff3cd;
  color: #856404;
}

.char-counter.over {
  background: #f8d7da;
  color: #721c24;
}

.path-row {
  grid-template-columns: 130px 1fr;
}

.path-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.path-domain {
  color: var(--muted);
  font-size: 0.9rem;
}

.path-inputs input {
  border: 1px solid var(--border);
  padding: 6px 8px;
  width: 90px;
  min-height: auto;
}

.add-headline-row {
  grid-template-columns: 130px auto 1fr;
  background: #fafafa;
  align-items: center;
}

.headline-hint {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-add {
  width: 36px;
  height: 36px;
  margin: 8px;
  border: none;
  background: var(--btn-share);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
}

.btn-add:hover {
  filter: brightness(1.08);
}

.form-check {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.form-check label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-actions {
  display: flex;
  gap: 12px;
  padding: 20px 16px;
}

.btn {
  border: none;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
}

.btn-reset {
  background: var(--btn-reset);
}

.btn-share {
  background: var(--btn-share);
}

.btn:hover {
  filter: brightness(1.05);
}

.hidden {
  display: none !important;
}

/* Preview panel */
.preview-panel {
  position: sticky;
  top: 16px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-label {
  font-weight: 600;
  font-size: 1.1rem;
}

.btn-shuffle {
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-shuffle:hover {
  background: #f0f4ff;
  color: var(--call-blue);
  border-color: #a8c7fa;
}

.device-tabs {
  display: flex;
  gap: 4px;
  background: #e0e0e0;
  padding: 4px;
  border-radius: 8px;
}

.device-tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
}

.device-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.preview-stage {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #dfe1e5;
  border-radius: 12px;
  min-height: 480px;
}

.device-frame {
  background: #fff;
  transition: width 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

/* Desktop */
.preview-stage[data-device="desktop"] .device-frame {
  width: 100%;
  max-width: 580px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Tablet */
.preview-stage[data-device="tablet"] .device-frame {
  width: 480px;
  max-width: 100%;
  border-radius: 12px;
  border: 8px solid #333;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Mobile */
.preview-stage[data-device="mobile"] .device-frame {
  width: 320px;
  max-width: 100%;
  border-radius: 28px;
  border: 10px solid #2d2d2d;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.google-shell {
  padding: 16px;
  font-family: Arial, sans-serif;
}

.preview-stage[data-device="mobile"] .google-shell {
  padding: 12px;
}

.google-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 10px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
}

.search-placeholder {
  flex: 1;
  color: #9aa0a6;
  font-size: 0.95rem;
}

.google-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid #ebebeb;
  padding-bottom: 8px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.google-tabs .tab {
  color: #5f6368;
  cursor: default;
}

.google-tabs .tab.active {
  color: #1a73e8;
  border-bottom: 3px solid #1a73e8;
  padding-bottom: 8px;
  margin-bottom: -11px;
}

.preview-stage[data-device="mobile"] .google-tabs {
  gap: 12px;
  font-size: 0.75rem;
  overflow-x: auto;
}

/* Ad preview */
.ad-preview {
  padding: 4px 0;
}

.ad-site-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.ad-favicon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8f0fe 0%, #fce8e6 100%);
  border: 1px solid #dadce0;
  flex-shrink: 0;
}

.ad-site-info {
  flex: 1;
  min-width: 0;
}

.ad-site-name {
  display: block;
  font-size: 0.9rem;
  color: #202124;
  font-weight: 400;
  line-height: 1.3;
}

.ad-breadcrumb {
  display: block;
  font-size: 0.78rem;
  color: #4d5156;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.ad-menu-dots {
  color: #70757a;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
}

.ad-headline {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--google-blue);
  line-height: 1.35;
  cursor: default;
}

.preview-stage[data-device="mobile"] .ad-headline {
  font-size: 1.05rem;
}

.ad-meta-desktop {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.preview-stage[data-device="mobile"] .ad-meta-desktop,
.preview-stage[data-device="tablet"] .ad-meta-desktop {
  display: none;
}

.preview-stage[data-device="desktop"] .ad-site-row {
  display: none;
}

.ad-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ad-badge {
  background: var(--google-green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
}

.ad-url {
  color: var(--google-green);
  font-size: 0.85rem;
}

.ad-desc {
  margin: 6px 0;
  color: #4d5156;
  font-size: 0.9rem;
}

.ad-callouts {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: 0.85rem;
  color: #4d5156;
}

.ad-callouts li::after {
  content: " · ";
  color: #70757a;
}

.ad-callouts li:last-child::after {
  content: "";
}

.ad-sitelinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ebebeb;
}

.ad-sitelinks a {
  color: var(--google-blue);
  text-decoration: none;
  font-size: 0.9rem;
}

.preview-stage[data-device="mobile"] .ad-sitelinks {
  flex-direction: column;
  gap: 6px;
}

/* Nút gọi — kiểu Google mobile */
.ad-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 20px;
  border: 1px solid #dadce0;
  border-radius: 999px;
  background: #fff;
  color: var(--call-blue);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  max-width: 100%;
}

.ad-call-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ad-call-btn .call-icon {
  flex-shrink: 0;
}

.preview-stage[data-device="desktop"] .ad-call-btn {
  margin-top: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 520px;
  width: 100%;
  position: relative;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.modal-hint {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.share-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.share-link-box input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.btn-copy-inline {
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: #f8f9fa;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.share-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
}

.share-zalo {
  background: var(--zalo);
}

.share-facebook {
  background: var(--facebook);
}

.share-copy {
  background: #555;
}

.share-icon {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.expiry-note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  z-index: 1100;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
