/* ================================================================
   BERBERIM REGISTER – Modern, Responsive Design
   Mobile-First (320px → 2560px)
   ================================================================ */

:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --primary-light: #a29bfe;
  --success: #16a34a;
  --error: #b32636;
  --warning: #b45309;
  --info: #0369a1;
  --text-dark: #1a1a2e;
  --text-light: #556478;
  --text-muted: #999;
  --border-light: #e8ecf2;
  --bg-light: #f8fafb;
  --bg-lighter: #fafbff;
  --shadow-sm: 0 2px 8px rgba(16, 44, 69, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 44, 69, 0.12);
  --shadow-lg: 0 16px 40px rgba(16, 44, 69, 0.12);
}

/* ======================== RESET ======================== */
.breg-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 16px 16px;
  margin-top: -14px;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--bg-lighter) 0%, #ffffff 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.breg-wrap *,
.breg-wrap *::before,
.breg-wrap *::after {
  box-sizing: border-box;
}

/* ======================== CARD ======================== */
.breg-card {
  width: 100%;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  padding: 28px 20px 24px;
  animation: slideIn 0.4s ease;
  max-width: 520px;
  min-width: 0;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======================== HEADER ======================== */
.breg-header {
  text-align: center;
  margin-bottom: 28px;
}

.breg-logo {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
  display: block;
}

.breg-header h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 5vw, 28px);
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.breg-subtitle {
  margin: 0;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.5;
}

/* ======================== FORMS ======================== */
.breg-form {
  margin: 0;
}

.breg-field {
  margin-bottom: 16px;
  min-width: 0;
}

.breg-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.breg-req {
  color: var(--error);
  margin-left: 2px;
}

.breg-field input[type="text"],
.breg-field input[type="email"],
.breg-field input[type="tel"],
.breg-field input[type="password"] {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-dark);
  background: #ffffff;
  transition: all 0.25s;
  outline: none;
}

.breg-field input::placeholder {
  color: #b8c1cf;
}

.breg-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
  background: linear-gradient(135deg, #fafbff 0%, #f5f7fb 100%);
}

/* Password wrapper */
.breg-pass-wrap {
  position: relative;
}

.breg-pass-wrap input {
  padding-right: 44px;
}

.breg-toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.breg-toggle-pass:hover {
  opacity: 1;
}

/* ======================== BUTTONS ======================== */
.breg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.25s ease;
  text-decoration: none;
}

.breg-btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.3);
}

.breg-btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #8c84f0 100%);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
  transform: translateY(-2px);
}

.breg-btn-primary:active {
  transform: translateY(0);
}

.breg-btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.breg-btn-outline:hover {
  background: rgba(108, 92, 231, 0.08);
  color: var(--primary-dark);
}

.breg-btn-full {
  width: 100%;
}

.breg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ======================== NOTICE SYSTEM ======================== */
.breg-notice {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.breg-notice-error {
  background: linear-gradient(135deg, #fff5f7 0%, #ffe8ec 100%);
  border-color: #f5d5de;
}

.breg-notice-error .breg-notice-item {
  color: var(--error);
}

.breg-notice-success {
  background: linear-gradient(135deg, #f0fdf4 0%, #dbeafe 100%);
  border-color: #bbf7d0;
}

.breg-notice-success .breg-notice-item {
  color: var(--success);
}

.breg-notice-info {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #bae6fd;
}

.breg-notice-info .breg-notice-item {
  color: var(--info);
}

.breg-notice-warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef08a 100%);
  border-color: #fcd34d;
}

.breg-notice-warning .breg-notice-item {
  color: var(--warning);
}

.breg-notice-item {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* ======================== CHECKBOX ======================== */
.breg-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
  margin-bottom: 18px;
  font-weight: 500;
}

.breg-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  cursor: pointer;
  accent-color: var(--primary);
  transition: all 0.2s;
}

.breg-checkbox-label input[type="checkbox"]:hover {
  border-color: var(--primary);
}

.breg-checkbox-label input[type="checkbox"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

/* Register legal consent note */
.breg-legal-consent {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid #d9e2ee;
  border-radius: 10px;
  background: #f7f9fc;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.6;
  font-weight: 500;
}

.breg-legal-consent a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

.breg-legal-consent a:hover {
  text-decoration: underline;
}

/* ======================== LOGIN FOOTER ======================== */
.breg-login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 13px;
  flex-wrap: wrap;
}

.breg-footer-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breg-footer-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.breg-footer-divider {
  color: var(--border-light);
  font-weight: 300;
}

/* Login form alignment */
.breg-login-form {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.breg-login-form .breg-field {
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.breg-login-form .breg-pass-wrap {
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
}

.breg-login-form .breg-toggle-pass {
  all: unset;
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  left: auto !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  cursor: pointer;
  z-index: 6;
  color: #657287;
}

.breg-login-form .breg-toggle-pass:hover {
  color: #3f4b61;
}

.breg-login-form .breg-field input[type="text"],
.breg-login-form .breg-field input[type="email"],
.breg-login-form .breg-field input[type="password"] {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.breg-login-form .breg-pass-wrap > input[type="password"] {
  padding-right: 46px !important;
  margin: 0 !important;
  width: 100% !important;
  flex: 1 1 auto;
}

.breg-login-form .breg-checkbox-label {
  width: 100%;
  max-width: 360px;
  justify-content: flex-start;
  margin: 0 auto 10px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}

.breg-login-form .breg-checkbox-label input[type="checkbox"] {
  margin: 0 !important;
  position: static;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  align-self: center;
}

.breg-login-form .breg-checkbox-text {
  display: inline-block;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.breg-login-form .breg-field:last-of-type {
  margin-bottom: 4px;
}

.breg-login-form .breg-btn-full {
  width: 100% !important;
  max-width: 360px;
  margin: 0 auto !important;
  display: flex !important;
  justify-content: center !important;
  text-align: center;
}

.breg-lost-password-form {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.breg-lost-password-form .breg-field {
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.breg-lost-password-form .breg-field input[type="text"] {
  width: 100% !important;
  max-width: 100% !important;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.breg-lost-password-form .breg-btn-full {
  width: 100% !important;
  max-width: 360px;
  margin: 0 auto !important;
  display: flex !important;
  justify-content: center !important;
}

/* ======================== STATE CARDS ======================== */
.breg-state-card {
  text-align: center;
  border: 1px solid var(--border-light);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-lighter) 100%);
  box-shadow: var(--shadow-lg);
  border-radius: 18px;
  padding: 32px 20px;
  max-width: 520px;
  width: 100%;
}

.breg-state-card-success {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf8 100%);
  border-color: #c5f0d5;
}

.breg-state-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 16px;
  display: block;
}

.breg-state-title {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.3;
  color: var(--text-dark);
  font-weight: 700;
}

.breg-state-text {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-light);
}

.breg-state-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ======================== REGISTRATION STEPS ======================== */
.breg-step {
  display: none;
}

.breg-step-active {
  display: block;
  animation: slideIn 0.3s ease;
}

.breg-step-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 20px;
  text-align: center;
}

.breg-back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 14px;
  transition: color 0.2s;
}

.breg-back-btn:hover {
  color: var(--primary-dark);
}

/* ======================== ROLE CARDS ======================== */
.breg-roles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.breg-role-card {
  position: relative;
  cursor: pointer;
  display: block;
}

.breg-role-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.breg-role-inner {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 14px;
  padding: 16px 18px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  transition: all 0.25s ease;
  background: #ffffff;
}

.breg-role-card:hover .breg-role-inner {
  border-color: #c5c5e0;
  background: linear-gradient(135deg, #fafbff 0%, #f5f7fb 100%);
}

.breg-role-selected .breg-role-inner {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f8f7ff 0%, #eee9ff 100%);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.15);
}

.breg-role-icon {
  grid-row: 1 / 3;
  grid-column: 1;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8ebff 100%);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(108, 92, 231, 0.1);
}

.breg-role-label {
  grid-row: 1;
  grid-column: 2;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.breg-role-sublabel {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  padding: 2px 8px;
  border-radius: 20px;
}

.breg-role-desc {
  grid-row: 2;
  grid-column: 2;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.breg-role-check {
  grid-row: 1 / 3;
  grid-column: 3;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
  transition: all 0.25s ease;
  background: #ffffff;
}

.breg-role-selected .breg-role-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

/* Two column layout for role selection */
.breg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

/* ======================== PASSWORD STRENGTH ======================== */
.breg-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.breg-strength-bar {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.breg-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition:
    width 0.3s,
    background 0.3s;
}

.breg-strength-text {
  font-size: 11px;
  font-weight: 700;
  min-width: 70px;
  text-align: right;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ======================== RESPONSIVE: 320px ======================== */
@media (max-width: 380px) {
  .breg-wrap {
    padding: 0 12px 12px;
    margin-top: -8px;
  }

  .breg-card {
    padding: 20px 16px 18px;
    border-radius: 16px;
  }

  .breg-logo {
    font-size: 40px;
    margin-bottom: 10px;
  }

  .breg-header h2 {
    font-size: 22px;
    margin-bottom: 6px;
  }

  .breg-subtitle {
    font-size: 12px;
  }

  .breg-field {
    margin-bottom: 14px;
  }

  .breg-field input[type="text"],
  .breg-field input[type="email"],
  .breg-field input[type="tel"],
  .breg-field input[type="password"] {
    padding: 10px 12px;
    font-size: 13px;
  }

  .breg-btn {
    padding: 11px 16px;
    font-size: 13px;
  }

  .breg-row {
    grid-template-columns: 1fr;
  }

  .breg-role-inner {
    grid-template-columns: 42px 1fr auto;
    padding: 12px 14px;
    gap: 0 10px;
  }

  .breg-role-icon {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

  .breg-role-label {
    font-size: 14px;
  }

  .breg-role-desc {
    font-size: 11px;
  }

  .breg-notice {
    padding: 12px 14px;
    margin-bottom: 16px;
  }

  .breg-notice-item {
    font-size: 12px;
  }

  .breg-state-card {
    padding: 24px 16px;
  }

  .breg-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
  }

  .breg-state-title {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .breg-state-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .breg-login-footer {
    gap: 6px;
    font-size: 12px;
    margin-top: 18px;
    padding-top: 16px;
  }
}

/* ======================== RESPONSIVE: 590px ======================== */
@media (max-width: 590px) {
  .breg-card {
    padding: 24px 18px 20px;
    border-radius: 16px;
  }

  .breg-header {
    margin-bottom: 24px;
  }

  .breg-logo {
    font-size: 44px;
  }

  .breg-header h2 {
    font-size: 24px;
  }

  .breg-subtitle {
    font-size: 13px;
  }

  .breg-field label {
    font-size: 11px;
  }

  .breg-notice {
    padding: 13px 15px;
    margin-bottom: 18px;
  }

  .breg-notice-item {
    font-size: 12px;
  }

  .breg-checkbox-label {
    font-size: 12px;
    margin-bottom: 16px;
  }

  .breg-state-card {
    padding: 28px 18px;
  }

  .breg-state-title {
    font-size: 22px;
  }
}

/* Stack the form rows earlier so WebView-sized viewports do not overflow horizontally */
@media (max-width: 1024px) {
  .breg-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .breg-login-form .breg-field,
  .breg-login-form .breg-pass-wrap,
  .breg-lost-password-form .breg-field,
  .breg-state-actions {
    max-width: 100%;
  }
}

/* ======================== RESPONSIVE: 920px ======================== */
@media (min-width: 920px) {
  .breg-wrap {
    padding: 0 24px 20px;
    margin-top: -20px;
    min-height: 100vh;
    align-items: flex-start;
  }

  .breg-card {
    padding: 40px 36px 32px;
    border-radius: 20px;
    max-width: 560px;
  }

  .breg-logo {
    font-size: 52px;
    margin-bottom: 14px;
  }

  .breg-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .breg-subtitle {
    font-size: 14px;
  }

  .breg-header {
    margin-bottom: 30px;
  }

  .breg-field {
    margin-bottom: 18px;
  }

  .breg-field label {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .breg-notice {
    padding: 16px 18px;
    margin-bottom: 24px;
  }

  .breg-state-card {
    padding: 40px 32px;
  }

  .breg-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
  }

  .breg-state-title {
    font-size: 28px;
    margin-bottom: 14px;
  }

  .breg-state-text {
    font-size: 15px;
    margin-bottom: 28px;
  }

  .breg-state-actions {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .breg-login-footer {
    font-size: 14px;
  }
}

/* ======================== DESKTOP: 1200px ======================== */
@media (min-width: 1200px) {
  .breg-wrap {
    padding: 0 32px 24px;
    margin-top: -24px;
  }

  .breg-card {
    padding: 44px 40px 36px;
  }

  .breg-header h2 {
    font-size: 30px;
  }

  .breg-logo {
    font-size: 56px;
  }
}

/* ======================== ANIMATIONS ======================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======================== UTILITIES ======================== */
.breg-btn-full-mobile {
  width: 100%;
}

.breg-text-center {
  text-align: center;
}

.breg-login-form-card {
  max-width: 520px;
}
