/* ============================================
   Base Reset & Foundation
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100vh;
  height: -webkit-fill-available;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg-app);
  color: var(--color-gray-900);
  font-size: 16px;
  line-height: 1.5;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

/* ---- Interactive Elements ---- */
button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0;
  line-height: inherit;
}

input, textarea, select {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  color: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol { list-style: none; }

img {
  max-width: 100%;
  height: auto;
  display: block;
  -webkit-user-drag: none;
}

/* ---- Text Selection ---- */
::selection {
  background: rgba(7, 193, 96, 0.2);
  color: inherit;
}

/* ---- Focus ---- */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

/* ---- Scrollbar (thin, unobtrusive) ---- */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
  }
}

/* ---- Selectable Content ---- */
.selectable,
input, textarea,
.text-message, .message-content,
.file-name, .file-size, .file-details,
.message-meta, .message-time {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

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