/**
 * HR login — clean mobile UX (aligned with assets/css/login.css patterns)
 */
.hr-login-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* —— Logo + clock (all breakpoints) —— */
.hr-login-top-brand {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-top {
  background-image: url('../../HR.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.logo-wrapper {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.12);
  z-index: 0;
  pointer-events: none;
}

.logo-top {
  position: relative;
  z-index: 1;
}

.time-display {
  color: #fff;
  line-height: 1.2;
}

.time-display .time,
.time-display .date {
  display: block;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

header.hr-login-top {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  box-sizing: border-box;
  margin: 0;
  border: 0;
  background: transparent;
  min-height: 0;
  height: auto;
  line-height: 1.15;
}

.hr-login-shell {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 1rem 5.5rem;
  box-sizing: border-box;
}

.hr-login-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.hr-login-hero {
  text-align: center;
  margin-bottom: 1.25rem;
}

.hr-login-hero .login-title {
  position: static !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  white-space: normal !important;
  margin: 0;
  padding: 0;
}

.hr-login-panel.window.card,
.hr-login-panel .card-body {
  overflow: visible;
}

.hr-login-section-title {
  text-align: center;
  font-weight: 700;
  margin: 0 0 1rem;
}

.hr-login-panel.window.card {
  width: 100%;
}

.hr-login-fields .form-floating-wrapper,
.hr-login-fields .floating-input {
  width: 100%;
}

.hr-login-page .floating-input {
  font-size: 16px;
}

.hr-login-page .btn-submit,
.hr-login-page .btn[type="submit"] {
  min-height: 48px;
}

.hr-login-page input:focus,
.hr-login-page textarea:focus,
.hr-login-page select:focus {
  scroll-margin-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Saved user card */
.hr-profile-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.hr-profile-avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #e72027, #c92a30);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(231, 32, 39, 0.28);
}

.hr-profile-avatar .ion {
  font-size: 36px;
  color: #fff;
}

.hr-profile-body {
  flex: 1;
  min-width: 0;
}

.hr-profile-name {
  margin: 0 0 4px;
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  word-break: break-word;
}

.hr-profile-meta {
  margin: 0 0 4px;
  font-size: 0.75rem;
  color: #5c5c5c;
  line-height: 1.4;
}

.hr-profile-label {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  color: #888;
}

.hr-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.hr-profile-actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px !important;
  font-size: 0.8125rem !important;
}

.hr-profile-login-btn {
  margin-top: 4px;
}

#formLogin.hr-login--profile .hr-login-section-title {
  display: none;
}

/* —— Mobile: clean stacked layout —— */
@media (max-width: 767.98px) {
  body.hr-login-body {
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .hr-login-page {
    min-height: 100dvh;
  }

  header.hr-login-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px 14px;
  }

  .hr-login-top-brand {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .logo-wrapper {
    display: block;
    inset: -3px;
    border-radius: 12px;
  }

  .logo-top {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 11px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }

  .time-display {
    position: static !important;
    top: auto !important;
    right: auto !important;
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 54px);
    text-align: right;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    line-height: 1.2;
  }

  .time-display .time {
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    margin: 0 !important;
    padding: 0;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .time-display .date {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;
    margin: 0 !important;
    padding: 0;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .hr-login-shell {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.15rem 16px max(4.5rem, calc(env(safe-area-inset-bottom) + 3.5rem));
    min-height: 0 !important;
  }

  .hr-login-container {
    max-width: 100%;
    padding: 0;
  }

  .hr-login-hero {
    margin-bottom: 0.65rem;
    padding-top: 0;
  }

  .hr-login-hero .login-title-main {
    font-size: 1.125rem;
    line-height: 1.3;
    letter-spacing: 0.02em;
  }

  .hr-login-hero .login-title-hr {
    font-size: 1.125rem;
  }

  .hr-login-hero .login-title-sub {
    font-size: 0.75rem;
    margin-top: 0.2rem;
    line-height: 1.45;
    opacity: 0.92;
  }

  .hr-login-panel.window.card {
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
  }

  .hr-login-panel.window.card .card-body {
    padding: 0 !important;
  }

  .hr-login-section-title {
    color: #fff !important;
    font-size: 1rem;
    margin-bottom: 0.85rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  }

  .hr-login-fields .text-muted,
  .hr-login-fields .small,
  .hr-login-fields #hrShopSummary {
    color: rgba(255, 255, 255, 0.9) !important;
  }

  .hr-login-fields #btnHrBackTb {
    color: #ffebee !important;
    font-size: 0.875rem;
  }

  .hr-login-fields .floating-input {
    background: #fff;
    border-color: #e5e7eb;
    border-radius: 12px;
    min-height: 54px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  }

  .hr-login-page .btn-submit,
  .hr-login-page .btn[type="submit"] {
    min-height: 52px;
    border-radius: 12px !important;
    font-size: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  }

  .hr-profile-card {
    margin-bottom: 14px;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  }

  .hr-profile-login-btn {
    border-radius: 12px !important;
  }

  .footer-copyright {
    font-size: 11px;
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: rgba(96, 20, 16, 0.5);
    line-height: 1.4;
  }

  .contact-admin {
    bottom: max(3.25rem, calc(env(safe-area-inset-bottom) + 2.75rem));
    right: 14px;
  }

  .contact-admin-btn {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
  }

  .contact-admin-btn i {
    font-size: 28px;
  }

  .md-dialog {
    width: min(92vw, 320px);
  }

  .md-toast-container {
    padding-top: env(safe-area-inset-top);
  }
}

/* Tablet: compact top bar (not desktop-large clock) */
@media (min-width: 768px) and (max-width: 991.98px) {
  header.hr-login-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-height: 52px;
    padding: max(8px, env(safe-area-inset-top)) 20px 8px;
    pointer-events: auto;
    position: relative;
    inset: auto;
    height: auto;
  }

  .hr-login-top-brand {
    width: 40px;
    height: 40px;
  }

  .logo-top {
    border-radius: 10px;
  }

  .time-display {
    position: static !important;
    text-align: right;
    max-width: 60%;
  }

  .time-display .time {
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin-bottom: 2px !important;
  }

  .time-display .date {
    font-size: 0.6875rem !important;
  }
}

@media (min-width: 992px) {
  .hr-login-top {
    position: fixed;
    inset: 0;
    pointer-events: none;
    height: 0;
    overflow: visible;
  }

  .hr-login-top-brand,
  .time-display {
    pointer-events: auto;
  }

  .hr-login-top-brand {
    position: fixed;
    top: max(24px, env(safe-area-inset-top));
    left: max(28px, env(safe-area-inset-left));
    width: clamp(80px, 8vw, 100px);
    height: clamp(80px, 8vw, 100px);
    z-index: 1001;
  }

  .logo-wrapper {
    display: block;
    inset: -6px;
    border-radius: 50%;
  }

  .logo-top {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  }

  .time-display {
    position: fixed !important;
    top: max(32px, env(safe-area-inset-top));
    right: max(28px, env(safe-area-inset-right));
    left: auto !important;
    z-index: 1000;
    text-align: right;
    max-width: min(50vw, 420px);
  }

  .time-display .time {
    font-size: clamp(2.5rem, 5vw, 4.25rem) !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    margin-bottom: 6px !important;
    white-space: nowrap;
  }

  .time-display .date {
    font-size: clamp(0.9rem, 1.5vw, 1.25rem) !important;
    font-weight: 500 !important;
    white-space: nowrap;
  }

  .hr-login-shell {
    padding: 2rem 1.5rem 6rem;
  }

  #formLogin {
    position: relative;
    padding-top: 0;
  }

  .hr-login-hero {
    display: block;
    position: absolute;
    top: -115px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 3rem);
    margin: 0;
    z-index: 2;
    pointer-events: none;
  }

  .hr-login-hero .login-title {
    white-space: nowrap;
  }

  .hr-login-section-title {
    color: #2c3e50;
  }

  .hr-profile-card {
    background: linear-gradient(90deg, rgba(231, 32, 39, 0.08) 0%, rgba(231, 32, 39, 0.03) 100%);
    box-shadow: none;
    border: 1px solid rgba(231, 32, 39, 0.12);
  }
}

/* ຈໍສັ້ນ / ແนวນອນ */
@media (max-width: 767.98px) and (max-height: 520px) {
  header.hr-login-top {
    min-height: 40px;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .hr-login-top-brand {
    width: 36px;
    height: 36px;
  }

  .time-display .time {
    font-size: 0.875rem !important;
  }

  .time-display .date {
    font-size: 0.6875rem !important;
  }

  .hr-login-hero {
    margin-bottom: 0.5rem;
  }

  .hr-login-hero .login-title-main,
  .hr-login-hero .login-title-hr {
    font-size: 1.05rem;
  }
}

@media (max-width: 380px) {
  .hr-login-top-brand {
    width: 40px;
    height: 40px;
  }

  .time-display {
    max-width: calc(100% - 50px);
  }

  .time-display .time {
    font-size: 0.9375rem !important;
  }

  .time-display .date {
    font-size: 0.6875rem !important;
  }
}
