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

:root {
  --lime: #D4F62A;
  --lime-dark: #b8d91e;
  --black: #141414;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --surface: #ffffff;
  --bg: #f4f4f0;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.theme-dark {
  --lime: #D4F62A;
  --lime-dark: #b8d91e;
  --black: #ffffff;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --border: #262626;
  --surface: #141414;
  --bg: #0a0a0a;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  font-family: 'Inter', -apple-system, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ─── Loading ───────────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Not Found ─────────────────────────────────────────────── */
.not-found-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}

.not-found-emoji {
  font-size: 64px;
  margin-bottom: 8px;
}

.not-found-screen h2 {
  font-size: 24px;
  font-weight: 700;
}

.not-found-screen p {
  color: var(--muted);
  font-size: 15px;
}

/* ─── Layout ────────────────────────────────────────────────── */
.card-wrapper {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 48px;
  min-height: 100dvh;
}

/* ─── Profile Card ──────────────────────────────────────────── */
.profile-card {
  margin: 0 16px;
  background: var(--surface);
  border-radius: 28px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

/* ─── Banner Section ────────────────────────────────────────── */
.banner-section {
  position: relative;
  margin-bottom: 56px;
}

.banner {
  width: 100%;
  height: 200px;
  background: #e8e4de;
  background-size: cover;
  background-position: center;
}

.banner-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.banner-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid var(--border);
}

.banner-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.banner-btn:active {
  transform: scale(0.95);
}

/* ─── Avatar ────────────────────────────────────────────────── */
.avatar-ring {
  position: absolute;
  bottom: -52px;
  left: 20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--surface);
  padding: 4px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: none;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #f0ede8;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Profile Card ──────────────────────────────────────────── */
.profile-card {
  margin: 0 16px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.profile-info {
  padding: 0px 24px 32px;
}

.display-name {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 6px;
}

.job-title {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 28px;
}

/* ─── Bio ───────────────────────────────────────────────────── */
.bio-section {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}

.bio-line {
  width: 2px;
  min-height: 56px;
  background: var(--border);
  border-radius: 2px;
  flex-shrink: 0;
}

.bio-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.bio {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* ─── Links ─────────────────────────────────────────────────── */
.links-container {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.link-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.link-tile:active {
  transform: scale(0.98);
}

.link-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.link-label {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.link-arrow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-arrow svg {
  width: 11px;
  height: 11px;
}

/* ─── Exchange Button ───────────────────────────────────────── */
.exchange-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  margin: 20px 16px 24px;
  height: 56px;
  background: var(--lime);
  color: var(--black);
  font-size: 16px;
  font-weight: 700;
  border-radius: 18px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.exchange-btn:hover {
  background: var(--lime-dark);
  transform: translateY(-1px);
}

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

/* ─── Footer ────────────────────────────────────────────────── */
.footer {
  padding: 0 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.footer-brand {
  font-weight: 700;
  color: var(--text);
  transition: opacity 0.15s;
}

.footer-brand:hover {
  opacity: 0.7;
}

/* ─── btn-primary (not found page) ─────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  background: var(--lime);
  color: var(--black);
  font-size: 15px;
  font-weight: 700;
  border-radius: 14px;
  margin-top: 8px;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--lime-dark);
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(60px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 0 0 env(safe-area-inset-bottom);
  animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s;
}

.modal-close:hover {
  background: #e5e7eb;
}

.modal-body {
  padding: 0 24px 24px;
}

/* ─── Form ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.required {
  color: #ef4444;
}

.optional {
  font-weight: 400;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(212, 246, 42, 0.2);
  background: var(--surface);
}

.form-error {
  font-size: 13px;
  color: #ef4444;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.submit-btn {
  width: 100%;
  height: 54px;
  background: var(--lime);
  color: var(--black);
  font-size: 16px;
  font-weight: 700;
  border-radius: 16px;
  margin-top: 8px;
  transition: background 0.15s, transform 0.15s;
}

.submit-btn:hover {
  background: var(--lime-dark);
}

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

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (min-width: 480px) {
  body {
    padding: 32px 16px;
  }

  .banner {
    border-radius: 28px;
  }

  .banner-section {
    margin-bottom: 60px;
  }

  .modal {
    border-radius: 28px;
    margin: auto;
  }

  .modal-overlay {
    align-items: center;
  }
}

/* ─── Layout: Left (Default) ────────────────────────────────── */
/* Left is the default — avatar on the left, text left-aligned.
   No extra class needed; these are the base styles above. */

/* ─── Layout: Center ────────────────────────────────────────── */
.layout-center .avatar-ring {
  left: 50%;
  transform: translateX(-50%);
}

.layout-center .profile-info {
  text-align: center;
}

.layout-center .display-name {
  text-align: center;
}

.layout-center .job-title {
  text-align: center;
}

.layout-center .bio-section {
  display: block !important;
  text-align: center !important;
}

.layout-center .bio-line {
  display: none !important;
}

.layout-center .bio-section > div {
  text-align: center !important;
  display: block !important;
}

.layout-center .bio-label {
  display: block !important;
  text-align: center !important;
}

.layout-center .bio {
  text-align: center !important;
  display: block !important;
}

/* Center layout: links as 3-column icon grid */
.layout-center .links-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.layout-center .link-tile {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 8px;
  text-align: center;
  border-radius: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.layout-center .link-tile:hover {
  transform: translateY(-3px);
}

.layout-center .link-icon-wrap {
  width: 48px;
  height: 48px;
}

.layout-center .link-icon-wrap svg,
.layout-center .link-icon-wrap img {
  width: 48px;
  height: 48px;
}

.layout-center .link-label {
  font-size: 12px;
  font-weight: 600;
  flex: none;
}

.layout-center .link-arrow {
  display: none;
}

/* ─── Layout: Right ─────────────────────────────────────────── */
.layout-right .avatar-ring {
  left: auto;
  right: 20px;
}

.layout-right .banner-actions {
  left: 16px;
  right: auto;
}

.layout-right .profile-info {
  text-align: right;
}

.layout-right .display-name {
  text-align: right;
}

.layout-right .job-title {
  text-align: right;
}

.layout-right .bio-section {
  direction: rtl !important;
  text-align: right !important;
  display: flex !important;
  justify-content: flex-start !important;
  gap: 16px !important;
}

.layout-right .bio-section > div {
  text-align: right !important;
}

.layout-right .bio-label {
  text-align: right !important;
}

.layout-right .bio {
  text-align: right !important;
}

/* Links in Right layout: Arabic direction */
.layout-right .link-tile {
  direction: rtl !important;
  text-align: right !important;
}

.layout-right .link-label {
  text-align: right !important;
}

.layout-right .link-arrow svg {
  transform: rotate(180deg) !important;
}

/* ─── Premium Starry Dark Mode ──────────────────────────────── */
body.theme-dark {
  background-image: url('assets/space_bg.jpg') !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* Glassmorphism overrides for stunning dark mode card depth */
body.theme-dark .profile-card {
  background: rgba(20, 20, 20, 0.75) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

body.theme-dark .link-tile {
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.08) !important;
}

body.theme-dark .link-tile:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body.theme-dark .avatar-ring {
  background: rgba(20, 20, 20, 0.8) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.08) !important;
}

body.theme-dark .banner-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

body.theme-dark .banner-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

body.theme-dark .modal {
  background: rgba(20, 20, 20, 0.85) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border-top: 1.5px solid rgba(255, 255, 255, 0.1) !important;
  border-left: 1.5px solid rgba(255, 255, 255, 0.1) !important;
  border-right: 1.5px solid rgba(255, 255, 255, 0.1) !important;
}

body.theme-dark .modal-close {
  background: rgba(255, 255, 255, 0.08) !important;
}

body.theme-dark .modal-close:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

body.theme-dark .form-group input,
body.theme-dark .form-group textarea {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.08) !important;
}

body.theme-dark .form-group input:focus,
body.theme-dark .form-group textarea:focus {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: var(--lime) !important;
}

body.theme-dark .toast {
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}