/* ============================================
   Messliner — Base Styles (base.css)
   ============================================ */

/* ---- Modern Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: auto;
  font-size: 16px;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  overscroll-behavior-x: none;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-y: none;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

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

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--font-3xl);
}

h2 {
  font-size: var(--font-2xl);
}

h3 {
  font-size: var(--font-xl);
}

h4 {
  font-size: var(--font-lg);
}

h5 {
  font-size: var(--font-md);
}

h6 {
  font-size: var(--font-base);
}

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ---- Scrollbar (Desktop: 6px Sleek & Visible | Mobile: Completely Hidden) ---- */
@media (min-width: 1024px) {
  ::-webkit-scrollbar,
  .content-area::-webkit-scrollbar,
  body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    display: block;
  }

  ::-webkit-scrollbar-button,
  .content-area::-webkit-scrollbar-button,
  body::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
  }

  ::-webkit-scrollbar-track,
  .content-area::-webkit-scrollbar-track,
  body::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 9999px;
  }

  ::-webkit-scrollbar-thumb,
  .content-area::-webkit-scrollbar-thumb,
  body::-webkit-scrollbar-thumb {
    background: #6EE7B7;
    border-radius: 9999px;
  }

  ::-webkit-scrollbar-thumb:hover,
  .content-area::-webkit-scrollbar-thumb:hover,
  body::-webkit-scrollbar-thumb:hover {
    background: #34D399;
  }

  ::-webkit-scrollbar-thumb:active,
  .content-area::-webkit-scrollbar-thumb:active,
  body::-webkit-scrollbar-thumb:active {
    background: #10B981;
  }

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

  body.dark-theme ::-webkit-scrollbar-track,
  body.dark-theme .content-area::-webkit-scrollbar-track {
    background: #0F172A;
  }

  body.dark-theme ::-webkit-scrollbar-thumb,
  body.dark-theme .content-area::-webkit-scrollbar-thumb {
    background: rgba(110, 231, 183, 0.45);
  }

  body.dark-theme ::-webkit-scrollbar-thumb:hover,
  body.dark-theme .content-area::-webkit-scrollbar-thumb:hover {
    background: #6EE7B7;
  }

  /* Firefox-only support */
  @-moz-document url-prefix() {
    * {
      scrollbar-width: thin;
      scrollbar-color: #6EE7B7 #F1F5F9;
    }

    body.dark-theme * {
      scrollbar-color: rgba(110, 231, 183, 0.45) #0F172A;
    }
  }
}

@media (max-width: 1023px) {

  *::-webkit-scrollbar,
  ::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
  }

  *::-webkit-scrollbar-thumb,
  ::-webkit-scrollbar-thumb,
  *::-webkit-scrollbar-track,
  ::-webkit-scrollbar-track {
    display: none !important;
    background: transparent !important;
  }

  html,
  body,
  * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
}

/* ---- Selection ---- */
::selection {
  background: var(--primary-100);
  color: var(--primary-900);
}

/* ---- Focus Visible ---- */
:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Layout Utilities ---- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

.grid {
  display: grid;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.hidden {
  display: none !important;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

.text-center {
  text-align: center !important;
}

.text-right {
  text-align: right !important;
}

.text-left {
  text-align: left !important;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-3 {
  margin-top: var(--space-3);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mt-8 {
  margin-top: var(--space-8);
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.p-2 {
  padding: var(--space-2);
}

.p-3 {
  padding: var(--space-3);
}

.p-4 {
  padding: var(--space-4);
}

.p-6 {
  padding: var(--space-6);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.py-2 {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

/* ---- Skeleton Loading ---- */
.skeleton {
  background: linear-gradient(90deg,
      var(--gray-200) 25%,
      var(--gray-100) 50%,
      var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ---- Fade Animations ---- */
.fade-in {
  animation: fadeIn var(--transition-slow) ease forwards;
}

.fade-up {
  animation: fadeUp var(--transition-slow) ease forwards;
}

.slide-up {
  animation: slideUp var(--transition-slow) cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.scale-in {
  animation: scaleIn var(--transition-base) ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---- Staggered Animation Delays ---- */
.stagger-1 {
  animation-delay: 50ms;
}

.stagger-2 {
  animation-delay: 100ms;
}

.stagger-3 {
  animation-delay: 150ms;
}

.stagger-4 {
  animation-delay: 200ms;
}

.stagger-5 {
  animation-delay: 250ms;
}

.stagger-6 {
  animation-delay: 300ms;
}

/* ---- Spin Animation ---- */
.spin {
  animation: spin 1s linear infinite;
}

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

/* ---- Pulse Animation ---- */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ---- Screen Reader Only ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ---- Page Section Base ---- */
.page-section {
  display: none;
  padding: var(--space-6);
  max-width: var(--max-content-width);
  margin: 0 auto;
}

.page-section.active {
  display: block !important;
  opacity: 1 !important;
}

.page-section.active.slide-forward {
  animation: tabSlideForward 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.page-section.active.slide-backward {
  animation: tabSlideBackward 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

.page-section.active.slide-fade {
  animation: tabSlideFade 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
}

@keyframes tabSlideForward {
  0% {
    opacity: 0.15;
    transform: translate3d(22px, 0, 0);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tabSlideBackward {
  0% {
    opacity: 0.15;
    transform: translate3d(-22px, 0, 0);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tabSlideFade {
  0% {
    opacity: 0.18;
    transform: scale(0.992);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---- Page Header ---- */
.page-header {
  margin-bottom: var(--space-6);
}

.page-header h2 {
  font-size: var(--font-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.page-header p {
  font-size: var(--font-base);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-6) 0;
  border: none;
}

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}