/* ==========================================================================
   TezzCorp Central Identity & Authentication - Google Material Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --google-blue: #0b57d0;
  --google-blue-hover: #0842a0;
  --google-blue-surface: #e8f0fe;
  --google-canvas: #f0f4f9;
  --google-surface: #ffffff;
  --google-border: #747775;
  --google-border-subtle: #dadce0;
  --google-border-light: #e0e2ec;
  --google-text-primary: #1f1f1f;
  --google-text-secondary: #444746;
  --google-error: #b3261e;
  --google-error-bg: #fce8e6;
  --google-success: #137333;
  --google-success-bg: #e6f4ea;
  --google-warning: #b06000;
  --google-warning-bg: #fef7e0;
  --radius-card: 28px;
  --radius-input: 4px;
  --radius-pill: 100px;
  --font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --shadow-card: 0 1px 3px 0 rgba(60, 64, 67, 0.12), 0 4px 8px 3px rgba(60, 64, 67, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--google-canvas);
  color: var(--google-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Container & Google Card ────────────────────────────────────────────────── */

.auth-wrapper {
  width: 100%;
  max-width: 448px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-card {
  width: 100%;
  background: var(--google-surface);
  border-radius: var(--radius-card);
  padding: 40px;
  border: 1px solid var(--google-border-light);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease;
}

/* ── Google Brand & Header ─────────────────────────────────────────────────── */

.google-header {
  margin-bottom: 28px;
}

.google-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.google-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 0;
  flex-shrink: 0;
}

.google-brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
}

.google-title {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--google-text-primary);
  margin-bottom: 0;
  letter-spacing: -0.2px;
}

.google-subtitle {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--google-text-secondary);
  margin-top: 4px;
}

/* ── Google Outlined Material Input Field ──────────────────────────────────── */

.g-field {
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}

.g-input {
  width: 100%;
  height: 56px;
  padding: 16px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--google-text-primary);
  background: transparent;
  border: 1px solid var(--google-border);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.g-input:focus {
  border: 2px solid var(--google-blue);
  padding: 15px 13px;
}

.g-label {
  position: absolute;
  left: 12px;
  top: 18px;
  font-size: 16px;
  color: var(--google-text-secondary);
  pointer-events: none;
  background: var(--google-surface);
  padding: 0 4px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left top;
}

.g-input:focus ~ .g-label,
.g-input:not(:placeholder-shown) ~ .g-label,
.g-input.has-value ~ .g-label {
  top: -8px;
  left: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--google-blue);
}

.g-input.is-invalid {
  border: 2px solid var(--google-error);
  padding: 15px 13px;
}

.g-input.is-invalid ~ .g-label {
  color: var(--google-error);
}

.g-input.is-valid {
  border-color: var(--google-success);
}

.field-status {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  display: none;
  z-index: 2;
}

.field-error {
  font-size: 12px;
  color: var(--google-error);
  margin-top: -14px;
  margin-bottom: 16px;
  padding-left: 12px;
  display: none;
  line-height: 1.4;
}

/* ── Dynamic Field Leading Icon (Login Mail vs Flag) ───────────────────────── */

.g-field-leading-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.g-input.g-input-with-leading {
  padding-left: 48px;
}

.g-input.g-input-with-leading:focus {
  padding-left: 47px;
}

.g-input.g-input-with-leading ~ .g-label {
  left: 46px;
}

.g-input.g-input-with-leading:focus ~ .g-label,
.g-input.g-input-with-leading:not(:placeholder-shown) ~ .g-label,
.g-input.g-input-with-leading.has-value ~ .g-label {
  left: 10px;
  top: -8px;
  font-size: 12px;
}

/* ── Country Flag & Dedicated Phone Input Component ────────────────────────── */

.g-phone-input-wrap {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 20px;
  width: 100%;
}

.g-phone-input-wrap .g-field {
  margin-bottom: 0;
  flex: 1;
}

.g-country-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  background: var(--google-surface);
  border: 1px solid var(--google-border);
  border-radius: var(--radius-input);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  color: var(--google-text-primary);
  flex-shrink: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.g-country-picker-btn:hover {
  background-color: var(--google-canvas);
  border-color: var(--google-text-primary);
}

.g-country-picker-btn:focus,
.g-country-picker-btn.is-active {
  outline: none;
  border-color: var(--google-blue);
  box-shadow: 0 0 0 1px var(--google-blue);
}

.country-flag-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
}

.country-flag {
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.4);
  vertical-align: middle;
}

.country-dial-code {
  font-weight: 500;
  font-size: 15px;
  color: var(--google-text-primary);
}

.g-chevron {
  color: var(--google-text-secondary);
  transition: transform 0.2s ease;
}

.g-country-picker-btn.is-active .g-chevron {
  transform: rotate(180deg);
}

.g-country-picker-btn.is-neutral-mode,
.g-country-picker-btn.is-email-mode {
  cursor: pointer;
  background: transparent;
  border-color: var(--google-border);
  padding: 0 14px;
}

.g-country-picker-btn.is-neutral-mode .country-dial-code,
.g-country-picker-btn.is-neutral-mode .g-chevron,
.g-country-picker-btn.is-email-mode .country-dial-code,
.g-country-picker-btn.is-email-mode .g-chevron {
  display: none;
}

/* ── Global Country Picker Dropdown ────────────────────────────────────────── */

.g-country-dropdown {
  position: absolute;
  top: 60px;
  left: 0;
  width: 100%;
  max-width: 380px;
  max-height: 340px;
  background: var(--google-surface);
  border: 1px solid var(--google-border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

.g-country-dropdown.show {
  display: flex;
}

.g-country-search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid var(--google-border-light);
  background: var(--google-surface);
  position: sticky;
  top: 0;
  z-index: 2;
}

.g-country-search {
  width: 100%;
  height: 38px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--google-border-subtle);
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  color: var(--google-text-primary);
  background: var(--google-canvas);
}

.g-country-search:focus {
  border-color: var(--google-blue);
  background: var(--google-surface);
  box-shadow: 0 0 0 1px var(--google-blue);
}

.g-country-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 4px 0;
  margin: 0;
  max-height: 280px;
}

.g-country-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  gap: 12px;
  transition: background-color 0.1s ease;
}

.g-country-item:hover,
.g-country-item.is-selected {
  background-color: var(--google-blue-surface);
}

.g-country-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--google-text-primary);
}

.g-country-item-dial {
  font-weight: 500;
  color: var(--google-text-secondary);
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Inline Helper Links ───────────────────────────────────────────────────── */

.google-link-wrapper {
  margin-top: -8px;
  margin-bottom: 24px;
}

.google-link {
  color: var(--google-blue);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 4px;
  padding: 4px 0;
  display: inline-block;
}

.google-link:hover {
  text-decoration: underline;
}

/* ── Action Buttons & Row ──────────────────────────────────────────────────── */

.google-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  gap: 12px;
}

.google-action-row.single-action {
  justify-content: flex-end;
}

.google-text-btn {
  color: var(--google-blue);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  transition: background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.google-text-btn:hover {
  background-color: rgba(11, 87, 208, 0.08);
}

.google-btn-primary {
  background-color: var(--google-blue);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  min-width: 88px;
  height: 40px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  text-decoration: none;
}

.google-btn-primary:hover {
  background-color: var(--google-blue-hover);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
}

.google-btn-primary:disabled {
  background-color: #1f1f1f;
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

/* Backward compatibility aliases */
.btn {
  font-family: inherit;
}

/* ── Alert & Notification Banners (Google Material Style) ──────────────────── */

.alert {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  display: none;
  line-height: 1.45;
  border: 1px solid transparent;
}

.alert-danger {
  background-color: var(--google-error-bg);
  color: var(--google-error);
  border-color: #f5c2c7;
}

.alert-success {
  background-color: var(--google-success-bg);
  color: var(--google-success);
  border-color: #badbcc;
}

.alert-warning {
  background-color: var(--google-warning-bg);
  color: var(--google-warning);
  border-color: #ffecb5;
}

/* ── Password Strength Bar (Google Material 4-segment style) ──────────────── */

.strength-meter {
  height: 4px;
  background-color: var(--google-border-subtle);
  border-radius: 2px;
  margin-top: -12px;
  margin-bottom: 18px;
  overflow: hidden;
}

.strength-bar {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
}

.strength-bar.weak   { width: 33%; background-color: var(--google-error); }
.strength-bar.medium { width: 66%; background-color: #fbbc04; }
.strength-bar.strong { width: 100%; background-color: var(--google-success); }

/* ── Radio Channels (for OTP recovery channel selection) ───────────────────── */

.channel-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.channel-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
  border: 1px solid var(--google-border-subtle);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--google-text-primary);
  transition: all 0.2s ease;
  background: var(--google-surface);
}

.channel-option input[type="radio"] {
  display: none;
}

.channel-option:hover {
  background-color: #f8fafd;
  border-color: var(--google-blue);
}

.channel-option.selected {
  border: 2px solid var(--google-blue);
  background-color: var(--google-blue-surface);
  color: var(--google-blue);
  padding: 13px 11px;
}

/* ── 6-Box OTP Code Inputs ─────────────────────────────────────────────────── */

.otp-input-group {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 24px;
}

.otp-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 500;
  color: var(--google-text-primary);
  border: 1px solid var(--google-border);
  border-radius: 8px;
  outline: none;
  background: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.otp-box:focus {
  border: 2px solid var(--google-blue);
  box-shadow: 0 0 0 1px var(--google-blue);
}

/* ── Google Footer ─────────────────────────────────────────────────────────── */

.google-footer {
  width: 100%;
  max-width: 448px;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--google-text-secondary);
  padding: 0 12px;
}

.google-lang-wrap {
  position: relative;
}

.google-lang-select {
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--google-text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
}

.google-lang-select:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--google-text-primary);
}

.google-footer-links {
  display: flex;
  gap: 16px;
}

.google-footer-link {
  color: var(--google-text-secondary);
  text-decoration: none;
  padding: 6px 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.google-footer-link:hover {
  color: var(--google-text-primary);
  text-decoration: underline;
}

/* ── Toast Notifications ───────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #323232;
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 4px;
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14);
  font-size: 14px;
  animation: slideUp 0.3s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Full Responsiveness: Smartphone, Tablet & Desktop ─────────────────────── */

@media (max-width: 600px) {
  body {
    padding: 0;
    background-color: var(--google-surface);
  }

  .auth-wrapper {
    max-width: 100%;
    min-height: 100vh;
    justify-content: space-between;
  }

  .auth-card {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 32px 24px 24px 24px;
    flex: 1;
  }

  .google-title-row {
    gap: 10px;
  }

  .google-brand-logo {
    width: 32px;
    height: 32px;
  }

  .google-title {
    font-size: 20px;
  }

  .google-subtitle {
    font-size: 14px;
  }

  .otp-box {
    width: 44px;
    height: 52px;
    font-size: 20px;
  }

  .google-footer {
    padding: 16px 24px 24px 24px;
    margin-top: 0;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .google-footer-links {
    gap: 20px;
  }

  .legal-wrapper {
    max-width: 100%;
    min-height: 100vh;
  }

  .legal-card {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 24px 16px;
  }
}

@media (max-width: 360px) {
  .otp-box {
    width: 38px;
    height: 48px;
    font-size: 18px;
  }
}

/* ── Legal & Help Reading Views ────────────────────────────────────────────── */

.legal-wrapper {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.legal-card {
  width: 100%;
  background: var(--google-surface);
  border-radius: var(--radius-card);
  padding: 40px;
  border: 1px solid var(--google-border-light);
  box-shadow: var(--shadow-card);
}

.legal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--google-text-secondary);
}

.legal-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--google-canvas);
  border: 1px solid var(--google-border);
  font-size: 12px;
  font-weight: 500;
  color: var(--google-text-primary);
}

.legal-summary {
  background: var(--google-canvas);
  border-left: 4px solid var(--google-blue);
  padding: 14px 18px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 28px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--google-text-primary);
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--google-text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.1px;
}

.legal-paragraph {
  font-size: 14px;
  line-height: 1.65;
  color: var(--google-text-secondary);
  margin-bottom: 10px;
}

.legal-list {
  padding-left: 20px;
  margin: 10px 0 16px 0;
  color: var(--google-text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

.legal-list li {
  margin-bottom: 6px;
}

.legal-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--google-border-subtle);
  padding-bottom: 12px;
}

.legal-tab-link {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--google-text-secondary);
  text-decoration: none;
  border-radius: 16px;
  transition: all 0.15s ease;
}

.legal-tab-link:hover {
  background: var(--google-canvas);
  color: var(--google-text-primary);
}

.legal-tab-link.is-active {
  background: var(--google-blue);
  color: #ffffff;
  font-weight: 500;
}

.legal-tab-link.is-active:hover {
  background: var(--google-blue-hover);
  color: #ffffff;
}

.legal-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
  color: var(--google-text-secondary);
  font-size: 14px;
}
