@import url("./variables.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.2px;

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background: rgb(var(--background));
  color: rgb(var(--text));
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  color: rgb(var(--text));
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
}

h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
}

h4 {
  font-size: var(--fs-h4);
  font-weight: 600;
}

h5 {
  font-size: var(--fs-h5);
  font-weight: 600;
}

h6 {
  font-size: var(--fs-h6);
  font-weight: 600;
}

p {
  font-size: var(--fs-body);
  line-height: 1.6;
  color: rgb(var(--text-light));
}

span,
a {
  font-size: var(--fs-body);
  color: inherit;
}

small {
  font-size: var(--fs-small);
  color: rgb(var(--text-muted));
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font-size: var(--fs-body);
  font: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-track {
  background: linear-gradient(
    135deg,
    var(--scrollbar-track-start) 0%,
    var(--scrollbar-track-mid) 40%,
    var(--scrollbar-track-end) 65%,
    var(--scrollbar-track-base) 100%
  );
  border-radius: 10px;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.btn {
  background: linear-gradient(
    135deg,
    rgb(var(--accent) / 0.9),
    rgb(var(--accent-dark) / 0.5)
  );
  color: rgb(var(--text-inverse));
  font-size: var(--fs-body);
  font-family: var(--font-heading);
  font-weight: 500;
  line-height: var(--lh-heading);
  letter-spacing: -0.3px;

  box-shadow: var(--shadow-color);
  border: none;
  cursor: pointer;

  transition: all 0.2s ease;
}

.btn-create,
.btn-submit {
  background: linear-gradient(
    135deg,
    rgb(var(--accent) / 0.9),
    rgb(var(--accent-dark) / 0.5)
  );
  color: rgb(var(--text-inverse));
  box-shadow: var(--shadow-color);
}

.btn-cancel {
  background: linear-gradient(
    135deg,
    rgb(var(--red) / 0.9),
    rgb(var(--red) / 0.65)
  );

  color: rgb(var(--text-inverse));

  box-shadow: var(--shadow-color);

  border: none;
  transition: all 0.2s ease;
}

.btn-create:hover,
.btn-create:focus,
.btn-submit:hover,
.btn-submit:focus {
  transform: translateY(-2px);
  box-shadow: none;
  outline: none;

  /* FORCE SAME STATE (THIS IS KEY) */
  background: linear-gradient(
    135deg,
    rgb(var(--accent) / 1),
    rgb(var(--accent-dark) / 0.75)
  ) !important;

  color: rgb(var(--text-inverse)) !important;
}

.btn-cancel:hover,
.btn-cancel:focus {
  transform: translateY(-2px);
  box-shadow: none;
  outline: none;
  background: linear-gradient(
    135deg,
    rgb(var(--red) / 1),
    rgb(var(--red) / 0.75)
  );

  color: rgb(var(--text-inverse)) !important;
}

.btn-cancel:focus-visible {
  outline: 2px solid rgb(var(--red) / 0.5);
  outline-offset: 2px;
}

.btn-create:focus-visible,
.btn-submit:focus-visible {
  outline: 2px solid rgb(var(--accent) / 0.4);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(0);
}

.btn .material-symbols-outlined {
  color: rgb(var(--text-inverse)) !important;
}

/* =========================
   CARD
========================= */

.card {
  background: linear-gradient(
    180deg,
    rgb(var(--surface-light)) 0%,
    rgb(var(--surface)) 100%
  );

  border: 1px solid rgb(var(--border));
  border-radius: 14px;

  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* =========================
   CARD HEADER
========================= */

.card-header {
  padding: 14px 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  background: transparent !important;

  border-bottom: 0 none !important;
}

/* =========================
   CARD BODY
========================= */

.card-body {
  padding: 18px;

  background: linear-gradient(
    180deg,
    rgb(var(--surface-light)) 0%,
    rgb(var(--surface)) 100%
  );
}

/* ========================================
   PAGE
======================================== */

.auth-page {
  min-height: 100vh;

  background: radial-gradient(
      circle at top left,
      rgba(var(--primary) / 0.08),
      transparent 35%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(var(--primary) / 0.06),
      transparent 40%
    ),
    linear-gradient(
      180deg,
      rgb(var(--surface-light)) 0%,
      rgb(var(--surface)) 100%
    );
}

.auth-wrapper {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;
}

/* ========================================
   CARD
======================================== */

.auth-card {
  width: 100%;
  max-width: 460px;
}

.auth-card .card-header {
  justify-content: center;
  padding-top: 26px;
  padding-bottom: 10px;
}

.auth-card .card-body {
  padding: 24px;
}

/* ========================================
   BRAND
======================================== */

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-brand-icon {
  font-size: 42px;
  color: rgb(var(--primary));

  margin-bottom: 10px;
}

.auth-title {
  margin: 0;

  font-size: 28px;
  font-weight: 800;

  color: rgb(var(--text));
}

.auth-subtitle {
  margin-top: 8px;
  margin-bottom: 0;

  font-size: 13px;
  color: rgb(var(--text-muted));
}

/* ========================================
   INPUTS
======================================== */

.auth-input {
  position: relative;
}

.auth-input .input-group-text {
  background: rgb(var(--surface-light));
}

.password-toggle {
  position: absolute;

  right: 14px;
  top: 50%;

  transform: translateY(-50%);

  z-index: 10;

  cursor: pointer;

  color: rgb(var(--text-muted));

  transition: all 0.2s ease;
}

.password-toggle:hover {
  color: rgb(var(--primary));
}

/* ========================================
   OPTIONS
======================================== */

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;

  margin-bottom: 20px;
}

.auth-link {
  text-decoration: none;

  color: rgb(var(--primary));

  font-size: 13px;
  font-weight: 600;
}

.auth-link:hover {
  opacity: 0.8;
}

/* ========================================
   BUTTON
======================================== */

.auth-submit {
  width: 100%;
  height: 48px;
}

/* ========================================
   FOOTER
======================================== */

.auth-footer {
  margin-top: 22px;

  text-align: center;

  font-size: 12px;
  color: rgb(var(--text-muted));
}

/* ========================================
   ALERT
======================================== */

.custom-alert {
  margin-bottom: 18px;

  border-radius: 12px;

  background: rgba(var(--red) / 0.08);
  border: 1px solid rgba(var(--red) / 0.15);

  color: rgb(var(--red));
}

/* ========================================
   CUSTOM CHECKBOX
======================================== */

.custom-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.custom-check-input {
  appearance: none;
  -webkit-appearance: none;

  width: 18px;
  height: 18px;

  margin: 0;

  border-radius: 6px;
  border: 1px solid rgb(var(--border));

  background: rgb(var(--surface-light));

  cursor: pointer;

  position: relative;

  transition: all 0.2s ease;
}

.custom-check-input:hover {
  border-color: rgb(var(--primary));
}

.custom-check-input:checked {
  background: rgb(var(--primary));
  border-color: rgb(var(--primary));
}

.custom-check-input:checked::after {
  content: "";

  position: absolute;

  left: 5px;
  top: 1px;

  width: 5px;
  height: 10px;

  border: solid rgb(var(--text-inverse));
  border-width: 0 2px 2px 0;

  transform: rotate(45deg);
}

.custom-check-input:focus {
  outline: none;
  box-shadow: none;
}

.custom-check-label {
  margin: 0;

  font-size: 13px;
  font-weight: 500;

  color: rgb(var(--text-muted));

  cursor: pointer;

  user-select: none;
}

.custom-check:hover .custom-check-label {
  color: rgb(var(--text));
}

.form-control {
  border : 1px solid rgb(var(--border)) !important;
  border-top-right-radius: var(--bs-border-radius) !important;
  border-bottom-right-radius: var(--bs-border-radius) !important;
}

.form-control:hover, .form-control:focus{
  border : 1px solid rgb(var(--border)) !important;
  box-shadow: none !important;
}

/* ========================================
   INFO BOX
======================================== */

.auth-info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  padding: 14px;

  margin-bottom: 20px;

  border-radius: 12px;

  background: rgba(var(--primary) / 0.06);
  border: 1px solid rgba(var(--primary) / 0.12);
}

.auth-info-box .material-symbols-outlined {
  font-size: 18px;
  color: rgb(var(--primary));

  flex-shrink: 0;

  margin-top: 1px;
}

.auth-info-box p {
  margin: 0;

  font-size: 13px;
  line-height: 1.5;

  color: rgb(var(--text-muted));
}

/* ========================================
   SUCCESS ALERT
======================================== */

.alert-success-custom {
  background: rgba(var(--green) / 0.08);
  border-color: rgba(var(--green) / 0.15);
  color: rgb(var(--green));
}

/* ========================================
   BACK LINK
======================================== */

.auth-back-link {
  margin-top: 18px;
  text-align: center;
}

.auth-back-link .auth-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-back-link .material-symbols-outlined {
  font-size: 18px;
  margin-top: 2px;
}

/* ========================================
OTP GROUP
======================================== */

.otp-group {
  display: flex;
  justify-content: center;
  gap: 10px;

  margin-bottom: 18px;
}

.otp-input {
  width: 52px;
  height: 56px;

  padding: 0;

  text-align: center;

  font-size: 22px;
  font-weight: 700;

  border: 1px solid rgb(var(--border));
  border-radius: 12px;

  background: rgb(var(--surface-light));
  color: rgb(var(--text));

  transition: all 0.2s ease;
}

.otp-input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgb(var(--primary) / 0.12);
  outline: none;
}

/* ========================================
  INFO BOX
  ======================================== */

.auth-info-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;

  padding: 12px 14px;
  margin-bottom: 18px;

  border: 1px solid rgb(var(--border));
  border-radius: 12px;

  background: rgb(var(--surface-light));
}

.auth-info-box .material-symbols-outlined {
  font-size: 18px;
  color: rgb(var(--primary));
}

.auth-info-box p {
  margin: 0;

  font-size: 13px;
  line-height: 1.5;

  color: rgb(var(--text-muted));
}

/* ========================================
  RESEND LINK
  ======================================== */

.auth-link-btn {
  padding: 0;

  background: none;
  border: none;

  color: rgb(var(--primary));

  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
}

.auth-link-btn:hover {
  opacity: 0.85;
}

.auth-link-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
RESET PASSWORD
======================================== */

.password-error {
  margin-bottom: 16px;

  padding: 10px 12px;

  border: 1px solid rgb(var(--red) / 0.2);
  border-radius: 10px;

  background: rgb(var(--red) / 0.08);
  color: rgb(var(--red));

  font-size: 13px;
  font-weight: 500;
}

/* SUCCESS ALERT */

.alert-success {
  border-color: rgb(var(--green) / 0.2);
  background: rgb(var(--green) / 0.08);
  color: rgb(var(--green));
}

/* ========================================
   AUTH LOADER
======================================== */

.page-loader {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgb(var(--surface));
  z-index: 99999;
}

.page-loader-spinner {
  width: 42px;
  height: 42px;

  border-radius: 50%;

  border: 3px solid rgb(var(--border));
  border-top-color: rgb(var(--primary));

  animation: authSpin 0.8s linear infinite;
}

.auth-hidden {
  opacity: 0;
  visibility: hidden;
}

.auth-ready {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

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

/* ========================================
  MOBILE
  ======================================== */

@media (max-width: 576px) {
  .otp-group {
    gap: 8px;
  }

  .otp-input {
    width: 44px;
    height: 50px;

    font-size: 18px;
  }
}

@media (max-width: 576px) {
  .auth-wrapper {
    padding: 16px;
  }

  .auth-card .card-body {
    padding: 20px;
  }

  .auth-title {
    font-size: 24px;
  }

  .auth-options {
    flex-direction: column;
    align-items: flex-start;
  }
}
