* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0f172a;
  --primary-light: #1e3a8a;
  --accent: #2563eb;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --border: #e5e7eb;
  --danger: #b91c1c;
  --success: #047857;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

body {
  font-family: "Cairo", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(135deg, #f8fafc, var(--bg));
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

.page-wrapper {
  width: min(1180px, 94%);
  margin: 0 auto;
  padding: 36px 0 22px;
}

.hero-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: 28px;
  padding: 42px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  left: -80px;
  top: -80px;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #dbeafe;
  font-size: 14px;
  margin-bottom: 14px;
}

.hero-card h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  margin-bottom: 10px;
}

.hero-card p {
  max-width: 700px;
  color: #e5e7eb;
  font-size: 18px;
}

.dashboard {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.control-panel,
.preview-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.section-title {
  margin-bottom: 22px;
}

.section-title h2 {
  font-size: 24px;
  color: var(--primary);
}

.section-title p {
  color: var(--muted);
  font-size: 15px;
}

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--primary);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  background: #fff;
  transition: 0.2s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input[type="color"] {
  height: 50px;
  padding: 6px;
  cursor: pointer;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--dot-color);
  cursor: pointer;
  transition: 0.2s ease;
}

.color-dot:hover,
.color-dot.active {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.warning-box {
  display: none;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.warning-box.show {
  display: block;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

button {
  font-family: inherit;
  border: none;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: 0.2s ease;
}

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

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

.ghost-btn {
  background: #eef2ff;
  color: var(--primary);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.qr-card {
  min-height: 390px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 24px;
  display: grid;
  place-items: center;
  padding: 24px;
}

.qr-preview {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  max-width: 100%;
  overflow: auto;
}

.qr-preview canvas,
.qr-preview svg {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}

.link-preview {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #f1f5f9;
  color: var(--muted);
  word-break: break-all;
  display: none;
  direction: ltr;
  text-align: left;
}

.link-preview.show {
  display: block;
}


.helper-text {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

input:disabled {
  background: #eef2f7;
  color: #64748b;
  cursor: not-allowed;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.error-text {
  color: var(--danger);
  display: block;
  min-height: 20px;
  margin-top: 6px;
  font-size: 14px;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: grid;
  gap: 10px;
  z-index: 999;
}

.toast {
  background: var(--primary);
  color: #fff;
  padding: 13px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  min-width: 230px;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 22px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .hero-card {
    padding: 30px;
  }
}

@media (max-width: 560px) {
  .page-wrapper {
    width: 92%;
    padding-top: 18px;
  }

  .hero-card,
  .control-panel,
  .preview-panel {
    border-radius: 20px;
    padding: 20px;
  }

  .grid-2,
  .input-row {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn {
    width: 100%;
  }

  .qr-card {
    min-height: 280px;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}

.hidden {
  display: none !important;
}

textarea {
  width: 100%;
  min-height: 95px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  background: #fff;
  transition: 0.2s ease;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.profile-note {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  padding: 13px;
  border-radius: 14px;
  font-size: 14px;
  margin-bottom: 18px;
}

.profile-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.profile-card-view {
  width: min(470px, 100%);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.profile-cover {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  min-height: 120px;
}

.profile-content-view {
  padding: 0 26px 28px;
  margin-top: -54px;
  text-align: center;
}

.avatar-circle {
  width: 108px;
  height: 108px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 6px solid #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  color: var(--primary);
  font-size: 42px;
  font-weight: 800;
}

.profile-content-view h1 {
  color: var(--primary);
  font-size: 30px;
  margin-bottom: 4px;
}

.profile-content-view .title {
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 8px;
}

.profile-content-view .bio {
  color: var(--muted);
  margin-bottom: 18px;
}

.profile-links {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.profile-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  background: #f8fafc;
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 13px 15px;
  border-radius: 15px;
  font-weight: 800;
  transition: 0.2s ease;
}

.profile-link:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
}

.profile-error {
  width: min(560px, 94%);
  background: white;
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--danger);
  font-weight: 800;
}

.profile-link-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-link-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-link-action {
  color: var(--muted);
  font-weight: 700;
  direction: ltr;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}

.profile-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
}

.profile-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.profile-icon-phone { background: #0f172a; }
.profile-icon-whatsapp { background: #16a34a; }
.profile-icon-facebook { background: #1877f2; }
.profile-icon-instagram { background: linear-gradient(135deg, #f97316, #db2777, #7c3aed); }
.profile-icon-telegram { background: #229ed9; }
.profile-icon-youtube { background: #dc2626; }
.profile-icon-snapchat { background: #facc15; color: #111827; }
.profile-icon-tiktok { background: #111827; }
.profile-icon-linkedin { background: #0a66c2; }
.profile-icon-website { background: #2563eb; }

@media (max-width: 420px) {
  .profile-link {
    align-items: flex-start;
  }

  .profile-link-action {
    max-width: 44%;
    font-size: 13px;
  }
}
