/* css/auth-premium.css - TerreNet Premium Authentication Styles */

:root {
  --auth-modal-z: 10000;
  --auth-transition-speed: 0.3s;
  --auth-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal Structure */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--auth-modal-z);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--auth-transition-speed) var(--auth-ease);
}

.auth-modal.active {
  opacity: 1;
  visibility: visible;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-modal-content {
  position: relative;
  z-index: 1;
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-xl, 24px);
  box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all var(--auth-transition-speed) var(--auth-ease);
  margin: 1.5rem;
}

.active .auth-modal-content {
  transform: translateY(0) scale(1);
}

.auth-modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tn-slate-100, #f1f5f9);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tn-slate-600, #475569);
  transition: all 0.2s;
  z-index: 10;
}

.auth-modal-close:hover {
  background: var(--tn-slate-200, #e2e8f0);
  color: var(--tn-slate-900, #0f172a);
  transform: rotate(90deg);
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: var(--tn-slate-100, #f1f5f9);
  padding: 0.25rem;
  margin: 2rem 2rem 1.5rem;
  border-radius: var(--radius-md, 12px);
}

.auth-tab {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tn-slate-500, #64748b);
  cursor: pointer;
  border-radius: var(--radius-sm, 8px);
  transition: all 0.2s;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--tn-primary, #16a34a);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
}

/* Header */
.auth-header {
  text-align: center;
  padding: 0 2rem;
  margin-bottom: 2rem;
}

.auth-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--tn-slate-900, #0f172a);
  margin-bottom: 0.5rem;
}

.auth-header p {
  font-size: 0.9375rem;
  color: var(--tn-slate-500, #64748b);
}

/* Forms */
.auth-form-container {
  padding: 0 2rem 2.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

/* Custom scrollbar for form container */
.auth-form-container::-webkit-scrollbar { width: 4px; }
.auth-form-container::-webkit-scrollbar-track { background: transparent; }
.auth-form-container::-webkit-scrollbar-thumb { background: var(--tn-slate-200); border-radius: 10px; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  display: none;
}

.auth-form.active {
  display: flex;
  animation: authFadeIn 0.4s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tn-slate-700, #334155);
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrapper .icon {
  position: absolute;
  left: 1rem;
  color: var(--tn-slate-400, #94a3b8);
  pointer-events: none;
  transition: color 0.2s;
}

.auth-input-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: var(--tn-slate-50, #f8fafc);
  border: 1px solid var(--tn-slate-200, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  font-size: 1rem;
  color: var(--tn-slate-900, #0f172a);
  transition: all 0.2s;
}

.auth-input-wrapper input:focus {
  outline: none;
  border-color: var(--tn-primary, #16a34a);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(22, 197, 94, 0.1);
}

.auth-input-wrapper input:focus + .icon,
.auth-input-wrapper input:not(:placeholder-shown) + .icon {
  color: var(--tn-primary);
}

.auth-toggle-password {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--tn-slate-400, #94a3b8);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.auth-toggle-password:hover {
  color: var(--tn-slate-600, #475569);
}

/* Validation States */
.auth-field.error input {
  border-color: var(--tn-danger, #ef4444);
  background: #fef2f2;
}

.auth-field.error input:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.auth-error-message {
  font-size: 0.75rem;
  color: var(--tn-danger, #ef4444);
  margin-top: 0.25rem;
  display: none;
}

.auth-field.error .auth-error-message {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Password Strength */
.password-strength {
  margin-top: 0.75rem;
  display: none;
}

.active-strength .password-strength {
  display: block;
}

.strength-meter {
  height: 4px;
  background: var(--tn-slate-100, #f1f5f9);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.strength-meter-fill {
  height: 100%;
  width: 0;
  transition: all 0.4s ease;
}

.strength-meter-fill.weak { width: 25%; background: var(--tn-danger); }
.strength-meter-fill.fair { width: 50%; background: var(--tn-warning); }
.strength-meter-fill.good { width: 75%; background: #fbbf24; }
.strength-meter-fill.strong { width: 100%; background: var(--tn-success); }

.strength-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tn-slate-500);
}

.strength-text span {
  color: var(--tn-slate-900);
}

/* Checkbox & Links */
.auth-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--tn-slate-600);
}

.auth-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--tn-primary);
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tn-primary);
  cursor: pointer;
  transition: opacity 0.2s;
}

.auth-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}

/* Alerts */
.auth-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md, 12px);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.auth-alert.active {
  display: flex;
  animation: authSlideDown 0.3s var(--auth-ease);
}

@keyframes authSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-alert-error {
  background: #fef2f2;
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #991b1b;
}

.auth-alert-success {
  background: #f0fdf4;
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: #166534;
}

/* Submit Button */
.auth-submit-btn {
  width: 100%;
  padding: 0.875rem;
  margin-top: 0.5rem;
  border-radius: var(--radius-md, 12px);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all 0.3s;
}

.auth-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.loader-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: authSpin 0.8s linear infinite;
  display: none;
}

.auth-submit-btn.loading .loader-spinner {
  display: block;
}

.auth-submit-btn.loading span {
  display: none;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* Footer Hint */
.auth-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  background: var(--tn-slate-50, #f8fafc);
  border-top: 1px solid var(--tn-slate-200, #e2e8f0);
  font-size: 0.875rem;
  color: var(--tn-slate-500);
}

.auth-footer button {
  background: none;
  border: none;
  font-weight: 700;
  color: var(--tn-primary);
  cursor: pointer;
  padding: 0 0.25rem;
}

.auth-footer button:hover {
  text-decoration: underline;
}

/* Reset View adjustments */
.reset-view-header {
  margin-bottom: 1.5rem;
}

.reset-view-icon {
  width: 48px;
  height: 48px;
  background: var(--tn-green-50);
  color: var(--tn-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .auth-modal-content {
    max-width: none;
    height: 100%;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  
  .auth-form-container {
    flex: 1;
  }
  
  .auth-modal-close {
    top: 1rem;
    right: 1rem;
  }
}
