/* =========================================================
   BJMP9 HEALTH INFORMATION SYSTEM
   GLOBAL / SHARED STYLES
========================================================= */

/* =========================================================
   BJMP9 HIS THEME VARIABLES
========================================================= */
:root {
  color-scheme: dark;

  --app-bg: #07111f;
  --app-surface: #0b1730;
  --app-surface-soft: #0f172a;

  --app-text: #f8fafc;
  --app-text-secondary: #94a3b8;
  --app-text-muted: #64748b;

  --app-border: rgba(96, 165, 250, 0.12);

  --app-accent: #60a5fa;
}

/* =========================================================
   LIGHT THEME
========================================================= */
html[data-theme="light"] {
  color-scheme: light;

  --app-bg: #f1f5f9;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafc;

  --app-text: #0f172a;
  --app-text-secondary: #475569;
  --app-text-muted: #64748b;

  --app-border: rgba(15, 23, 42, 0.12);

  --app-accent: #2563eb;
}

/* =========================================================
   GLOBAL THEME APPLICATION
========================================================= */

html,
body {
  background-color: var(--app-bg);
  color: var(--app-text);
}

body {
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

/* =========================================================
   BUTTON BASE ANIMATION
========================================================= */

button,
.btn {
  transition:
    transform 0.22s ease,
    background-color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    color 0.22s ease,
    opacity 0.22s ease;
}

/* Prevent disabled buttons from animating */
button:disabled,
.btn.disabled {
  cursor: not-allowed;
  transform: none !important;
}

/* =========================================================
   STANDARD PAGE BUTTON
========================================================= */

.btn,
.action-btn,
.submit-btn,
.save-btn,
.back-btn,
.change-password-btn,
.back-dashboard-btn {
  position: relative;
  overflow: hidden;
}

/* Hover */
.btn:not(.disabled):hover,
.action-btn:not(:disabled):hover,
.submit-btn:not(:disabled):hover,
.save-btn:not(:disabled):hover,
.back-btn:not(:disabled):hover,
.change-password-btn:not(:disabled):hover,
.back-dashboard-btn:not(:disabled):hover {
  transform: translateY(-3px) scale(1.015);

  box-shadow: 0 10px 25px rgba(33, 150, 243, 0.2);
}

/* Click */
.btn:not(.disabled):active,
.action-btn:not(:disabled):active,
.submit-btn:not(:disabled):active,
.save-btn:not(:disabled):active,
.back-btn:not(:disabled):active,
.change-password-btn:not(:disabled):active,
.back-dashboard-btn:not(:disabled):active {
  transform: translateY(0) scale(0.97);

  transition-duration: 0.08s;
}

/* =========================================================
   SHINE EFFECT
   Use class="button-shine" on larger buttons
========================================================= */

.button-shine {
  position: relative;
  overflow: hidden;
}

.button-shine::before {
  content: "";

  position: absolute;

  top: 0;
  left: -120%;

  width: 65%;
  height: 100%;

  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );

  transform: skewX(-20deg);

  pointer-events: none;

  transition: left 0.55s ease;
}

.button-shine:hover::before {
  left: 140%;
}

/* =========================================================
   SIDEBAR NAVIGATION
========================================================= */

.menu-button,
.nav-button,
.submenu button {
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.menu-button:hover,
.nav-button:hover,
.submenu button:hover {
  transform: translateX(4px);
}

.menu-button:active,
.nav-button:active,
.submenu button:active {
  transform: translateX(2px) scale(0.98);

  transition-duration: 0.08s;
}

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

.logout-button {
  transition:
    transform 0.22s ease,
    background-color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    color 0.22s ease;
}

.logout-button:hover {
  transform: translateY(-2px);

  background: rgba(239, 68, 68, 0.16);

  border-color: rgba(239, 68, 68, 0.45);

  color: #fecaca;

  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.14);
}

.logout-button:active {
  transform: translateY(0) scale(0.97);

  transition-duration: 0.08s;
}

/* =========================================================
   USER MANAGEMENT ACTION BUTTONS
========================================================= */

.icon-btn {
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.icon-btn:hover {
  transform: translateY(-2px) scale(1.08);
}

.icon-btn:active {
  transform: scale(0.92);

  transition-duration: 0.07s;
}

/* Save */
.icon-btn.save:hover {
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.35);
}

/* Delete */
.icon-btn.delete:hover {
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
}

/* =========================================================
   MODAL BUTTONS
========================================================= */

.modal-cancel,
.modal-delete {
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.modal-cancel:hover,
.modal-delete:hover {
  transform: translateY(-2px);
}

.modal-cancel:active,
.modal-delete:active {
  transform: scale(0.96);

  transition-duration: 0.07s;
}

.modal-delete:hover {
  box-shadow: 0 7px 20px rgba(239, 68, 68, 0.2);
}

/* =========================================================
   ACCESSIBILITY
========================================================= */

button:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible,
.nav-button:focus-visible,
.menu-button:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.85);

  outline-offset: 2px;
}

/* =========================================================
   GLOBAL SYSTEM LOADING OVERLAY
   ========================================================= */

#globalLoader {
  position: fixed;
  inset: 0;
  z-index: 999999;

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

  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

#globalLoader.show {
  opacity: 1;
  visibility: visible;
}

.loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;

  padding: 26px 34px;
  border-radius: 20px;

  background: rgba(11, 23, 48, 0.92);
  border: 1px solid rgba(59, 130, 246, 0.3);

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.45),
    0 0 30px rgba(59, 130, 246, 0.12);
}

.modern-spinner {
  width: 52px;
  height: 52px;

  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: #3b82f6;
  border-right-color: #60a5fa;

  border-radius: 50%;

  animation: modernSpin 1.1s linear infinite;
}

.loader-text {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.loader-subtext {
  margin-top: -10px;
  color: #94a3b8;
  font-size: 11px;
}

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

/* =========================================================
   REDUCED MOTION
========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;

    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;

    scroll-behavior: auto !important;
  }
}

/* =========================================================
   COLLAPSED SIDEBAR — PAGE CONTENT
========================================================= */

html {
  --sidebar-width: 250px;
}

html.sidebar-is-collapsed {
  --sidebar-width: 78px;
}

.page-main {
  transition:
    margin-left 0.3s ease,
    width 0.3s ease;
}

html.sidebar-is-collapsed .page-main {
  margin-left: 78px !important;
  width: calc(100% - 78px) !important;
}
