:root {
  --green: #00633f;
  --green-2: #008f61;
  --gold: #c99b2e;
  --ink: #152823;
  --muted: #65746f;
  --line: #d9e2df;
  --soft: #f4f7f6;
  --danger: #b83f3a;
  --shadow: 0 16px 48px rgba(28, 53, 46, 0.10);
}

* {
  box-sizing: border-box;
}

body.login-athlete-page {
  margin: 0;
  font-family: "Tajawal", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #eef2f1, #fff 44%, #f5f7f6);
  font-size: 16px;
  min-height: 100vh;
}

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

button, input {
  font: inherit;
}

/* ==========================================================================
   DESKTOP VIEWPORT LOCK (Zero-Scroll Experience for Screen Heights >= 660px)
   ========================================================================== */
@media (min-width: 901px) {
  html, body.login-athlete-page {
    height: 100%;
    overflow: hidden;
  }

  .athlete-login-shell {
    height: calc(100vh - 75px);
    max-height: calc(100vh - 75px);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(380px, 36%) minmax(0, 1fr);
    direction: ltr;
    overflow: hidden;
    border-radius: 0;
  }

  /* Left column: Story & Branding */
  .login-story {
    direction: rtl;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    max-height: 100%;
    padding: clamp(14px, 2.5vh, 28px) clamp(24px, 3vw, 44px) 0;
    background: radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.92), transparent 34%),
                linear-gradient(145deg, #edf2f0, #fff 48%, #e8efec);
    overflow: hidden;
    border-left: 1px solid var(--line);
  }

  .login-story:before {
    content: "";
    position: absolute;
    width: 480px;
    height: 480px;
    border: 1px solid rgba(0, 99, 63, 0.08);
    border-radius: 50%;
    left: -240px;
    top: -80px;
    pointer-events: none;
  }

  .login-story:after {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    background-image: radial-gradient(#c8d5d1 1.5px, transparent 1.5px);
    background-size: 12px 12px;
    right: 36px;
    top: 90px;
    opacity: 0.35;
    pointer-events: none;
  }

  /* Story brand is hidden on desktop because main navbar already holds the primary brand */
  .story-brand {
    display: none;
  }

  .story-copy {
    position: relative;
    z-index: 2;
    margin: clamp(6px, 1.5vh, 18px) 0 clamp(8px, 1.8vh, 16px);
    flex: 0 0 auto;
  }

  .story-copy > span {
    color: var(--green);
    font-weight: 800;
    font-size: 13px;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 99, 63, 0.08);
  }

  .story-copy h1 {
    font-size: clamp(22px, 2.3vw, 34px);
    line-height: 1.3;
    margin: 8px 0 6px;
    font-weight: 900;
  }

  .story-copy h1 em {
    color: var(--gold);
    font-style: normal;
  }

  .story-copy > i {
    display: block;
    width: 44px;
    height: 3px;
    background: var(--gold);
    border-radius: 9px;
    margin-bottom: 8px;
  }

  .story-copy p {
    max-width: 420px;
    color: var(--muted);
    line-height: 1.6;
    font-size: clamp(12.5px, 0.95vw, 14.5px);
    margin: 0;
  }

  /* Proportional, flexible wrestling hero image that never overflows */
  .wrestling-visual {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    min-height: 110px;
    max-height: 270px;
    width: calc(100% + clamp(48px, 6vw, 88px));
    margin: auto calc(-1 * clamp(24px, 3vw, 44px)) 0;
    overflow: hidden;
    border-radius: 50% 50% 0 0 / 24% 24% 0 0;
    background: #173e33;
  }

  .wrestling-visual:after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 49, 37, 0.72));
    pointer-events: none;
  }

  .wrestling-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 38%;
    display: block;
  }

  .privacy-badge {
    position: absolute;
    z-index: 2;
    right: 22px;
    bottom: 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(9, 52, 41, 0.92);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
  }

  .privacy-badge > span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--gold);
    border-radius: 8px;
    color: var(--gold);
    font-size: 13px;
    flex-shrink: 0;
  }

  .privacy-badge b {
    font-size: 12px;
  }

  .privacy-badge small {
    display: block;
    margin-top: 1px;
    color: #c8d9d4;
    font-size: 10px;
  }

  /* Compact 3-point benefits at the base */
  .story-benefits {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0 calc(-1 * clamp(24px, 3vw, 44px));
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--line);
    flex: 0 0 auto;
  }

  .story-benefits article {
    text-align: center;
    padding: clamp(9px, 1.4vh, 14px) 6px;
    border-left: 1px solid var(--line);
  }

  .story-benefits article:last-child {
    border-left: 0;
  }

  .story-benefits span {
    font-size: 18px;
    color: var(--green);
    display: block;
    line-height: 1;
  }

  .story-benefits b {
    display: block;
    margin: 4px 0 2px;
    font-size: 12px;
    font-weight: 800;
  }

  .story-benefits small {
    display: block;
    font-size: 10px;
    color: var(--muted);
  }

  /* Right column: Interactive Login Form */
  .login-main {
    direction: rtl;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    padding: clamp(14px, 2.5vh, 26px) clamp(24px, 5vw, 68px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
  }

  .login-card {
    width: min(520px, 100%);
    margin: auto;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #dfe7e4;
    border-radius: 18px;
    padding: clamp(20px, 2.8vh, 32px) clamp(22px, 3.2vw, 38px);
    box-shadow: var(--shadow);
  }

  .card-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(14px, 2vh, 22px);
  }

  .heading-icon {
    display: grid;
    place-items: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #e5f2ed;
    color: var(--green);
    font-size: 22px;
  }

  .card-heading small {
    color: var(--green-2);
    font-weight: 800;
    font-size: 12px;
    display: block;
  }

  .card-heading h2 {
    font-size: clamp(23px, 2.4vh, 28px);
    margin: 2px 0 0;
    line-height: 1.25;
    font-weight: 900;
  }

  .card-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12.5px;
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: clamp(10px, 1.4vh, 14px);
  }

  .field label {
    font-weight: 800;
    font-size: 13.5px;
    color: var(--ink);
  }

  .input-wrap {
    position: relative;
  }

  .input-wrap > span {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7b8e88;
    font-size: 16px;
    pointer-events: none;
  }

  .field input {
    width: 100%;
    height: clamp(44px, 5.2vh, 48px);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 44px 0 14px;
    background: #fff;
    color: var(--ink);
    font-size: 14.5px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  }

  .field input:focus {
    outline: 3px solid rgba(0, 143, 97, 0.14);
    border-color: var(--green-2);
  }

  .field input[aria-invalid="true"] {
    border-color: var(--danger) !important;
    background-color: #fffbfa;
  }

  .field input[aria-invalid="true"]:focus {
    outline: 3px solid rgba(184, 63, 58, 0.16) !important;
    border-color: var(--danger) !important;
  }

  .password-wrap input {
    padding-left: 70px;
  }

  .toggle-password {
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: #eaf4f0;
    color: var(--green);
    font-weight: 800;
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .toggle-password:hover {
    background: #dbeef7;
  }

  .field-error {
    min-height: 16px;
    line-height: 1.35;
    color: var(--danger);
    font-size: 11.5px;
    font-weight: 700;
    display: block;
    margin-top: 1px;
  }

  .login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2px 0 clamp(10px, 1.6vh, 16px);
    font-size: 13px;
  }

  .login-options label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    cursor: pointer;
    font-weight: 600;
  }

  .login-options input {
    width: 17px;
    height: 17px;
    accent-color: var(--green);
    margin: 0;
  }

  .login-options a {
    color: var(--green);
    font-weight: 800;
    font-size: 12.5px;
  }

  .login-options a:hover {
    text-decoration: underline;
  }

  .login-submit {
    width: 100%;
    height: clamp(45px, 5.4vh, 50px);
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #08724d, #005834);
    color: #fff;
    font-weight: 900;
    font-size: 15.5px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 18px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 99, 63, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 99, 63, 0.25);
  }

  .login-submit span {
    grid-column: 2;
  }

  .login-submit b {
    grid-column: 3;
    justify-self: end;
    font-size: 20px;
  }

  .form-alert {
    display: none;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 9px;
    background: #fff0ef;
    color: var(--danger);
    font-weight: 700;
    font-size: 12.5px;
  }

  .form-alert.show {
    display: block;
  }

  .form-notice {
    display: block;
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 9px;
    background: #e9f7f2;
    color: #006b49;
    font-weight: 700;
    font-size: 12.5px;
  }

  .account-register-prompt {
    text-align: center;
    margin-top: clamp(10px, 1.4vh, 15px);
    color: var(--muted);
    font-size: 13px;
  }

  .account-register-prompt a {
    color: var(--green);
    font-weight: 800;
    margin-right: 4px;
  }

  .account-register-prompt a:hover {
    text-decoration: underline;
  }

  .demo-note {
    margin-top: clamp(8px, 1.4vh, 14px);
    border: 1px dashed #b8d3c9;
    border-radius: 10px;
    background: #edf6f2;
    color: #41615a;
    font-size: 12px;
  }

  .demo-note summary {
    padding: 8px 12px;
    color: var(--green);
    font-weight: 800;
    cursor: pointer;
    font-size: 12px;
  }

  .demo-note > p, .demo-accounts {
    margin: 0;
    padding: 0 12px 8px;
  }

  .demo-accounts {
    display: grid;
    gap: 4px;
  }

  .demo-accounts span {
    direction: ltr;
    text-align: right;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 11.5px;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .demo-accounts span:hover {
    background: #fff;
    color: var(--green);
  }
}

/* Very short desktop screens (< 660px height): gracefully allow smooth scroll inside main */
@media (min-width: 901px) and (max-height: 660px) {
  .login-story {
    padding-top: 10px;
  }
  .story-copy h1 {
    font-size: 22px;
  }
  .wrestling-visual {
    max-height: 150px;
  }
  .story-benefits article {
    padding: 6px 4px;
  }
  .login-card {
    padding: 16px 22px;
  }
  .field {
    margin-bottom: 8px;
  }
  .field input {
    height: 42px;
  }
  .login-submit {
    height: 44px;
  }
}

/* ==========================================================================
   TABLET & MOBILE VIEWS (Screen width <= 900px)
   UX Rule: Form First! No 700px scroll barrier to reach authentication inputs.
   ========================================================================== */
@media (max-width: 900px) {
  body.login-athlete-page {
    background: #f4f7f6;
  }

  .athlete-login-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 75px);
  }

  /* Form is given priority and placed at the top */
  .login-main {
    order: 1;
    direction: rtl;
    padding: 24px 18px 20px;
    width: 100%;
  }

  .login-card {
    width: min(500px, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid #dfe7e4;
    border-radius: 18px;
    padding: 24px 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04);
  }

  .card-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
  }

  .heading-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #e5f2ed;
    color: var(--green);
    font-size: 22px;
    flex-shrink: 0;
  }

  .card-heading small {
    color: var(--green-2);
    font-weight: 800;
    font-size: 12px;
    display: block;
  }

  .card-heading h2 {
    font-size: 25px;
    margin: 2px 0 0;
    font-weight: 900;
  }

  .card-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
  }

  .field label {
    font-weight: 800;
    font-size: 14px;
  }

  .input-wrap {
    position: relative;
  }

  .input-wrap > span {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7b8e88;
    font-size: 16px;
    pointer-events: none;
  }

  .field input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 0 44px 0 14px;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
  }

  .field input:focus {
    outline: 3px solid rgba(0, 143, 97, 0.14);
    border-color: var(--green-2);
  }

  .field input[aria-invalid="true"] {
    border-color: var(--danger) !important;
    background-color: #fffbfa;
  }

  .password-wrap input {
    padding-left: 72px;
  }

  .toggle-password {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: #eaf4f0;
    color: var(--green);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
  }

  .field-error {
    min-height: 16px;
    line-height: 1.35;
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
    display: block;
    margin-top: 2px;
  }

  .login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 18px;
    font-size: 13.5px;
  }

  .login-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    cursor: pointer;
  }

  .login-options input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
  }

  .login-options a {
    color: var(--green);
    font-weight: 800;
  }

  .login-submit {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #08724d, #005834);
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 20px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 99, 63, 0.18);
  }

  .login-submit span {
    grid-column: 2;
  }

  .login-submit b {
    grid-column: 3;
    justify-self: end;
    font-size: 22px;
  }

  .form-alert {
    display: none;
    margin-bottom: 14px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #fff0ef;
    color: var(--danger);
    font-weight: 700;
    font-size: 13px;
  }

  .form-alert.show {
    display: block;
  }

  .form-notice {
    display: block;
    margin: 0 0 14px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #e9f7f2;
    color: #006b49;
    font-weight: 700;
    font-size: 13px;
  }

  .account-register-prompt {
    text-align: center;
    margin-top: 16px;
    color: var(--muted);
    font-size: 13.5px;
  }

  .account-register-prompt a {
    color: var(--green);
    font-weight: 800;
    margin-right: 4px;
  }

  .demo-note {
    margin-top: 16px;
    border: 1px dashed #b8d3c9;
    border-radius: 11px;
    background: #edf6f2;
    color: #41615a;
    font-size: 12.5px;
  }

  .demo-note summary {
    padding: 10px 14px;
    color: var(--green);
    font-weight: 800;
    cursor: pointer;
  }

  .demo-note > p, .demo-accounts {
    margin: 0;
    padding: 0 14px 10px;
  }

  .demo-accounts {
    display: grid;
    gap: 5px;
  }

  .demo-accounts span {
    direction: ltr;
    text-align: right;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 12px;
  }

  /* Story section placed underneath as secondary brand trust footer on mobile */
  .login-story {
    order: 2;
    direction: rtl;
    padding: 24px 20px 32px;
    background: #eef4f1;
    border-top: 1px solid var(--line);
    text-align: center;
  }

  .story-brand {
    display: none;
  }

  .story-copy {
    margin: 0 0 16px;
  }

  .story-copy > span {
    color: var(--green);
    font-weight: 800;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 99, 63, 0.08);
  }

  .story-copy h1 {
    font-size: 21px;
    margin: 6px 0 4px;
    font-weight: 900;
  }

  .story-copy h1 em {
    color: var(--gold);
    font-style: normal;
  }

  .story-copy > i {
    display: block;
    width: 38px;
    height: 3px;
    background: var(--gold);
    border-radius: 9px;
    margin: 6px auto 8px;
  }

  .story-copy p {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto;
  }

  .wrestling-visual {
    position: relative;
    width: 100%;
    max-width: 420px;
    height: 160px;
    margin: 0 auto 16px;
    border-radius: 16px;
    overflow: hidden;
  }

  .wrestling-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
  }

  .privacy-badge {
    position: absolute;
    bottom: 10px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(9, 52, 41, 0.9);
    color: #fff;
    font-size: 11px;
  }

  .privacy-badge > span {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 6px;
    color: var(--gold);
    font-size: 11px;
  }

  .privacy-badge b {
    font-size: 11px;
  }

  .privacy-badge small {
    display: none;
  }

  .story-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
  }

  .story-benefits article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 6px;
  }

  .story-benefits span {
    font-size: 16px;
    color: var(--green);
  }

  .story-benefits b {
    display: block;
    font-size: 11px;
    margin: 4px 0 1px;
  }

  .story-benefits small {
    display: block;
    font-size: 9.5px;
    color: var(--muted);
  }
}
