/* ================================================================
   Authentication Styles (auth.css)
   Contains all authentication-related styles: login/register modals, forms, buttons, etc.
   ================================================================ */

/* === Body scroll lock for modals === */
body.modal-lock {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* === Auth Overlay & Modal === */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 8, 24, 0.68);
  backdrop-filter: blur(14px);
  animation: auth-overlay-fade-in var(--duration-fast) var(--ease-out);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-overlay[hidden] {
  display: none;
}

@keyframes auth-overlay-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.auth-modal {
  position: relative;
  width: min(420px, calc(100vw - 48px));
  padding: 40px 36px 32px;
  border-radius: 20px;
  border: 1px solid rgba(216, 180, 90, 0.38);
  background: rgba(4, 16, 42, 0.92);
  backdrop-filter: blur(28px);
  box-shadow:
    0 0 48px rgba(23, 105, 255, 0.18),
    0 28px 80px rgba(0, 0, 0, 0.48);
  animation: auth-modal-pop-in var(--duration-normal) var(--ease-out);
}

@keyframes auth-modal-pop-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.auth-close-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(242, 247, 255, 0.64);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
  .auth-close-btn:hover {
    color: var(--gold-light);
    background: rgba(216, 180, 90, 0.08);
  }
}

.auth-close-btn:active {
  color: var(--gold-light);
  background: rgba(216, 180, 90, 0.15);
}

.auth-title {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--gold-light);
  text-align: center;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(242, 247, 255, 0.7);
  letter-spacing: 0.04em;
}

.auth-field input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(132, 185, 255, 0.32);
  background: rgba(2, 10, 28, 0.5);
  color: var(--white);
  font-size: 14px;
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.auth-field input::placeholder {
  color: rgba(242, 247, 255, 0.28);
}

.auth-field input:focus {
  border-color: rgba(216, 180, 90, 0.72);
  box-shadow: 0 0 0 3px rgba(216, 180, 90, 0.12);
}

.auth-submit-btn {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid rgba(216, 180, 90, 0.68);
  background: linear-gradient(135deg, rgba(216, 180, 90, 0.18), rgba(216, 180, 90, 0.06));
  color: var(--gold-light);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: transform var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .auth-submit-btn:hover {
    transform: translateY(-1px);
    border-color: var(--gold-light);
    box-shadow: 0 0 22px rgba(216, 180, 90, 0.22);
  }
}

.auth-submit-btn:active {
  transform: scale(0.98);
}

.auth-switch {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: rgba(242, 247, 255, 0.52);
}

.auth-switch-btn {
  border: none;
  background: transparent;
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .auth-switch-btn:hover {
    background: rgba(216, 180, 90, 0.08);
  }
}

.auth-switch-btn:active {
  background: rgba(216, 180, 90, 0.15);
}

.auth-error-message {
  display: none;
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.32);
}

.auth-error-message.visible {
  display: block;
}

/* === User Dropdown === */
.user-dropdown-wrap {
  position: relative;
}

.user-btn {
  position: relative;
}

.user-btn::after {
  content: "▾";
  margin-left: 6px;
  font-size: 10px;
  color: rgba(242, 247, 255, 0.48);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  padding: 6px 0;
  border-radius: 12px;
  border: 1px solid rgba(216, 180, 90, 0.34);
  background: rgba(4, 16, 42, 0.96);
  backdrop-filter: blur(22px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.48);
  z-index: var(--z-tooltip);
  animation: dropdown-slide-in var(--duration-fast) var(--ease-out);
}

@keyframes dropdown-slide-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === My Records Modal === */
.records-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 8, 24, 0.68);
  backdrop-filter: blur(14px);
  animation: auth-overlay-fade-in var(--duration-fast) var(--ease-out);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.records-overlay[hidden] {
  display: none;
}

.records-modal {
  position: relative;
  width: min(720px, calc(100vw - 48px));
  max-height: calc(100vh - 80px);
  border-radius: 20px;
  border: 1px solid rgba(216, 180, 90, 0.38);
  background: rgba(4, 16, 42, 0.95);
  backdrop-filter: blur(28px);
  box-shadow:
    0 0 48px rgba(23, 105, 255, 0.18),
    0 28px 80px rgba(0, 0, 0, 0.48);
  animation: auth-modal-pop-in var(--duration-normal) var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid rgba(132, 185, 255, 0.12);
  flex-shrink: 0;
}

.records-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--gold-light);
}

.records-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(242, 247, 255, 0.64);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (hover: hover) {
  .records-close-btn:hover {
    color: var(--gold-light);
    background: rgba(216, 180, 90, 0.08);
  }
}

.records-close-btn:active {
  color: var(--gold-light);
  background: rgba(216, 180, 90, 0.15);
}

.records-content {
  padding: 20px 28px 28px;
  overflow-y: auto;
  flex: 1;
}

.records-loading,
.records-error,
.records-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(242, 247, 255, 0.48);
  font-size: 14px;
}

.records-error {
  color: #fca5a5;
}

.records-section {
  margin-bottom: 24px;
}

.records-section:last-child {
  margin-bottom: 0;
}

.records-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(242, 247, 255, 0.72);
  letter-spacing: 0.03em;
}

.records-table-wrap {
  overflow-x: auto;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.records-table th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(242, 247, 255, 0.48);
  border-bottom: 1px solid rgba(132, 185, 255, 0.10);
  white-space: nowrap;
}

.records-table td {
  padding: 8px 10px;
  color: rgba(242, 247, 255, 0.72);
  border-bottom: 1px solid rgba(132, 185, 255, 0.06);
  white-space: nowrap;
}

.records-table tbody tr:hover td {
  background: rgba(132, 185, 255, 0.04);
}

.records-score {
  font-weight: 700;
  color: rgba(242, 247, 255, 0.56);
}

.records-score-high {
  color: #4ade80;
}

.records-score-mid {
  color: #facc15;
}

.records-score-low {
  color: #f87171;
}

/* === Field Error State === */
.field-error {
  border-color: rgba(239, 68, 68, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
}

/* === Records Action Buttons === */
.records-action-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(216, 180, 90, 0.45);
  background: rgba(216, 180, 90, 0.08);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

@media (hover: hover) {
  .records-action-btn:hover {
    background: rgba(216, 180, 90, 0.18);
    border-color: var(--gold-light);
  }
}

.records-action-btn:active {
  background: rgba(216, 180, 90, 0.22);
  border-color: var(--gold-light);
}

.records-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.records-hint {
  font-size: 12px;
  color: rgba(242, 247, 255, 0.35);
  white-space: nowrap;
}

/* === Records Toast === */
.records-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  z-index: calc(var(--z-modal) + 1);
  animation: toast-slide-up var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.records-toast[hidden] {
  display: none;
}

.records-toast-success {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.records-toast-error {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.records-toast-info {
  background: rgba(23, 105, 255, 0.15);
  border: 1px solid rgba(23, 105, 255, 0.35);
  color: rgba(242, 247, 255, 0.85);
}

@keyframes toast-slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === Records Collapsible Sections (details/summary) === */
.records-section[open] > summary {
  margin-bottom: 10px;
}

.records-section summary {
  cursor: pointer;
  list-style: none;
}

.records-section summary::-webkit-details-marker {
  display: none;
}

.records-section summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform var(--duration-fast);
  color: rgba(242, 247, 255, 0.48);
}

.records-section[open] > summary::before {
  content: "▾ ";
  color: var(--gold-light);
}

/* === Gap Report Detail === */
.gap-detail-area {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(132, 185, 255, 0.14);
  background: rgba(2, 10, 28, 0.4);
}

.gap-report {
  font-size: 13px;
  color: rgba(242, 247, 255, 0.72);
}

.gap-score-wrap {
  text-align: center;
  margin-bottom: 16px;
}

.gap-score {
  display: inline-block;
  font-size: 36px;
  font-weight: 900;
  padding: 8px 24px;
  border-radius: 12px;
}

.gap-score-high {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.gap-score-mid {
  background: rgba(250, 204, 21, 0.12);
  color: #facc15;
}

.gap-score-low {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.gap-score-label {
  display: block;
  font-size: 12px;
  color: rgba(242, 247, 255, 0.4);
  margin-top: 4px;
}

.gap-job {
  text-align: center;
  font-size: 13px;
  color: rgba(242, 247, 255, 0.56);
  margin-bottom: 16px;
}

.gap-section-title {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(242, 247, 255, 0.64);
  letter-spacing: 0.03em;
}

.gap-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.gap-item {
  padding: 5px 0 5px 16px;
  position: relative;
  line-height: 1.5;
}

.gap-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.gap-item-good::before { background: #4ade80; }
.gap-item-bad::before { background: #f87171; }
.gap-item-warn::before { background: #facc15; }
.gap-item-action::before { background: #1769ff; }

.gap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
}

.gap-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.2);
}