/**
 * Shared Welcome 2 Life app styles (home-screen design system).
 * Use from hosted apps under /apps/* — do not copy per-app.
 */

:root {
  --ink: #14201c;
  --ink-soft: #3d524a;
  --paper: #f3f6f2;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --line: rgba(20, 32, 28, 0.1);
  --accent: #0f7a5f;
  --accent-deep: #0a5241;
  --accent-soft: rgba(15, 122, 95, 0.12);
  --glow: rgba(15, 122, 95, 0.18);
  --warn: #c47b12;
  --warn-soft: rgba(196, 123, 18, 0.16);
  --danger: #b42318;
  --online: #1f9d55;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(20, 32, 28, 0.1);
  --font: "IBM Plex Sans Arabic", "Sora", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  direction: rtl;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 600px at 8% -10%, rgba(15, 122, 95, 0.16), transparent 55%),
    radial-gradient(800px 500px at 100% 0%, rgba(214, 158, 46, 0.12), transparent 50%),
    linear-gradient(165deg, #eef5f0 0%, #f7f3ea 48%, #e8f0ec 100%);
  background-attachment: fixed;
}

/* Zep desktop showEmbed: iframe scrolls an RTL document, which puts the
   scrollbar on the left and leaves a white gutter on the right. Keep the
   scrollport LTR; inner shells stay RTL. */
html.w2l-zep-embed,
html.w2l-zep-embed body {
  direction: ltr;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html.w2l-zep-embed #app {
  direction: ltr;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

html.w2l-zep-embed .home-shell,
html.w2l-zep-embed .app-shell {
  direction: rtl;
}

body.w2l-app-page {
  padding: 14px;
}

.hidden {
  display: none !important;
}

/* ----- App chrome ----- */

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.widget-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  appearance: none;
  background: transparent;
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 140ms ease, color 140ms ease;
  flex-shrink: 0;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-deep);
  outline: none;
}

.profile-back-btn {
  margin-bottom: 12px;
}

.members-scroll,
.profile-scroll {
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* ----- Buttons ----- */

.bell-btn,
.summon-btn,
.edit-profile-btn,
.guest-cta-btn,
.submit-btn,
.secondary-btn,
.remove-device-btn {
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.bell-btn {
  background: var(--accent-soft);
  border: 1px solid rgba(15, 122, 95, 0.28);
  color: var(--accent-deep);
  font-size: 14px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
}

.bell-btn:hover:not(:disabled) {
  background: rgba(15, 122, 95, 0.2);
  color: var(--ink);
  border-color: var(--accent);
}

.bell-btn-active {
  background: var(--warn-soft);
  border-color: rgba(196, 123, 18, 0.5);
  color: var(--warn);
}

.bell-btn-active:hover:not(:disabled) {
  background: rgba(196, 123, 18, 0.28);
  color: #9a5f0a;
  border-color: var(--warn);
}

.bell-btn:disabled,
.summon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.summon-btn {
  background: rgba(15, 122, 95, 0.1);
  border: 1px solid rgba(15, 122, 95, 0.3);
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
}

.summon-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.summon-btn-loading {
  opacity: 0.7;
  cursor: wait;
}

.edit-profile-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(15, 122, 95, 0.35);
  color: var(--accent-deep);
  font-size: 13px;
  padding: 4px 7px;
  border-radius: 8px;
  line-height: 1;
}

.edit-profile-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.guest-cta-btn,
.submit-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 24px var(--glow);
}

.guest-cta-btn:hover,
.submit-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.submit-btn {
  width: 100%;
  margin-top: 6px;
  border-radius: 12px;
}

.secondary-btn,
.remove-device-btn {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border: 1px solid rgba(15, 122, 95, 0.3);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.secondary-btn:hover,
.remove-device-btn:hover {
  background: rgba(15, 122, 95, 0.2);
  border-color: var(--accent);
  color: var(--ink);
}

.remove-device-btn {
  font-size: 11px;
  padding: 4px 10px;
  min-width: auto;
}

/* ----- Guest CTA ----- */

.guest-cta {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.guest-cta-message {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* ----- Member cards ----- */

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 15px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}

.player-card-online {
  border-color: rgba(31, 157, 85, 0.55);
  box-shadow: 0 0 0 1px rgba(31, 157, 85, 0.2), var(--shadow);
}

.member-card-actions {
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-card-actions .bell-btn,
.member-card-actions .summon-btn {
  position: static;
}

.avatar-container {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(20, 32, 28, 0.08);
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-img {
  max-width: 150%;
  object-fit: cover;
}

.player-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.player-role {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.player-location {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.gender-select-group {
  width: 100%;
  margin-bottom: 6px;
}

.gender-select-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  text-align: center;
}

.gender-select,
.form-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  text-align: right;
}

.gender-select {
  padding: 6px;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
}

.gender-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

.gender-select:disabled {
  opacity: 0.6;
  cursor: wait;
}

.player-invited-by {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: auto;
  padding-top: 10px;
  width: 100%;
}

.player-invited-by-name {
  color: var(--warn);
  font-weight: 600;
}

.player-business-link {
  display: inline-block;
  font-size: 11px;
  color: var(--accent-deep);
  background: transparent;
  border: none;
  padding: 0;
  text-decoration: none;
  margin-bottom: 6px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-family: inherit;
}

.player-business-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.player-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 4px;
  width: 100%;
}

.player-tags + .player-tags {
  margin-top: 12px;
}

.incommon-mini-tag,
.mini-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

.incommon-mini-tag {
  background: rgba(15, 122, 95, 0.12);
  color: var(--accent-deep);
  border: 1px solid rgba(15, 122, 95, 0.28);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.incommon-mini-tag:hover {
  background: rgba(15, 122, 95, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.incommon-mini-tag-active {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fff;
}

.mini-tag {
  background: rgba(20, 32, 28, 0.06);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

/* ----- Profile / forms ----- */

.onboarding-container {
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.onboarding-container p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
  margin-top: 0;
  margin-bottom: 15px;
}

.form-group {
  margin-bottom: 15px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 600;
}

.custom-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 160px;
  overflow-y: auto;
  z-index: 999;
  margin-top: 4px;
  box-shadow: var(--shadow);
}

.dropdown-item {
  padding: 10px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s;
  text-align: right;
}

.dropdown-item:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.selected-pills-container,
.interests-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.selected-pills-container {
  margin-bottom: 6px;
}

.ui-pill,
.interest-pill {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.ui-pill {
  background: var(--accent);
  border: 1px solid var(--accent-deep);
  color: #fff;
}

.ui-pill .remove-pill-btn {
  cursor: pointer;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.85);
}

.ui-pill .remove-pill-btn:hover {
  color: #ffe0e0;
}

.interest-pill {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}

.interest-pill:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.interest-pill.selected {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fff;
}

.suggestion-empty-state {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
}

.notification-option {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}

.notification-option:last-child {
  margin-bottom: 0;
}

.notification-option-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.notification-option-title {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

.inviter-hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 10px;
  line-height: 1.5;
}

.inviter-dropdown-item,
.invited-by-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: rtl;
}

.invited-by-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.invited-by-selected {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.invited-by-selected.hidden,
#invitedByGroup.hidden {
  display: none;
}

.invited-by-name {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.notification-status,
.notification-helper {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.notification-status.success {
  color: var(--online);
}

.notification-status.error {
  color: var(--danger);
}

.linked-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.linked-device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.linked-device-label {
  font-size: 12px;
  color: var(--ink);
}

/* ----- Host shell ----- */

.w2l-app-host,
.w2l-app-host body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

.w2l-app-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.w2l-boot-error {
  display: none;
  box-sizing: border-box;
  min-height: 100%;
  padding: 32px 20px;
  color: var(--ink);
  font-family: var(--font);
  text-align: center;
}

.w2l-boot-error h1 {
  font-size: 1.25rem;
  margin: 0 0 10px;
}

.w2l-boot-error p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}
