:root {
  --primary: #00b2a7;
  --primary-2: #00d6c9;
  --primary-dark: #00857c;
  --ink: #003330;
  --ink-2: #006660;
  --accent: #8ffff8;
  --accent-2: #ccfffc;
  --bg: #f4f9fb;
  --sidebar-w: 280px;
  --text: #16232b;
  --muted: #64748b;
  --white: #ffffff;
  --border: #e2eef3;
  --radius-lg: 26px;
  --radius-xl: 30px;
  --shadow-soft: 0 10px 30px rgba(0, 51, 48, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 51, 48, 0.14);
}

* {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html {
  scroll-behavior: smooth;
  zoom: 0.9;
}

body {
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  color: var(--text);
}

h1,
h2,
h3,
h4,
h5,
h6,
.dashboard-title,
.table-card-title,
.stat-card-modern h3 {
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 178, 167, 0.35);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 178, 167, 0.55);
}

/* ==================== Keyframes ==================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes floatSlow {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-16px, 18px) scale(1.06);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes floatSlowReverse {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(18px, -14px) scale(1.07);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(10px, -14px) rotate(8deg);
  }
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 178, 167, 0.35);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(0, 178, 167, 0);
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes preloaderGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 8px rgba(0, 178, 167, 0.35));
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(0, 178, 167, 0.65));
  }
}

/* ==================== Preloader ==================== */

#page-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(51, 51, 51, 0.3);
  backdrop-filter: blur(3px);
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
  opacity: 1;
  visibility: visible;
}

#page-preloader.preloader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preloader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(0, 178, 167, 0.15);
  border-top-color: var(--primary, #00b2a7);
  border-right-color: var(--primary-2, #00d6c9);
  animation: spinSlow 1s linear infinite;
}

.preloader-logo {
  width: 150px;
  height: 150px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  animation: preloaderGlow 1.8s ease-in-out infinite;
}

/* ==================== Login ==================== */

.login-body {
  min-height: 100vh;
  background: linear-gradient(160deg, #ffffff 0%, #eef8fb 55%, #e6f4f8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.login-body::before,
.login-body::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(6px);
  opacity: 0.4;
  z-index: 0;
}

.login-body::before {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(0, 178, 167, 0.4), transparent 70%);
  top: -140px;
  left: -120px;
  animation: floatSlow 15s ease-in-out infinite;
}

.login-body::after {
  width: 360px;
  height: 360px;
  background: radial-gradient(
    circle,
    rgba(143, 255, 248, 0.4),
    transparent 70%
  );
  bottom: -130px;
  right: -100px;
  animation: floatSlowReverse 17s ease-in-out infinite;
}

.login-wrapper {
  width: 100%;
  max-width: 1100px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 600px;
  animation: fadeInUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow:
    var(--shadow-lg),
    0 2px 0 rgba(0, 178, 167, 0.08);
}

.login-left {
  background: linear-gradient(
    120deg,
    var(--ink) 0%,
    var(--ink-2) 45%,
    var(--primary) 85%,
    var(--accent) 140%
  );
  background-size: 220% 220%;
  animation: gradientShift 18s ease infinite;
  color: white;
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.14) 1.5px,
    transparent 1.5px
  );
  background-size: 24px 24px;
  opacity: 0.45;
  pointer-events: none;
}

.login-left-orbits {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-left-orbits .orbit {
  position: absolute;
  color: rgba(255, 255, 255, 0.16);
  font-size: 46px;
}

.orbit-1 {
  top: 10%;
  right: 14%;
  font-size: 54px;
  animation: drift 9s ease-in-out infinite;
}
.orbit-2 {
  top: 62%;
  right: 8%;
  animation: drift 11s ease-in-out infinite 1s;
}
.orbit-3 {
  top: 32%;
  right: 30%;
  font-size: 34px;
  animation: drift 8s ease-in-out infinite 0.5s;
}
.orbit-4 {
  top: 78%;
  right: 34%;
  font-size: 30px;
  animation: drift 10s ease-in-out infinite 1.5s;
}

.login-left .brand-box {
  position: relative;
  z-index: 1;
}

.login-left .brand-footer {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 16px;
}

.brand-icon,
.brand-mini {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  animation:
    breathe 5s ease-in-out infinite,
    glowPulse 3.5s ease-in-out infinite;
}

.brand-mini {
  box-shadow: 0 6px 18px rgba(0, 178, 167, 0.18);
}

.brand-icon img,
.brand-mini img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-box h1 {
  font-weight: 800;
  font-size: 2rem;
  max-width: 480px;
  margin-top: 26px;
  margin-bottom: 14px;
  line-height: 1.2;
  animation: fadeInUp 0.7s ease 0.1s both;
}

.brand-box p {
  color: rgba(255, 255, 255, 0.85);
  max-width: 480px;
  animation: fadeInUp 0.7s ease 0.2s both;
  margin-bottom: 22px;
}

.brand-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeInUp 0.7s ease 0.3s both;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.92);
}

.brand-features i {
  color: var(--accent-2);
  font-size: 1.05rem;
}

.login-right {
  padding: 52px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fadeInUp 0.7s ease 0.15s both;
}

.login-right-head h4 {
  font-weight: 800;
  margin-bottom: 4px;
  font-size: 1.5rem;
}

.login-right-head p {
  color: var(--muted);
  margin-bottom: 22px;
}

.alert-dev-mode {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff8e6;
  border: 1px solid #f6e2a8;
  color: #8a6d1a;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.alert-dev-mode i {
  font-size: 1.05rem;
  margin-top: 1px;
  color: #c99a1f;
}

.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-group i {
  position: absolute;
  left: 16px;
  color: var(--primary);
  font-size: 1.05rem;
  z-index: 2;
  pointer-events: none;
}

.input-icon-group .form-control,
.input-icon-group .form-select {
  padding-left: 44px;
}

.form-control,
.form-select {
  border-radius: 14px;
  border-color: var(--border);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(0, 178, 167, 0.16);
}

.btn {
  border-radius: 14px;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    filter 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover,
.btn-primary:focus {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 178, 167, 0.32);
}

/* ==================== App shell ==================== */

.app-body {
  background: var(--bg);
  min-height: 100vh;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(
    165deg,
    var(--ink) 0%,
    var(--ink-2) 55%,
    #009990 100%
  );
  color: white;
  padding: 26px 20px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 15;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-toggle {
  position: fixed;
  top: 20px;
  left: calc(var(--sidebar-w) + 18px);
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition:
    left 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.sidebar-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.sidebar-toggle i {
  font-size: 1.15rem;
}

body.sidebar-collapsed .sidebar-toggle {
  left: 18px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 24, 0.5);
  z-index: 12;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.sidebar-top {
  flex: 1 1 auto;
}

.sidebar-bottom {
  flex-shrink: 0;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar::before,
.sidebar::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}

.sidebar::before {
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  top: -60px;
  left: -80px;
  animation: floatSlow 14s ease-in-out infinite;
}

.sidebar::after {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--primary-2), transparent 70%);
  bottom: 60px;
  right: -90px;
  animation: floatSlowReverse 16s ease-in-out infinite;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  animation: fadeInUp 0.5s ease both;
}

.sidebar-brand .brand-mini {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: none;
  animation: none;
  width: 50px;
  height: 50px;
  border-radius: 15px;
}

.sidebar-brand strong {
  color: white !important;
  font-weight: 700;
}

.sidebar-brand small {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.user-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  margin-bottom: 20px;
  transition: background-color 0.2s ease;
  animation: fadeInUp 0.55s ease 0.05s both;
}

.user-panel:hover {
  background: rgba(255, 255, 255, 0.12);
}

.user-panel .avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-2), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--ink);
}

.user-panel strong {
  color: white;
  font-size: 13.5px;
  line-height: 1.3;
}

.user-panel small {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11.5px;
  line-height: 1.4;
}

.sidebar-section-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  margin: 4px 4px 10px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-menu a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease,
    padding-left 0.2s ease;
  position: relative;
  animation: fadeInUp 0.5s ease both;
}

.sidebar-menu a i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding-left: 18px;
}

.sidebar-menu a.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(0, 214, 201, 0.28);
}

.app-main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .app-main {
  margin-left: 0;
  width: 100%;
}

.btn-logout-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fda4af;
  font-weight: 600;
  font-size: 13.5px;
  padding: 11px 16px;
  border-radius: 14px;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.btn-logout-sidebar i {
  font-size: 1.05rem;
}

.btn-logout-sidebar:hover {
  background: #e11d48;
  border-color: #e11d48;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(225, 29, 72, 0.28);
}

.content-wrapper {
  padding: 30px;
  flex: 1;
  animation: fadeInUp 0.45s ease both;
}

.modern-card,
.stat-card {
  border: 0;
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s ease;
}

.modern-card:hover,
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card {
  padding: 24px;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.stat-card h3 {
  margin: 8px 0;
  font-weight: 800;
}

.stat-card small {
  color: var(--muted);
}

.app-footer {
  padding: 18px 30px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 992px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-left {
    min-height: 300px;
  }

  .sidebar {
    width: min(var(--sidebar-w), 82vw);
    transform: translateX(-100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .sidebar-toggle,
  body.sidebar-collapsed .sidebar-toggle {
    left: 18px;
  }

  .app-main,
  body.sidebar-collapsed .app-main {
    margin-left: 0;
    width: 100%;
  }

  .stat-icon.primary {
    background: rgba(0, 178, 167, 0.12);
    color: var(--primary);
  }

  .status-pill.status-secondary {
    background: #f1f5f9;
    color: #475569;
  }
}
