/* Mobile layout and chat status rules loaded before studio boot modules. */
:root {
  --app-height: 100vh;
  --app-height-small: 100svh;
  --app-height-dynamic: 100dvh;
  --safe-area-top: env(safe-area-inset-top, 0);
  --safe-area-bottom: env(safe-area-inset-bottom, 0);
  --safe-area-left: env(safe-area-inset-left, 0);
  --safe-area-right: env(safe-area-inset-right, 0);
}

@supports (height: 100svh) {
  @media (max-width: 768px) {
    html,
    body {
      height: 100svh;
      overflow: hidden;
    }

    .main-content {
      height: 100svh;
    }

    .chat-container {
      height: calc(100svh - 50px);
    }
  }
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  font-size: 16px !important;
  transform: translateZ(0);
}

html,
body {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
}

@media (max-width: 768px) {
  .main-content {
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .chat-container {
    height: calc(100vh - 50px);
    height: calc(100svh - 50px);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 90px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .input-section {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 2200 !important;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    background: rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
  }

  body.input-focused {
    position: fixed;
    width: 100%;
    overflow: hidden;
  }

  body.input-focused .input-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2200;
  }

  .tips-modal,
  .tips-modal.show {
    z-index: 50 !important;
  }

  .tips-modal-content,
  .tips-modal-content.expanded {
    z-index: 1 !important;
  }

  body.tips-open .input-section {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0) !important;
    border-top: 1px solid transparent !important;
  }

  body.tips-open .input-section:focus-within {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(20, 20, 20, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  body.tips-open .input-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    z-index: 2200 !important;
  }

  body.tips-open.input-focused .input-section {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 2200 !important;
    transform: none !important;
    background: rgba(20, 20, 20, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  body.input-focused .chat-messages {
    max-height: calc(100svh - 140px);
    padding-bottom: 20px;
  }
}

.chat-loader {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: #aaa;
}

.chat-batch-marker {
  text-align: center;
  font-size: 12px;
  color: #777;
  margin: 10px 0;
}

.multimodal-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #4CAF50;
  margin-left: 10px;
  padding: 2px 6px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.multimodal-status.limited {
  color: #FF9800;
  background: rgba(255, 152, 0, 0.1);
  border-color: rgba(255, 152, 0, 0.3);
}

.multimodal-status.disabled {
  color: #f44336;
  background: rgba(244, 67, 54, 0.1);
  border-color: rgba(244, 67, 54, 0.3);
}

.status-indicator {
  font-size: 14px;
}

.status-text {
  font-weight: 500;
}
