/**
 * Custom Auth & Login Guard - Stylesheet
 * Light & Dark Mode (.drK) Architecture
 */

/* =========================================================================
   1. CSS VARIABLES (DEFAULT LIGHT MODE)
   ========================================================================= */
:root {
  --cag-bg: #fffdfc;
  --cag-text: #08102b;
  --cag-text-muted: rgba(8, 16, 43, 0.65);
  --cag-shadow: 0 5px 35px rgba(0, 0, 0, 0.1);
  --cag-border: #e2e8f0;
  --cag-border-focus: #2563eb;
  --cag-bg-input: #f8fafc;
  --cag-bg-input-focus: #ffffff;
  --cag-placeholder: rgba(8, 16, 43, 0.4);
  --cag-icon: #94a3b8;
  --cag-tab-bg: #f1f5f9;
  --cag-tab-active-bg: #fffdfc;
  --cag-tab-active-color: #2563eb;
  --cag-primary: #2563eb;
  --cag-primary-hover: #1d4ed8;
  --cag-primary-focus: rgba(37, 99, 235, 0.2);
  --cag-secondary-bg: #f1f5f9;
  --cag-secondary-text: #08102b;
  --cag-secondary-border: #cbd5e1;
  --cag-secondary-hover: #e2e8f0;
  --cag-radius: 12px;
  --cag-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* =========================================================================
   2. DARK MODE OVERRIDES (.drK)
   ========================================================================= */
.drK,
.drK :root,
body.drK,
[data-theme="dark"] {
  --cag-bg: #2d2d30;
  --cag-text: #fffdfc;
  --cag-text-muted: rgba(255, 253, 252, 0.7);
  --cag-shadow: 0 5px 35px rgba(0, 0, 0, 0.4);
  --cag-border: #3e3e42;
  --cag-border-focus: #3b82f6;
  --cag-bg-input: #232326;
  --cag-bg-input-focus: #1c1c1e;
  --cag-placeholder: rgba(255, 253, 252, 0.4);
  --cag-icon: #8b8b92;
  --cag-tab-bg: #222225;
  --cag-tab-active-bg: #2d2d30;
  --cag-tab-active-color: #60a5fa;
  --cag-primary: #3b82f6;
  --cag-primary-hover: #2563eb;
  --cag-primary-focus: rgba(59, 130, 246, 0.25);
  --cag-secondary-bg: #38383c;
  --cag-secondary-text: #fffdfc;
  --cag-secondary-border: #4a4a50;
  --cag-secondary-hover: #444449;
}

/* =========================================================================
   3. WRAPPER & CARD
   ========================================================================= */
.cag-auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  font-family: var(--cag-font-family);
  box-sizing: border-box;
  width: 100%;
}

.cag-auth-wrapper * {
  box-sizing: border-box;
}

/* Base Light Mode Card */
.cag-auth-card {
  background: #fffdfc;
  color: #08102b;
  box-shadow: 0 5px 35px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 440px;
  padding: 32px;
  border-radius: var(--cag-radius);
  border: 1px solid #e2e8f0;
  position: relative;
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Dark Mode Card */
.drK .cag-auth-card,
.drK.cag-auth-card {
  background: #2d2d30;
  color: #fffdfc;
  box-shadow: 0 5px 35px rgba(0, 0, 0, 0.4);
  border-color: #3e3e42;
}

/* =========================================================================
   4. HEADERS & TYPOGRAPHY
   ========================================================================= */
.cag-card-header {
  margin-bottom: 24px;
  text-align: center;
}

/* Light Mode Title */
.cag-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #08102b;
  margin: 0 0 8px 0;
  line-height: 1.25;
  transition: color 0.3s ease;
}

/* Dark Mode Title */
.drK .cag-title {
  color: #fffdfc;
}

/* Light Mode Subtitle */
.cag-subtitle {
  font-size: 0.9rem;
  color: rgba(8, 16, 43, 0.65);
  margin: 0;
  line-height: 1.4;
  transition: color 0.3s ease;
}

/* Dark Mode Subtitle */
.drK .cag-subtitle {
  color: rgba(255, 253, 252, 0.7);
}

/* =========================================================================
   5. TABS NAVIGATION (.cag-nav-tabs)
   ========================================================================= */
/* Light Mode Tabs Container */
.cag-nav-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 22px;
  gap: 4px;
  border: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Dark Mode Tabs Container */
.drK .cag-nav-tabs {
  background: #222225;
  border-color: #3a3a3e;
}

/* Light Mode Tab Button */
.cag-tab-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(8, 16, 43, 0.6);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.cag-tab-btn:hover {
  color: #08102b;
}

.cag-tab-btn.active {
  background: #fffdfc;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Dark Mode Tab Button */
.drK .cag-tab-btn {
  color: rgba(255, 253, 252, 0.6);
}

.drK .cag-tab-btn:hover {
  color: #fffdfc;
}

.drK .cag-tab-btn.active {
  background: #2d2d30;
  color: #60a5fa;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.cag-tab-content {
  display: none;
  animation: cagFadeIn 0.25s ease-in-out;
}

.cag-tab-content.active {
  display: block;
}

@keyframes cagFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   6. ALERTS & NOTICES
   ========================================================================= */
.cag-alert-container {
  margin-bottom: 18px;
}

.cag-alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cag-alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Light Alert Colors */
.cag-alert-error {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.cag-alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.cag-alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Dark Alert Colors */
.drK .cag-alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.drK .cag-alert-success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.drK .cag-alert-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* =========================================================================
   7. FORM GROUPS & LABELS
   ========================================================================= */
.cag-form-group {
  margin-bottom: 16px;
}

/* Light Mode Labels */
.cag-form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #08102b;
  margin-bottom: 6px;
  transition: color 0.3s ease;
}

/* Dark Mode Labels */
.drK .cag-form-group label {
  color: #fffdfc;
}

.cag-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cag-label-row label {
  margin-bottom: 0;
}

/* Links */
.cag-link-forgot,
.cag-link-tab-switch {
  font-size: 0.82rem;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.cag-link-forgot:hover,
.cag-link-tab-switch:hover {
  text-decoration: underline;
}

.drK .cag-link-forgot,
.drK .cag-link-tab-switch {
  color: #60a5fa;
}

/* =========================================================================
   8. INPUTS & FIELDS
   ========================================================================= */
.cag-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Light Icons */
.cag-input-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: color 0.3s ease;
}

.cag-input-icon svg {
  width: 18px;
  height: 18px;
}

/* Dark Icons */
.drK .cag-input-icon {
  color: #8b8b92;
}

/* Light Mode Input */
.cag-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-size: 0.92rem;
  color: #08102b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
  outline: none;
  font-family: inherit;
}

.cag-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.cag-input::placeholder {
  color: rgba(8, 16, 43, 0.4);
}

/* Dark Mode Input */
.drK .cag-input {
  color: #fffdfc;
  background: #232326;
  border-color: #3e3e42;
}

.drK .cag-input:focus {
  background: #1c1c1e;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.drK .cag-input::placeholder {
  color: rgba(255, 253, 252, 0.4);
}

/* Password Toggle */
.cag-toggle-password {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.cag-toggle-password:hover {
  color: #08102b;
}

.drK .cag-toggle-password {
  color: #8b8b92;
}

.drK .cag-toggle-password:hover {
  color: #fffdfc;
}

.cag-toggle-password svg {
  width: 20px;
  height: 20px;
}

/* =========================================================================
   9. STRENGTH METER
   ========================================================================= */
.cag-strength-meter {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
  display: none;
}

.drK .cag-strength-meter {
  background: #3e3e42;
}

.cag-strength-bar {
  height: 100%;
  width: 0;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.cag-strength-bar.weak {
  width: 33.3%;
  background: #ef4444;
}

.cag-strength-bar.medium {
  width: 66.6%;
  background: #f59e0b;
}

.cag-strength-bar.strong {
  width: 100%;
  background: #10b981;
}

/* =========================================================================
   10. CHECKBOX & TERMS
   ========================================================================= */
.cag-form-row {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}

.cag-form-row.cag-between {
  justify-content: space-between;
}

/* Light Checkbox Label */
.cag-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: rgba(8, 16, 43, 0.65);
  cursor: pointer;
  transition: color 0.3s ease;
}

/* Dark Checkbox Label */
.drK .cag-checkbox-label {
  color: rgba(255, 253, 252, 0.7);
}

.cag-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
  margin: 0;
}

.drK .cag-checkbox-label input[type="checkbox"] {
  accent-color: #3b82f6;
}

.cag-checkbox-label a {
  color: #2563eb;
  text-decoration: none;
}

.cag-checkbox-label a:hover {
  text-decoration: underline;
}

.drK .cag-checkbox-label a {
  color: #60a5fa;
}

/* =========================================================================
   11. BUTTONS & SPINNER
   ========================================================================= */
.cag-submit-group {
  margin-top: 20px;
}

.cag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.cag-btn-block {
  width: 100%;
}

/* Primary Button */
.cag-btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.cag-btn-primary:hover {
  background: #1d4ed8;
  color: #ffffff;
}

.drK .cag-btn-primary {
  background: #3b82f6;
  color: #ffffff;
}

.drK .cag-btn-primary:hover {
  background: #2563eb;
}

/* Secondary Button */
.cag-btn-secondary {
  background: #f1f5f9;
  color: #08102b;
  border-color: #cbd5e1;
}

.cag-btn-secondary:hover {
  background: #e2e8f0;
}

.drK .cag-btn-secondary {
  background: #38383c;
  color: #fffdfc;
  border-color: #4a4a50;
}

.drK .cag-btn-secondary:hover {
  background: #444449;
}

.cag-btn:disabled,
.cag-btn.loading {
  opacity: 0.75;
  cursor: not-allowed;
}

/* Spinner */
.cag-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: cagSpin 0.7s linear infinite;
  margin-left: 8px;
}

@keyframes cagSpin {
  to { transform: rotate(360deg); }
}

/* =========================================================================
   12. CARD FOOTER & SWITCH LINKS
   ========================================================================= */
/* Light Footer */
.cag-card-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.875rem;
  color: rgba(8, 16, 43, 0.65);
  transition: border-color 0.3s ease, color 0.3s ease;
}

/* Dark Footer */
.drK .cag-card-footer {
  border-top-color: #3e3e42;
  color: rgba(255, 253, 252, 0.7);
}

.cag-card-footer p {
  margin: 0;
}

.cag-switch-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.cag-switch-link:hover {
  text-decoration: underline;
}

.drK .cag-switch-link {
  color: #60a5fa;
}

/* =========================================================================
   13. LOGGED-IN CARD
   ========================================================================= */
.cag-logged-in-box {
  text-align: center;
}

.cag-avatar img {
  border-radius: 50%;
  margin-bottom: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.cag-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}
