/* =========================================================
   CPI Helper Pro — Registration Page
   File: public/css/styles.css
   Responsive desktop, laptop, tablet and mobile design
   ========================================================= */

/* ---------- Global styles ---------- */

:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  --primary: #137e70;
  --primary-hover: #0e6b60;
  --accent: #39c6a1;
  --text-primary: #172033;
  --text-secondary: #667085;
  --border: #d6dce6;
  --panel-background: #f5f7fb;
  --input-background: #ffffff;
  --focus-ring: rgb(22 139 121 / 13%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------- Main page layout ---------- */

.page-container {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Left branding panel ---------- */

.brand-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: clamp(24px, 4vh, 48px) clamp(24px, 4vw, 64px);
  color: #ffffff;
  background: linear-gradient(145deg, #102b53 0%, #145b72 100%);
}

.brand-content {
  width: 100%;
  max-width: 460px;
  margin: auto;
}

.brand-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: var(--accent);
  color: #092b40;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -1px;
}

.eyebrow {
  margin: 25px 0 10px;
  color: #71e0c2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.7px;
  line-height: 1.5;
}

.brand-panel h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(32px, 3.5vw, 48px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -1.5px;
}

.brand-description {
  max-width: 420px;
  margin: 18px 0 0;
  color: #d8e6f3;
  font-size: 14px;
  line-height: 1.75;
}

.feature-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
  color: #effaf8;
  font-size: 13px;
  line-height: 1.5;
}

.free-label {
  display: inline-block;
  margin-top: 28px;
  padding: 9px 13px;
  border: 1px solid #4f988f;
  border-radius: 999px;
  color: #bdf7e8;
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- Right registration panel ---------- */

.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 24px clamp(22px, 3.5vw, 54px);
  background: var(--panel-background);
}

.form-wrapper {
  width: 100%;
  max-width: 600px;
  min-width: 0;
  margin: auto;
}

/* Mobile-only branding */

.mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  color: #15243b;
  font-size: 18px;
  font-weight: 800;
}

.mobile-brand .brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 15px;
}

/* ---------- Form heading ---------- */

.form-eyebrow {
  margin: 0 0 8px;
  color: #158a76;
  font-size: 10px;
}

.form-wrapper h2 {
  margin: 0;
  color: #15243b;
  font-size: clamp(27px, 2.4vw, 33px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.8px;
}

.form-description {
  margin: 10px 0 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

/* ---------- Form grid ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 15px;
}

.form-field {
  min-width: 0;
}

.full-width {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  margin-bottom: 5px;
  color: #26364c;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.optional {
  color: #8792a4;
  font-weight: 400;
}

/* ---------- Input fields ---------- */

.form-field input,
.form-field select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--input-background);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.form-field input::placeholder {
  color: #a0a8b6;
  opacity: 1;
}

.form-field input:hover,
.form-field select:hover {
  border-color: #b5c2d2;
}

.form-field input:focus,
.form-field select:focus {
  border-color: #168b79;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-field input:disabled,
.form-field select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.form-field small {
  display: block;
  margin-top: 5px;
  color: #798496;
  font-size: 10px;
  line-height: 1.5;
}

/* ---------- Phone country code + number ---------- */

.phone-input-group {
  display: grid;
  grid-template-columns: minmax(125px, 0.42fr) minmax(0, 1fr);
  gap: 9px;
  width: 100%;
}

.phone-input-group input,
.phone-input-group select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 10px;
}

.phone-input-group select {
  cursor: pointer;
  text-overflow: ellipsis;
}

/* ---------- Submit button ---------- */

.primary-button {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  padding: 11px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.4;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
}

.primary-button:hover {
  background: var(--primary-hover);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* ---------- Sign-in footer ---------- */

.form-footer {
  margin: 14px 0 0;
  color: var(--text-secondary);
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
}

/* ---------- Success and status messages ---------- */

.message {
  margin-top: 15px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.message.error {
  border-color: #f2b8b8;
  background: #fff2f2;
  color: #a12626;
}

.message.info {
  border-color: #a8ded2;
  background: #eefaf6;
  color: #155c50;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: #d8f7ea;
  color: var(--primary);
  font-size: 27px;
  font-weight: 800;
}

#successPanel p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

/* ---------- Short laptop screens ---------- */

@media (min-width: 901px) and (max-height: 850px) {
  .brand-panel {
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .eyebrow {
    margin-top: 18px;
    margin-bottom: 8px;
  }

  .brand-panel h1 {
    font-size: clamp(30px, 3.1vw, 40px);
  }

  .brand-description {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.6;
  }

  .feature-list {
    gap: 8px;
    margin-top: 18px;
    font-size: 12px;
  }

  .free-label {
    margin-top: 18px;
    padding: 7px 11px;
  }

  .form-panel {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .form-eyebrow {
    margin-top: 0;
    margin-bottom: 6px;
  }

  .form-wrapper h2 {
    font-size: 28px;
  }

  .form-description {
    margin-top: 7px;
    margin-bottom: 12px;
    font-size: 12px;
  }

  .form-grid {
    gap: 8px 12px;
  }

  .form-field label {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .form-field input,
  .form-field select,
  .phone-input-group input,
  .phone-input-group select {
    min-height: 35px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .form-field small {
    margin-top: 3px;
    font-size: 9px;
  }

  .primary-button {
    min-height: 38px;
    margin-top: 11px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .form-footer {
    margin-top: 8px;
  }

  .message {
    margin-top: 10px;
    padding: 9px 11px;
  }
}

/* ---------- Tablet and smaller screens ---------- */

@media (max-width: 900px) {
  .page-container {
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
  }

  .brand-panel {
    display: none;
  }

  .form-panel {
    align-items: flex-start;
    padding: 28px 22px;
  }

  .form-wrapper {
    max-width: 600px;
  }

  .mobile-brand {
    display: flex;
  }

  .form-eyebrow {
    margin-top: 0;
  }

  .form-field input,
  .form-field select,
  .phone-input-group input,
  .phone-input-group select {
    min-height: 42px;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
  .form-panel {
    padding: 20px 16px 28px;
  }

  .mobile-brand {
    margin-bottom: 22px;
  }

  .form-wrapper h2 {
    font-size: 27px;
  }

  .form-description {
    margin-bottom: 18px;
    font-size: 12px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  .form-field,
  .full-width {
    grid-column: 1 / -1;
  }

  .form-field label {
    font-size: 12px;
  }

  .form-field input,
  .form-field select {
    min-height: 43px;
    font-size: 13px;
  }

  .phone-input-group {
    grid-template-columns: minmax(108px, 0.42fr) minmax(0, 1fr);
    gap: 7px;
  }

  .phone-input-group input,
  .phone-input-group select {
    min-height: 43px;
    padding: 8px;
    font-size: 12px;
  }

  .form-field small {
    font-size: 10px;
  }

  .primary-button {
    min-height: 46px;
    margin-top: 16px;
  }

  .form-footer {
    margin-top: 13px;
  }
}

/* ---------- Very narrow mobile screens ---------- */

@media (max-width: 350px) {
  .form-panel {
    padding-right: 12px;
    padding-left: 12px;
  }

  .form-wrapper h2 {
    font-size: 24px;
  }

  .phone-input-group {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 6px;
  }

  .phone-input-group input,
  .phone-input-group select {
    padding-right: 5px;
    padding-left: 5px;
    font-size: 11px;
  }
}

/* ---------- Accessibility: reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
/* Final spacing adjustment for the registration page */

@media (min-width: 901px) {
  .form-panel {
    align-items: center;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .form-wrapper {
    max-width: 600px;
  }

  .form-eyebrow {
    margin-top: 0;
  }

  .form-wrapper h2 {
    margin-top: 0;
  }
}

/* Allow the entire form to remain accessible on short screens */
@media (max-height: 700px) {
  .page-container {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .form-panel {
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 24px;
  }

  .brand-panel {
    padding-top: 20px;
    padding-bottom: 20px;
  }
}
