/**
 * Auth Page - Unified Authentication with Tabs
 * Design System: Kutvek
 */

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */

.auth-page {
  max-width: 56rem;
  margin: 3.2rem auto;
  padding: 0 1.6rem;
}

/* ========================================
   TAB NAVIGATION
   ======================================== */

.auth-tabs {
  display: flex;
  background: #ffffff;
  border-radius: 0.8rem 0.8rem 0 0;
  overflow: hidden;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 0;
}

.auth-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1.8rem 2.4rem;
  background: #f5f5f5;
  border: none;
  border-bottom: 0.3rem solid transparent;
  font-family: 'Oswald', sans-serif;
  font-size: 1.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9e9e9e;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  opacity: 0.65;
}

.auth-tab .icon {
  font-size: 2.4rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0.7;
}

.auth-tab:hover {
  background: #efefef;
  color: #616161;
  opacity: 0.85;
}

.auth-tab:hover .icon {
  transform: scale(1.05);
  opacity: 0.9;
}

.auth-tab.active {
  background: #ffffff;
  color: #1a1a1a;
  border-bottom-color: #ff0000;
  font-weight: 700;
  opacity: 1;
  box-shadow: inset 0 -3px 0 0 #ff0000;
}

.auth-tab.active .icon {
  opacity: 1;
}

.auth-tab[data-tab="signin"].active {
  border-bottom-color: #ff0000;
  box-shadow: inset 0 -3px 0 0 #ff0000;
}

.auth-tab[data-tab="signup"].active {
  border-bottom-color: #ff0000;
  box-shadow: inset 0 -3px 0 0 #ff0000;
}

.auth-tab:focus {
  outline: 2px solid rgba(255, 0, 0, 0.5);
  outline-offset: -2px;
}

/* ========================================
   PANELS
   ======================================== */

.auth-panels {
  background: #ffffff;
  border-radius: 0 0 0.8rem 0.8rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.auth-panel {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.auth-panel.active {
  opacity: 1;
  transform: translateY(0);
}

.auth-panel[hidden] {
  display: none;
}

.auth-panel-content {
  padding: 4rem 3.2rem;
}

.auth-panel-title {
  font-family: 'Oswald', sans-serif;
  font-size: 2.8rem;
  font-weight: 500;
  color: #1a1a1a;
  margin: 0 0 0.8rem 0;
  text-align: center;
}

.auth-panel-subtitle {
  font-size: 1.4rem;
  color: #757575;
  text-align: center;
  margin: 0 0 2.4rem 0;
}

/* ========================================
   FORMS
   ======================================== */

.auth-form {
  margin-top: 2.4rem;
}

/* Override global styles from basics.css */
.auth-form .field-wrapper > label::before {
  content: none !important;
  display: none !important;
}

.auth-form .field-wrapper.required > label::before {
  content: none !important;
  display: none !important;
}

.auth-form .field-wrapper {
  margin-bottom: 2.4rem;
  width: 100%;
  position: relative;
  isolation: isolate;
}

.auth-form .field-wrapper label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: #1a1a1a;
  font-family: 'Montserrat', sans-serif;
  text-align: center;
}

.auth-form .field-wrapper label.required::after {
  content: ' *';
  color: #d32f2f;
  margin-left: 0.2rem;
  font-weight: 700;
}

/* Input Base Styles */
.auth-form .field-input {
  width: 100%;
  box-sizing: border-box;
  padding: 1.4rem 1.6rem;
  min-height: 5rem;
  font-size: 1.5rem;
  font-family: 'Montserrat', sans-serif;
  color: #1a1a1a;
  background-color: #ffffff;
  border: 0.2rem solid #d0d0d0;
  border-radius: 0.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  position: relative;
  z-index: 1;
}

/* 1Password autofill optimization */
.auth-form .field-input:-webkit-autofill,
.auth-form .field-input:-webkit-autofill:hover,
.auth-form .field-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100rem #ffffff inset;
  -webkit-text-fill-color: #1a1a1a;
  border-color: #ff0000;
  transition: background-color 5000s ease-in-out 0s;
}

/* Stronger 1Password controls */
.auth-form .field-input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  pointer-events: none;
  position: absolute;
}

.auth-form .field-input::placeholder {
  color: #9e9e9e;
  font-style: italic;
  font-size: 1.4rem;
}

.auth-form .field-input:hover {
  border-color: #b0b0b0;
}

.auth-form .field-input:focus {
  border-color: #ff0000;
  box-shadow: 0 0 0 0.3rem rgba(255, 0, 0, 0.1);
  background-color: #fafbfc;
  outline: none;
}

.auth-form .field-input:focus::placeholder {
  opacity: 0.5;
}

/* Input States */
.auth-form .field-input:disabled {
  background-color: #f5f5f5;
  color: #9e9e9e;
  cursor: not-allowed;
  border-color: #e0e0e0;
}

.auth-form .field-input.error {
  border-color: #d32f2f;
  background-color: #fff5f5;
}

.auth-form .field-input.error:focus {
  box-shadow: 0 0 0 0.3rem rgba(211, 47, 47, 0.15);
}

/* Password Field with Toggle */
.password-field-wrapper {
  position: relative;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .field-input {
  padding-right: 4.8rem;
}

.toggle-password {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.8rem;
  cursor: pointer;
  font-size: 2.2rem;
  color: #757575;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 3.6rem;
  height: 3.6rem;
}

.toggle-password:hover {
  color: #ff0000;
  background: rgba(255, 0, 0, 0.1);
  transform: translateY(-50%) scale(1.1);
}

.toggle-password:active {
  transform: translateY(-50%) scale(0.95);
}

.toggle-password:focus {
  outline: 2px solid rgba(255, 0, 0, 0.5);
  outline-offset: 2px;
}

.toggle-password .material-symbols-rounded {
  display: block;
  line-height: 1;
  font-size: 2.2rem;
}

/* Password Strength Indicator */
.password-strength {
  margin-top: 1.6rem;
}

.strength-bar {
  height: 0.4rem;
  background-color: #e0e0e0;
  border-radius: 0.2rem;
  overflow: hidden;
  margin-bottom: 1.2rem;
}

.strength-bar-fill {
  height: 100%;
  width: 0%;
  transition: all 0.3s ease;
  border-radius: 0.2rem;
}

.strength-bar-fill[data-strength="0"] {
  width: 0%;
  background-color: #e0e0e0;
}

.strength-bar-fill[data-strength="1"] {
  width: 25%;
  background-color: #d32f2f;
}

.strength-bar-fill[data-strength="2"] {
  width: 50%;
  background-color: #f57c00;
}

.strength-bar-fill[data-strength="3"] {
  width: 75%;
  background-color: #fdd835;
}

.strength-bar-fill[data-strength="4"] {
  width: 100%;
  background-color: #388e3c;
}

.password-requirements {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  font-size: 1.3rem;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #757575;
  transition: all 0.3s ease;
  padding: 0.6rem 1rem;
  border-radius: 0.4rem;
  background: transparent;
}

.password-requirements li .req-icon {
  font-size: 1.8rem;
  color: #9e9e9e;
  font-weight: 400;
  transition: all 0.3s ease;
}

.password-requirements li.valid {
  color: #2e7d32;
  background-color: #e8f5e9;
}

.password-requirements li.valid .req-icon {
  color: #388e3c;
}

/* Row Layout - Bootstrap Grid Integration */
.auth-form .row {
  display: flex;
  flex-wrap: wrap;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
  gap: 1.6rem;
}

.auth-form .row .col-s-12,
.auth-form .row .col-m-6 {
  margin-bottom: 2.4rem;
}

.auth-form .row .field-wrapper {
  margin-bottom: 0;
}

/* Ensure fields in grid have same styles as standalone fields */
.auth-form .row .col-s-12 .field-wrapper,
.auth-form .row .col-m-6 .field-wrapper {
  width: 100%;
  position: relative;
  isolation: isolate;
}

.auth-form .row .col-s-12 .field-wrapper label,
.auth-form .row .col-m-6 .field-wrapper label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: #1a1a1a;
  font-family: 'Montserrat', sans-serif;
  text-align: center;
}

.auth-form .row .col-s-12 .field-input,
.auth-form .row .col-m-6 .field-input {
  width: 100%;
  height: 5rem;
  font-size: 1.5rem;
  padding: 1.4rem 1.6rem;
  border: 0.2rem solid #d0d0d0;
  border-radius: 0.6rem;
  background-color: #ffffff;
  font-family: 'Montserrat', sans-serif;
  transition: all 0.2s ease;
}

.auth-form .field-wrapper:last-of-type {
  margin-bottom: 2.4rem;
}

/* Checkbox styling */
.checkbox-wrapper {
  margin-bottom: 2rem !important;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  font-size: 1.4rem;
  color: #555;
  cursor: pointer;
  padding: 0.4rem 0;
  transition: color 0.2s ease;
}

.checkbox-label:hover {
  color: #1a1a1a;
}

.checkbox-label input[type="checkbox"] {
  width: 1.8rem;
  height: 1.8rem;
  margin-top: 0.2rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #ff0000;
  border-radius: 0.3rem;
}

/* All checkboxes in auth form - Full width and centered */
.auth-form .checkbox-wrapper .checkbox-label {
  width: 100%;
  justify-content: center;
}

/* Buttons */
.auth-form .btns {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 2.4rem;
  align-items: center;
}

.auth-form .btn.full-width {
  width: 100%;
  justify-content: center;
  display: flex;
  align-items: center;
}

.auth-form .btn.contained {
  min-height: 5.2rem;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: 'Oswald', sans-serif;
  border-radius: 0.6rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.auth-form .btn.contained.dark,
.auth-form button.contained.dark {
  background: #ff0000 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-form .btn.contained.dark:hover,
.auth-form button.contained.dark:hover {
  background: #cc0000 !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.auth-form .btn.contained.dark:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-form .btn.contained.validate {
  background: #ff0000;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-form .btn.contained.validate:hover {
  background: #cc0000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.auth-form .btn.contained.validate:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auth-form .btn.primary {
  color: #000000;
  font-size: 1.4rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  min-height: auto;
  padding: 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.auth-form .btn.primary:hover {
  color: #333333;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.auth-form .btn.primary:active {
  transform: scale(0.98);
}

/* Alert Messages */
.alert-message {
  padding: 1.6rem;
  border-radius: 0.6rem;
  margin-bottom: 2rem;
  font-size: 1.4rem;
  line-height: 1.6;
  border-left: 0.4rem solid;
  background-color: #f5f5f5;
  border-color: #757575;
  color: #1a1a1a;
  animation: slideInDown 0.4s ease;
}

.alert-message:empty {
  display: none;
  margin: 0;
  padding: 0;
}

.alert-message.success {
  background-color: #f1f8f4;
  border-color: #388e3c;
  color: #1b5e20;
}

.alert-message.error,
.alert-message.warning {
  background-color: #fff5f5;
  border-color: #d32f2f;
  color: #b71c1c;
}

.alert-message p {
  margin: 0;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   AUTH SWITCH (bottom links)
   ======================================== */

.auth-switch {
  margin-top: 2.4rem;
  padding-top: 2.4rem;
  border-top: 0.1rem solid #e0e0e0;
  text-align: center;
  font-size: 1.4rem;
  color: #757575;
}

.auth-switch .btn {
  margin-left: 0.8rem;
  font-weight: 600;
  color: #000000;
}

.auth-switch .btn:hover {
  color: #333333;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet */
@media only screen and (max-width: 768px) {
  .auth-page {
    margin: 1.6rem auto;
    padding: 0 1.2rem;
  }

  .auth-tab {
    padding: 1.6rem 1.6rem;
    font-size: 1.4rem;
    flex-direction: column;
    gap: 0.4rem;
  }

  .auth-tab .icon {
    font-size: 2rem;
  }

  .auth-panel-content {
    padding: 2.4rem 2rem;
  }

  .auth-panel-title {
    font-size: 2.4rem;
  }

  .auth-panel-subtitle {
    font-size: 1.3rem;
  }

  .auth-form .row {
    flex-direction: column;
    gap: 0;
  }

  .auth-form .row .column {
    margin-bottom: 1.6rem;
  }
}

/* Mobile */
@media only screen and (max-width: 480px) {
  .auth-page {
    margin: 0;
    padding: 0;
  }

  .auth-tabs {
    border-radius: 0;
  }

  .auth-panels {
    border-radius: 0;
  }

  .auth-tab {
    padding: 1.4rem 1rem;
    font-size: 1.2rem;
  }

  .auth-tab .icon {
    font-size: 1.8rem;
  }

  .auth-panel-content {
    padding: 2rem 1.6rem;
  }

  .auth-panel-title {
    font-size: 2.2rem;
  }

  .auth-form .btn.contained {
    min-height: 4.4rem;
    font-size: 1.4rem;
  }
}

/* ========================================
   LOADING STATES
   ======================================== */

.auth-form .btn.submitting {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.auth-form .btn.submitting::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2rem;
  height: 2rem;
  border: 0.2rem solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ========================================
   WELCOME MESSAGE
   ======================================== */

#welcome {
  margin-bottom: 2.4rem;
  animation: fadeInDown 0.5s ease;
}

#welcome .alert-message {
  background-color: #f1f8f4;
  border: 0.1rem solid #c8e6c9;
  border-left: 0.4rem solid #4caf50;
  border-radius: 0.4rem;
  padding: 1.6rem;
}

#welcome h5 {
  color: #ff0000;
  margin: 0 0 0.8rem 0;
  font-size: 1.8rem;
}

#welcome p {
  color: #555;
  margin: 0;
  font-size: 1.4rem;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
