/**
 * mod_authpro — Corporate/Professional Theme
 * Joomla 5.x Module
 */

/* ─── Custom Properties ─── */
.mod-authpro {
  --ap-primary:       #1a3a5c;
  --ap-primary-dark:  #112843;
  --ap-accent:        #c8913a;
  --ap-accent-light:  #e8b96a;
  --ap-bg:            #ffffff;
  --ap-surface:       #f6f8fb;
  --ap-border:        #dde3ec;
  --ap-border-focus:  #1a3a5c;
  --ap-text:          #1c2a3a;
  --ap-text-muted:    #5a6a7e;
  --ap-error:         #c0392b;
  --ap-success:       #1d7a4e;
  --ap-radius:        6px;
  --ap-radius-sm:     4px;
  --ap-shadow:        0 2px 16px rgba(26,58,92,0.10);
  --ap-transition:    0.18s ease;
  --ap-font-head:     'Georgia', 'Times New Roman', serif;
  --ap-font-body:     'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

  font-family: var(--ap-font-body);
  color: var(--ap-text);
  background: var(--ap-bg);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  box-shadow: var(--ap-shadow);
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  animation: ap-fadein 0.32s ease both;
}

@keyframes ap-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Tabs ─── */
.authpro-tabs {
  display: flex;
  background: var(--ap-primary);
  border-bottom: 3px solid var(--ap-accent);
}

.authpro-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.65);
  font-family: var(--ap-font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--ap-transition), color var(--ap-transition);
  position: relative;
}

.authpro-tab:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}

.authpro-tab.active {
  color: #ffffff;
  background: rgba(255,255,255,0.12);
}

.authpro-tab.active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0; right: 0;
  height: 3px;
  background: var(--ap-accent);
}

.authpro-tab-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ─── Panels ─── */
.authpro-panel {
  display: none;
  padding: 28px 28px 24px;
  animation: ap-fadein 0.22s ease both;
}

.authpro-panel.active {
  display: block;
}

/* ─── Form ─── */
.authpro-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.authpro-field-row {
  display: flex;
  gap: 12px;
}

.authpro-field-row .authpro-field-group {
  flex: 1;
}

.authpro-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.authpro-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ap-text-muted);
}

/* ─── Input ─── */
.authpro-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.authpro-input-icon {
  position: absolute;
  left: 11px;
  color: var(--ap-text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color var(--ap-transition);
}

.authpro-input {
  width: 100%;
  padding: 10px 38px 10px 36px;
  border: 1.5px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  background: var(--ap-surface);
  color: var(--ap-text);
  font-family: var(--ap-font-body);
  font-size: 0.92rem;
  transition: border-color var(--ap-transition), box-shadow var(--ap-transition), background var(--ap-transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.authpro-input:hover {
  border-color: #b0bdd0;
}

.authpro-input:focus {
  border-color: var(--ap-border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(26,58,92,0.10);
}

.authpro-input:focus + .authpro-input-icon,
.authpro-input-wrap:focus-within .authpro-input-icon {
  color: var(--ap-primary);
}

.authpro-input.is-invalid {
  border-color: var(--ap-error);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
}

/* ─── Password Toggle ─── */
.authpro-toggle-pw {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ap-text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--ap-transition);
}

.authpro-toggle-pw:hover {
  color: var(--ap-primary);
}

/* ─── Password Strength ─── */
.authpro-pw-strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-height: 18px;
}

.authpro-pw-bar {
  flex: 1;
  height: 4px;
  background: var(--ap-border);
  border-radius: 2px;
  overflow: hidden;
}

.authpro-pw-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  background: var(--ap-border);
}

.authpro-pw-strength[data-strength="1"] .authpro-pw-fill { width: 25%; background: #e74c3c; }
.authpro-pw-strength[data-strength="2"] .authpro-pw-fill { width: 50%; background: #e67e22; }
.authpro-pw-strength[data-strength="3"] .authpro-pw-fill { width: 75%; background: #f1c40f; }
.authpro-pw-strength[data-strength="4"] .authpro-pw-fill { width: 100%; background: var(--ap-success); }

.authpro-pw-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ap-text-muted);
  white-space: nowrap;
  min-width: 56px;
}

/* ─── Remember row ─── */
.authpro-remember-row {
  display: flex;
  align-items: center;
}

.authpro-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ap-text-muted);
  cursor: pointer;
  user-select: none;
}

.authpro-checkbox {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.authpro-checkbox-custom {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ap-border);
  border-radius: 3px;
  background: var(--ap-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--ap-transition), background var(--ap-transition);
  flex-shrink: 0;
}

.authpro-checkbox:checked ~ .authpro-checkbox-custom {
  background: var(--ap-primary);
  border-color: var(--ap-primary);
}

.authpro-checkbox:checked ~ .authpro-checkbox-custom::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* ─── Buttons ─── */
.authpro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--ap-radius-sm);
  font-family: var(--ap-font-body);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--ap-transition), color var(--ap-transition), box-shadow var(--ap-transition), transform var(--ap-transition);
  border: 2px solid transparent;
  text-decoration: none;
}

.authpro-btn:active {
  transform: translateY(1px);
}

.authpro-btn-primary {
  background: var(--ap-primary);
  color: #ffffff;
  width: 100%;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(26,58,92,0.18);
  position: relative;
  overflow: hidden;
}

.authpro-btn-primary::before {
  content: '';
  position: absolute;
  left: -100%; top: 0;
  width: 60%;
  height: 100%;
  background: rgba(255,255,255,0.12);
  transform: skewX(-20deg);
  transition: left 0.4s ease;
}

.authpro-btn-primary:hover::before {
  left: 140%;
}

.authpro-btn-primary:hover {
  background: var(--ap-primary-dark);
  box-shadow: 0 4px 16px rgba(26,58,92,0.28);
}

.authpro-btn-outline {
  background: transparent;
  border-color: var(--ap-primary);
  color: var(--ap-primary);
}

.authpro-btn-outline:hover {
  background: var(--ap-primary);
  color: #ffffff;
}

.authpro-btn-secondary {
  background: var(--ap-surface);
  border-color: var(--ap-border);
  color: var(--ap-text-muted);
}

.authpro-btn-secondary:hover {
  background: #eef2f8;
  color: var(--ap-text);
}

/* ─── Forgot password intro ─── */
.authpro-forgot-intro {
  background: var(--ap-surface);
  border-left: 3px solid var(--ap-accent);
  border-radius: 0 var(--ap-radius-sm) var(--ap-radius-sm) 0;
  padding: 12px 14px;
  margin-bottom: 4px;
}

.authpro-forgot-intro p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ap-text-muted);
  line-height: 1.5;
}

/* ─── Logged-in state ─── */
.authpro-loggedin {
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.authpro-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ap-primary);
  color: #ffffff;
  font-family: var(--ap-font-head);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(26,58,92,0.18);
  border: 3px solid var(--ap-accent);
}

.authpro-greeting {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.authpro-greeting-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ap-text-muted);
}

.authpro-greeting-name {
  font-family: var(--ap-font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ap-primary);
}

.authpro-loggedin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.authpro-loggedin-actions form {
  margin: 0;
  padding: 0;
}

/* ─── Responsive ─── */
@media (max-width: 380px) {
  .authpro-panel {
    padding: 20px 16px 18px;
  }

  .authpro-tab {
    font-size: 0.72rem;
    padding: 12px 4px;
  }

  .authpro-field-row {
    flex-direction: column;
  }
}

/* ─── Focus Visible (a11y) ─── */
.authpro-btn:focus-visible,
.authpro-tab:focus-visible,
.authpro-input:focus-visible,
.authpro-toggle-pw:focus-visible {
  outline: 2px solid var(--ap-accent);
  outline-offset: 2px;
}
