/* ==========================================================================
   Corporate Digital Employee Profile Template
   Premium Redesign with Cairo / Plus Jakarta Sans & Perfect RTL / LTR BiDi
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Readex+Pro:wght@400;500;600;700&display=swap');

:root {
  /* Brand Color Palette */
  --primary: #062a4d;
  --primary-hover: #041f39;
  --primary-light: #eef5fc;
  --secondary: #0d5c9b;
  --secondary-light: #e8f2fa;
  --accent: #d9222a;
  --accent-hover: #b81820;
  
  /* Status & Action Colors */
  --success: #108a48;
  --success-hover: #0d733c;
  --success-bg: #ecfdf3;
  --success-border: #abecd0;
  
  --whatsapp: #1da851;
  --whatsapp-hover: #168a41;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Surfaces & Neutral Backgrounds */
  --background: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-hover: #f1f5f9;
  
  /* Text & Border Tokens */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Elevation Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 20px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 35px -5px rgba(15, 23, 42, 0.12), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

  /* Rounded Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Layout */
  --container-max: 1060px;
  --min-touch-target: 44px;
  --font-en: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-ar: 'Cairo', 'Readex Pro', system-ui, -apple-system, sans-serif;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-en);
  background-color: var(--background);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL Typography & Direction */
html[dir="rtl"] body {
  font-family: var(--font-ar);
  direction: rtl;
  text-align: right;
}

html[dir="ltr"] body {
  font-family: var(--font-en);
  direction: ltr;
  text-align: left;
}

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

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

img, svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* BiDi Overrides for Numbers & Emails */
.bidi-ltr,
[dir="rtl"] .info-value.bidi-ltr,
[dir="rtl"] a[href^="tel:"],
[dir="rtl"] a[href^="mailto:"],
[dir="rtl"] .font-mono {
  direction: ltr !important;
  unicode-bidi: embed !important;
  text-align: start;
  display: inline-block;
}

/* ==========================================================================
   Main Container Card
   ========================================================================== */

.profile-card {
  width: 100%;
  max-width: var(--container-max);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: auto;
  transition: all var(--transition-normal);
}

/* ==========================================================================
   1. Header Section (Clean Corporate Gradient)
   ========================================================================== */

.profile-header {
  background: linear-gradient(135deg, #052442 0%, #083765 60%, #06284a 100%);
  color: var(--text-light);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 80px;
}

@media (min-width: 768px) {
  .profile-header {
    padding: 18px 32px;
    min-height: 88px;
  }
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Website Link Button */
.website-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-light);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-height: 38px;
  transition: all var(--transition-fast);
}

.website-link:hover, .website-link:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.website-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Language Toggle Switch */
.lang-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.18);
  direction: ltr !important;
}

.lang-btn {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-full);
  min-height: 28px;
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 900;
}

.lang-btn:hover:not(.active) {
  color: var(--text-light);
}

/* Company Header Logo */
.header-branding {
  display: flex;
  align-items: center;
}

.company-logo {
  height: 46px;
  max-height: 50px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

@media (min-width: 768px) {
  .company-logo {
    height: 52px;
    max-height: 56px;
    max-width: 220px;
  }
}

/* ==========================================================================
   2. Main Profile Body
   ========================================================================== */

.profile-main {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 768px) {
  .profile-main {
    padding: 36px 32px;
    gap: 28px;
  }
}

/* Inactive Profile Banner */
.inactive-banner {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.875rem;
}

.inactive-banner.show {
  display: flex;
}

.inactive-banner svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ==========================================================================
   3. Hero Section (Unified & Symmetrical)
   ========================================================================== */

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  gap: 24px;
  box-shadow: var(--shadow-xs);
}

@media (min-width: 992px) {
  .hero-section {
    padding: 32px;
    gap: 28px;
  }
}

.hero-identity-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Avatar Wrap */
.avatar-wrap {
  position: relative;
  width: 124px;
  height: 124px;
}

@media (min-width: 768px) {
  .avatar-wrap {
    width: 140px;
    height: 140px;
  }
}

.employee-avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow-md);
  outline: 1px solid var(--border);
  background: var(--surface-alt);
}

.company-badge-icon {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--surface);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* Identity Text */
.identity-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.employee-name {
  font-size: 1.625rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .employee-name {
    font-size: 2rem;
  }
}

.employee-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--secondary);
}

.employee-org {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Verified Badge */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

.verified-badge svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ==========================================================================
   4. Hero Action Buttons (Call, WhatsApp, Email, Save Contact)
   ========================================================================== */

.action-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 680px;
}

@media (min-width: 640px) {
  .action-buttons-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
}

.btn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  min-height: 76px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--text-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-action:hover, .btn-action:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-action:active {
  transform: translateY(0);
}

.btn-action svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Button Variants */
.btn-call {
  background: linear-gradient(135deg, #0d5c9b 0%, #083c66 100%);
}
.btn-call:hover {
  background: linear-gradient(135deg, #0f6bb5 0%, #0a497c 100%);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #1fa453 0%, #15803d 100%);
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #22b55b 0%, #168d43 100%);
}

.btn-email {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
}
.btn-email:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

.btn-save-contact {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--border);
}
.btn-save-contact:hover {
  background: var(--surface-hover);
  border-color: #cbd5e1;
}
.btn-save-contact svg {
  fill: var(--primary);
}

/* ==========================================================================
   5. Public Profile URL Bar
   ========================================================================== */

.url-bar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-md);
}

.url-display {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  font-family: monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--secondary);
}

.url-display svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.url-display span {
  direction: ltr !important;
  unicode-bidi: embed !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 800;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-copy:hover, .btn-copy:focus-visible {
  background: var(--surface-hover);
  border-color: #cbd5e1;
}

.btn-copy svg {
  width: 14px;
  height: 14px;
  fill: var(--secondary);
}

/* ==========================================================================
   6. Content Grid (Info List & Share QR Card)
   ========================================================================== */

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 992px) {
  .content-grid {
    grid-template-columns: 1.8fr 1.2fr;
    gap: 24px;
  }
}

/* Info List Card */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background-color var(--transition-fast);
}

.info-item:last-child {
  border-bottom: none;
}

.info-item:hover {
  background-color: var(--surface-alt);
}

.info-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-icon-box svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.info-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
}

.info-value {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--text-main);
  word-break: break-word;
}

.info-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Hover link for email & phone */
.hover-link:hover {
  color: var(--secondary);
  text-decoration: underline;
}

/* Mini Action Buttons inside Info Rows */
.mini-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 800;
  transition: all var(--transition-fast);
  text-decoration: none;
  flex-shrink: 0;
}

.mini-action-btn.wa {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.mini-action-btn.wa:hover {
  background: var(--success);
  color: #ffffff;
}

.mini-action-btn.call {
  background: var(--primary-light);
  color: var(--secondary);
  border: 1px solid #c2d8ed;
}
.mini-action-btn.call:hover {
  background: var(--secondary);
  color: #ffffff;
}

.mini-action-btn.email {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.mini-action-btn.email:hover {
  background: var(--danger);
  color: #ffffff;
}

/* Google Maps Pill Link */
.map-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 800;
  transition: all var(--transition-fast);
  text-decoration: none;
  flex-shrink: 0;
}

.map-link-btn:hover, .map-link-btn:focus-visible {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

/* ==========================================================================
   7. Share & QR Card
   ========================================================================== */

.share-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.share-title {
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--primary);
}

.share-desc {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 240px;
  line-height: 1.4;
}

.qr-box {
  padding: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  min-height: 160px;
}

.qr-box img, .qr-box canvas {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 4px;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  background: var(--primary);
  color: var(--text-light);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-share:hover, .btn-share:focus-visible {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-share svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ==========================================================================
   8. Footer
   ========================================================================== */

.profile-footer {
  background: #041f39;
  color: var(--text-light);
  padding: 18px 24px;
  text-align: center;
}

.footer-official {
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.footer-sub {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-family: monospace;
}

/* ==========================================================================
   9. Feedback Toast Notification
   ========================================================================== */

.toast-message {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 1000;
}

.toast-message.show {
  opacity: 1;
  transform: translateY(0);
}

/* Utility Hidden */
.is-hidden {
  display: none !important;
}
