/* ═══════════════════════════════════════
   KORISHA — auth.css
   Login modal + Registration page
   ═══════════════════════════════════════ */

/* ─── Login Modal Overlay ─── */
.auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.auth-overlay.show {
  display: flex;
}

.auth-modal {
  background: var(--k-white);
  border-radius: var(--k-radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: var(--k-shadow-lg);
  animation: authSlideIn 0.25s ease;
}
@keyframes authSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-modal h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--k-dark);
  margin: 0 0 4px;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--k-text-light);
  margin: 0 0 20px;
}
.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--k-text-light);
  cursor: pointer;
  padding: 4px;
  transition: color var(--k-transition);
}
.auth-close:hover { color: var(--k-dark); }


/* ─── Shared Form Styles ─── */
.auth-field {
  margin-bottom: 16px;
}
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--k-dark);
  margin-bottom: 6px;
}
.auth-field label .req {
  color: var(--k-primary);
}
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="tel"],
.auth-field input[type="password"],
.auth-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  font-size: 14px;
  font-family: var(--font-main);
  background: var(--k-bg);
  outline: none;
  transition: border-color var(--k-transition);
}
.auth-field input:focus,
.auth-select:focus {
  border-color: var(--k-primary);
}

/* Password wrap */
.password-wrap {
  position: relative;
}
.password-wrap input {
  padding-right: 44px;
}
.pass-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: var(--k-text-light);
  cursor: pointer;
  padding: 6px;
  transition: color var(--k-transition);
}
.pass-toggle:hover { color: var(--k-dark); }

/* Password match indicator */
.pass-match {
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}
.pass-match.match { color: var(--k-accent); }
.pass-match.mismatch { color: var(--k-primary); }


/* ─── Phone Input Row ─── */
.phone-input-row {
  display: flex;
  gap: 8px;
}
.country-select {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 2px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  background: var(--k-white);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  min-width: 110px;
  transition: border-color var(--k-transition);
  user-select: none;
}
.country-select:hover { border-color: var(--k-primary); }
.country-select .bi-chevron-down { font-size: 10px; color: var(--k-text-light); }

.country-flag img {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
}
.country-prefix {
  font-size: 14px;
  font-weight: 500;
  color: var(--k-dark);
  white-space: nowrap;
}

.phone-input-row input[type="tel"] {
  border-radius: var(--k-radius-sm);
  flex: 1;
}

/* Country dropdown */
.country-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: -2px;
  min-width: 260px;
  background: var(--k-white);
  border: 2px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  box-shadow: var(--k-shadow);
  /* Below header (z-index 100) and nav (99), but above page content */
  z-index: 90;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}
.country-dropdown.show { display: block; }

.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--k-transition);
}
.country-option:hover { background: var(--k-bg); }
.co-flag img {
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
}
.co-name { flex: 1; color: var(--k-text); }
.co-prefix { color: var(--k-text-light); font-weight: 500; }


/* ─── Submit Button ─── */
.auth-submit {
  width: 100%;
  padding: 12px;
  background: var(--k-primary);
  color: #fff;
  border: none;
  border-radius: var(--k-radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: background var(--k-transition);
  margin-top: 4px;
}
.auth-submit:hover { background: var(--k-primary-dark); }
.auth-submit:disabled {
  background: var(--k-border);
  cursor: not-allowed;
}

/* Error message */
.auth-error {
  display: none;
  background: #FFF0F0;
  border: 1px solid #FFCCCC;
  color: #CC3333;
  border-radius: var(--k-radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.auth-error.show { display: block; }

/* Footer link */
.auth-footer-link {
  text-align: center;
  font-size: 13px;
  color: var(--k-text-light);
  margin-top: 16px;
}
.auth-footer-link a {
  color: var(--k-primary);
  font-weight: 600;
}
.auth-footer-link a:hover {
  text-decoration: underline;
}


/* ─── Registration Page ─── */
.reg-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 0 40px;
}
.reg-page h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--k-dark);
  margin: 0 0 4px;
}
.reg-subtitle {
  font-size: 14px;
  color: var(--k-text-light);
  margin: 0 0 24px;
}

/* Type switch */
.reg-type-switch {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 2px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  overflow: hidden;
}
.type-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--k-bg);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-main);
  color: var(--k-text-light);
  cursor: pointer;
  transition: all var(--k-transition);
}
.type-btn.active {
  background: var(--k-primary);
  color: #fff;
}

/* Biz fields wrapper */
.biz-fields {
  border-top: 1px solid var(--k-border);
  padding-top: 16px;
  margin-top: 4px;
  margin-bottom: 4px;
}


/* ─── Responsive ─── */

/* ≤ 992px — Tablet */
@media (max-width: 992px) {
}

/* ≤ 768px — Small tablet / large phone */
@media (max-width: 768px) {
  .auth-modal {
    max-width: 100%;
    margin: 12px;
    padding: 28px 20px;
    border-radius: var(--k-radius-sm);
  }
  .auth-modal h3 { font-size: 20px; }

  .reg-page {
    max-width: 100%;
    padding: 16px 0 32px;
  }
  .reg-page h2 { font-size: 22px; }

  /* Keep phone row horizontal, just make country select compact */
  .country-select {
    min-width: 90px;
    padding: 0 10px;
  }

  .country-dropdown {
    left: 0;
    min-width: auto;
    width: 260px;
  }

  .reg-type-switch {
    margin-bottom: 16px;
  }
  .type-btn {
    padding: 8px;
    font-size: 13px;
  }
}

/* ≤ 576px — Phone */
@media (max-width: 576px) {
  .auth-overlay {
    align-items: center;
    padding: 16px;
  }
  .auth-modal {
    margin: 0;
    border-radius: var(--k-radius);
    padding: 24px 16px;
    max-height: 90vh;
    overflow-y: auto;
  }
  .auth-modal h3 { font-size: 18px; }
  .auth-subtitle { font-size: 13px; }

  .auth-field label { font-size: 12px; }
  .auth-field input { font-size: 13px; padding: 9px 12px; }

  .auth-submit {
    font-size: 14px;
    padding: 11px;
  }

  .reg-page { padding: 8px 0 24px; }
  .reg-page h2 { font-size: 20px; }

  .country-dropdown {
    max-height: 180px;
  }
  .country-option {
    padding: 7px 12px;
    font-size: 12px;
  }
  .country-select {
    min-width: 80px;
    padding: 0 8px;
    gap: 4px;
  }
  .country-prefix { font-size: 13px; }

  .biz-fields {
    padding-top: 12px;
  }
}


/* ═══════════════════════════════════════
   LOCALE SELECTOR (top bar)
   ═══════════════════════════════════════ */

.locale-selector {
  position: relative;
  display: inline-block;
}

.locale-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  transition: color var(--k-transition);
  font-size: 12px;
}
.locale-toggle:hover { color: #fff; }

.locale-toggle .locale-flag {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
}
.locale-toggle .bi-chevron-down {
  font-size: 9px;
  margin-left: 2px;
}

.locale-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--k-white);
  border: 1px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  box-shadow: var(--k-shadow);
  z-index: 120;
  overflow: hidden;
}
.locale-dropdown.show { display: block; }

.locale-section {
  padding: 6px 0;
}

.locale-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--k-text-light);
  padding: 6px 14px 4px;
}

.locale-divider {
  height: 1px;
  background: var(--k-border);
  margin: 0;
}

.locale-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--k-text);
  cursor: pointer;
  transition: background var(--k-transition);
}
.locale-option:hover { background: var(--k-bg); }
.locale-option.active {
  color: var(--k-primary);
  font-weight: 600;
}
.locale-option .locale-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
}

.loc-cur-code {
  font-weight: 600;
  min-width: 32px;
}
.loc-cur-symbol {
  color: var(--k-text-light);
  min-width: 16px;
}
.loc-cur-name {
  color: var(--k-text-light);
  font-size: 12px;
}

/* ─── Locale responsive ─── */
@media (max-width: 768px) {
  /* Top bar hidden at this size, locale handled via mobile menu or hidden */
  .locale-selector { display: none; }
}

/* ─── Standalone Login Page ─── */
.login-page{display:flex;justify-content:center;padding:40px 0 60px;}
.login-page-card{background:var(--k-white);border:1px solid var(--k-border);border-radius:var(--k-radius);padding:32px;max-width:400px;width:100%;}
.login-page-card h2{font-size:22px;font-weight:700;color:var(--k-dark);margin:0 0 6px;}
.login-page-sub{font-size:13px;color:var(--k-text-light);margin:0 0 20px;line-height:1.5;}
.login-page-footer{text-align:center;margin-top:16px;font-size:13px;color:var(--k-text-light);}
.login-page-footer a{color:var(--k-primary);font-weight:500;margin-left:4px;}
.login-page-footer a:hover{text-decoration:underline;}
