/* ============================================
   WhatsApp Chat Reader — Layout
   Base layout, screen system, transitions
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.4;
}

/* Desktop wrapper background */
.desktop-bg {
  display: none;
}

/* Main app shell */
#app-container {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* ---- Screen System ---- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: none;
  flex-direction: column;
  background-color: var(--bg-primary);
}

.screen.active {
  display: flex;
}

/* Screen transition animations */
@keyframes screenSlideInRight {
  from {
    transform: translateX(100%);
    opacity: 0.8;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes screenSlideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-30%);
    opacity: 0.6;
  }
}

@keyframes screenSlideInLeft {
  from {
    transform: translateX(-30%);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes screenSlideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0.8;
  }
}

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

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

.screen.slide-in-right {
  animation: screenSlideInRight var(--transition-spring) forwards;
}

.screen.slide-out-left {
  animation: screenSlideOutLeft var(--transition-spring) forwards;
}

.screen.slide-in-left {
  animation: screenSlideInLeft var(--transition-spring) forwards;
}

.screen.slide-out-right {
  animation: screenSlideOutRight var(--transition-spring) forwards;
}

.screen.fade-in {
  animation: fadeIn var(--transition-base) forwards;
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* ---- Utility Classes ---- */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.no-select {
  -webkit-user-select: none;
  user-select: none;
}

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