/* Shared mobile shell — drawer sidebar + safe areas */
:root {
  --s2-sidebar-width: 300px;
  --s2-header-height: 52px;
  --s2-accent: #00bcd4;
  --s2-accent-2: #4caf50;
}

.s2-app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  min-height: 0;
}

.s2-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--s2-header-height) + env(safe-area-inset-top, 0));
  padding: env(safe-area-inset-top, 0) 0.75rem 0;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.96);
  border-bottom: 1px solid var(--s2-accent);
  z-index: 1100;
}

.s2-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--s2-accent);
  border-radius: 10px;
  background: rgba(0, 188, 212, 0.2);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1101;
}

.s2-menu-toggle:focus-visible {
  outline: 2px solid var(--s2-accent-2);
  outline-offset: 2px;
}

.s2-mobile-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--s2-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.s2-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.s2-sidebar {
  width: var(--s2-sidebar-width);
  max-width: 100%;
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.s2-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.s2-sidebar-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .s2-mobile-header {
    display: flex;
  }

  .s2-app-shell {
    flex-direction: column;
    padding-top: calc(var(--s2-header-height) + env(safe-area-inset-top, 0));
  }

  .s2-sidebar {
    position: fixed;
    top: calc(var(--s2-header-height) + env(safe-area-inset-top, 0));
    left: 0;
    bottom: 0;
    width: min(var(--s2-sidebar-width), 100vw);
    max-width: 100vw;
    z-index: 1060;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.97);
    visibility: hidden;
  }

  .s2-sidebar-backdrop {
    display: block;
  }

  body.s2-sidebar-open .s2-sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  body.s2-sidebar-open .s2-sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }

  .s2-main {
    flex: 1;
    min-height: 0;
  }

  .message {
    max-width: 95% !important;
  }

  .chat-input {
    flex-wrap: wrap;
  }

  .chat-input input {
    font-size: 16px;
    min-width: 0;
  }

  .chat-input button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  :root {
    --s2-sidebar-width: 100vw;
  }
}
