:root {
  --primary: #041e42;
  --secondary: #013559;
  --accent: #1d4f91;
  --bg: #ffffff;
  --text: #0f1e3a;
  --muted: #6c86aa;
  --card: #ffffff;
  --border: #abcae9;
  --divider: #e8eff7;
  --ok: #1e824c;
  --danger: #b42318;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --gutter: clamp(10px, 2vw, 24px);
  --pad: clamp(10px, 2.2vw, 22px);
  --gap: clamp(.5rem, 1.2vw, .9rem);
  --fs-body: clamp(13px, 1.3vw, 16px);
  --fs-small: clamp(12px, 1.1vw, 14px);
  --focus: #cfe3fb;
  --page-w: min(800px, 100% - var(--gutter) * 2);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Tajawal", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  /* Added background image with dark overlay for readability */
  background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url("../assets/background.png") center / cover
    no-repeat fixed;
  color: var(--text);
  margin: 0;
  font-size: var(--fs-body);
  line-height: 1.55;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  padding: .8rem var(--gutter);
  display: flex;
  justify-content: center;
  box-shadow: var(--shadow);
}

.app-logo {
  font-weight: 800;
  letter-spacing: .3px;
}

.page {
  width: var(--page-w);
  margin: 0 auto;
  padding: var(--gutter) 0;
  display: grid;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.title {
  font-weight: 800;
  /* Changed title to white with text shadow for visibility on background */
  color: #ffffff;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.6);
  font-size: clamp(22px, 4vw, 36px);
  text-align: center;
  margin-top: .4rem;
}

.subtitle {
  text-align: center;
  /* Changed subtitle to white with text shadow for visibility on background */
  color: #ffffff;
  text-shadow: 1px 1px 6px rgba(0, 0, 0, 0.6);
  margin-bottom: .4rem;
}

.form-grid {
  display: grid;
  gap: var(--gap);
}

.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.field label {
  font-weight: 700;
  color: #0f2b55;
  font-size: var(--fs-small);
}

.field input {
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 44px;
  transition: .15s;
}

.field input:focus {
  outline: 2px solid var(--focus);
  border-color: #86b5ea;
  box-shadow: 0 0 0 2px #e9f3ff inset;
  background: #f9fbff;
}

.input-wrap {
  position: relative;
}

.input-wrap button {
  position: absolute;
  top: 50%;
  left: .6rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-wrap input {
  padding-left: 2.5rem;
}

.btn {
  padding: .7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--secondary);
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  width: 100%;
  transition: .15s;
}

.btn:hover {
  transform: translateY(-1px);
  background: #f4f8ff;
  border-color: #9fc2e9;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #164074;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.link:hover {
  text-decoration: underline;
}

.consent-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: var(--fs-small);
}

.consent-row input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.msg {
  display: none;
  font-size: var(--fs-small);
  padding: .6rem .8rem;
  border-radius: 10px;
  text-align: right;
  border: 1px solid transparent;
}

.msg.err {
  background: #fdecea;
  color: #8a1c1c;
  border-color: #f5c2c7;
}

.msg.ok {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #b4e0b9;
}

.muted {
  color: var(--muted);
}

.mt-2 {
  margin-top: .5rem;
}

.mt-3 {
  margin-top: .75rem;
}

.mt-4 {
  margin-top: 1rem;
}

.center {
  text-align: center;
}

.hidden {
  display: none;
}

.error-msg {
  display: none;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  background: #fdecec;
  color: #842029;
  border: 1px solid #f5c2c7;
}

.spinner {
  display: none;
}
