/* ==========================================================================
   Telegram Web Responsive UI Styling
   ========================================================================== */

:root {
  --tg-primary: #2481cc;
  --tg-primary-hover: #1c73b9;
  --tg-primary-light: #e3f2fd;
  --tg-accent: #2aabee;
  
  --tg-bg-page: #0f141c;
  --tg-bg-sidebar: #ffffff;
  --tg-bg-chat: #86a789;
  --tg-chat-pattern: url('data:image/svg+xml;utf8,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M10 20 Q 30 10 50 30 T 90 20" fill="none" stroke="rgba(255,255,255,0.06)" stroke-width="2"/><circle cx="80" cy="70" r="10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="2"/><path d="M30 70 L50 80 L70 65" fill="none" stroke="rgba(255,255,255,0.06)" stroke-width="2"/></svg>');
  
  --tg-bubble-in: #ffffff;
  --tg-bubble-in-border: #e6ebed;
  --tg-bubble-out: #effdde;
  --tg-bubble-out-border: #c8e6c9;
  
  --tg-text-main: #222222;
  --tg-text-muted: #707579;
  --tg-text-time: #a0aab3;
  --tg-border: #dfe1e5;
  --tg-danger: #e53935;
  --tg-success: #43a047;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --border-radius-bubble: 16px;
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-bubble: 0 1px 2px rgba(16, 35, 47, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--tg-bg-page);
  color: var(--tg-text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-size: 14.5px;
  line-height: 1.45;
}

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

.icon-button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-text-muted);
  border-radius: 50%;
  padding: 8px;
  transition: background-color 0.15s, color 0.15s;
}

.icon-button:hover {
  background-color: rgba(0, 0, 0, 0.06);
  color: var(--tg-primary);
}

.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #ffffff;
  user-select: none;
}

.avatar-bot {
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.login-avatar-img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  border: 3px solid #ffffff;
  display: inline-block;
}

.avatar-md {
  width: 44px;
  height: 44px;
  font-size: 18px;
  background-color: var(--tg-primary);
}

.btn-primary {
  background-color: var(--tg-primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background-color: var(--tg-primary-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #f1f3f4;
  color: var(--tg-text-main);
  border: 1px solid var(--tg-border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: #e8eaed;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.4;
}

.alert.error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.alert.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

/* ==========================================================================
   1. HALAMAN LOGIN
   ========================================================================== */
.login-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 16px;
  z-index: 9999;
}

.login-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: fadeInDown 0.3s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  margin-bottom: 16px;
}

.tg-plane-logo {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 6px 12px rgba(36, 129, 204, 0.3));
}

.login-card h2 {
  font-size: 22px;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--tg-text-muted);
  font-size: 13.5px;
  margin-bottom: 24px;
}

.input-group {
  text-align: left;
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #444;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid var(--tg-border);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--tg-primary);
  box-shadow: 0 0 0 3px rgba(36, 129, 204, 0.15);
  background: #ffffff;
}

.input-prefix {
  padding-left: 14px;
  color: var(--tg-text-muted);
  font-weight: 600;
}

.input-wrapper input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--tg-text-main);
}

.btn-toggle-pwd {
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  color: var(--tg-text-muted);
  font-size: 16px;
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 8px;
}

.login-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--tg-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ==========================================================================
   2. APP LAYOUT (TELEGRAM WEB)
   ========================================================================== */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--tg-bg-page);
  position: relative;
  overflow: hidden;
}

/* SIDEBAR KIRI */
.sidebar {
  width: 360px;
  background-color: var(--tg-bg-sidebar);
  border-right: 1px solid var(--tg-border);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: transform 0.25s ease-in-out;
}

.sidebar-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-search {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f1f3f4;
  border-radius: 20px;
  padding: 6px 14px;
  gap: 8px;
}

.sidebar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 100%;
}

.sidebar-search .search-icon {
  color: var(--tg-text-muted);
}

/* USER DROPDOWN */
.user-dropdown {
  position: absolute;
  top: 56px;
  left: 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  width: 250px;
  padding: 8px 0;
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.dropdown-user-info strong {
  display: block;
  font-size: 14px;
  color: #111;
}

.dropdown-user-info small {
  color: var(--tg-text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--tg-border);
  margin: 6px 0;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: none;
  border: none;
  font-size: 14px;
  color: var(--tg-text-main);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s;
}

.dropdown-item:hover {
  background-color: #f1f3f4;
}

.dropdown-item.text-danger {
  color: var(--tg-danger);
}

/* QUICK NAV PILLS */
.quick-nav-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  scrollbar-width: none;
}

.quick-nav-bar::-webkit-scrollbar {
  display: none;
}

.quick-pill {
  white-space: nowrap;
  background: #f1f3f4;
  border: none;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tg-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.quick-pill:hover, .quick-pill.active {
  background: var(--tg-primary-light);
  color: var(--tg-primary);
}

/* CHAT LIST */
.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.15s;
  border-radius: 12px;
  margin: 4px 8px;
}

.chat-list-item:hover {
  background-color: #f4f5f7;
}

.chat-list-item.active {
  background-color: var(--tg-primary);
  color: #ffffff;
}

.chat-list-item.active .chat-item-name,
.chat-list-item.active .chat-item-time,
.chat-list-item.active .chat-item-snippet {
  color: #ffffff;
}

.chat-list-item.active .chat-item-snippet {
  opacity: 0.85;
}

.chat-list-item .avatar-bot {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

.chat-item-title-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chat-item-name {
  font-weight: 600;
  font-size: 14.5px;
  color: #111;
}

.chat-item-time {
  font-size: 12px;
  color: var(--tg-text-time);
}

.chat-item-subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-item-snippet {
  font-size: 13px;
  color: var(--tg-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-badge.online-badge {
  width: 8px;
  height: 8px;
  background-color: #4caf50;
  border-radius: 50%;
  flex-shrink: 0;
}

/* SIDEBAR FOOTER (SESSION WATCHER) */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--tg-border);
  background: #fafafa;
}

.session-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--tg-text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   AREA RUANG CHAT UTAMA
   ========================================================================== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--tg-bg-chat);
  background-image: var(--tg-chat-pattern);
  background-blend-mode: overlay;
  position: relative;
  overflow: hidden;
}

/* CHAT HEADER */
.chat-header {
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  z-index: 5;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
}

.chat-title {
  font-size: 15.5px;
  font-weight: 600;
  color: #111;
}

.chat-status {
  font-size: 12.5px;
  color: var(--tg-text-muted);
}

.mobile-only {
  display: none;
}

/* MESSAGES CONTAINER */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.date-divider {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

.date-divider span {
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
}

/* MESSAGE BUBBLES */
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 78%;
  animation: bubblePop 0.2s ease-out;
}

@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.message-row.bot {
  align-self: flex-start;
}

.message-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.message-bubble {
  padding: 10px 14px 8px 14px;
  border-radius: var(--border-radius-bubble);
  box-shadow: var(--shadow-bubble);
  position: relative;
  word-break: break-word;
  min-width: 90px;
}

.message-row.bot .message-bubble {
  background: var(--tg-bubble-in);
  border-bottom-left-radius: 4px;
  color: var(--tg-text-main);
}

.message-row.user .message-bubble {
  background: var(--tg-bubble-out);
  border-bottom-right-radius: 4px;
  color: #111;
}

.bubble-text {
  font-size: 14.5px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.bubble-text strong {
  font-weight: 600;
}

.bubble-text pre {
  background: #f4f5f7;
  padding: 8px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 13px;
  margin: 6px 0;
  border: 1px solid #e1e4e8;
}

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  float: right;
  margin-left: 12px;
}

.bubble-time {
  font-size: 11px;
  color: var(--tg-text-time);
}

.bubble-check {
  font-size: 12px;
  color: var(--tg-primary);
  letter-spacing: -2px;
}

/* DOCUMENT / ATTACHMENT CARD IN CHAT */
.document-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--tg-border);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.doc-icon {
  width: 40px;
  height: 40px;
  background: #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--tg-primary);
}

.doc-info {
  flex: 1;
  min-width: 0;
}

.doc-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1e293b;
}

.doc-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--tg-primary);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.15s;
}

.doc-btn-download:hover {
  background-color: var(--tg-primary-hover);
}

/* INLINE KEYBOARD */
.inline-keyboard-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  width: 100%;
}

.inline-keyboard-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.tg-inline-btn {
  flex: 1;
  background: #eef3f7;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--tg-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tg-inline-btn:hover {
  background: #e1ebf2;
}

.tg-inline-btn:active {
  background: #d4e2ed;
  transform: scale(0.99);
}

/* TYPING INDICATOR */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 24px;
  align-self: flex-start;
}

.typing-bubble {
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 14px;
  border-radius: 16px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-bubble);
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  background: var(--tg-text-muted);
  border-radius: 50%;
  animation: typing 1s infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.typing-text {
  font-size: 12px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* COMPOSER / INPUT BAR */
.chat-composer {
  background: #ffffff;
  padding: 10px 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  position: relative;
}

.quick-menu-popup {
  position: absolute;
  bottom: 100%;
  left: 18px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 12px;
  margin-bottom: 8px;
  z-index: 20;
  width: 320px;
  animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.quick-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-menu-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: #f8fafc;
  border: 1px solid var(--tg-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-menu-action:hover {
  background: var(--tg-primary-light);
  border-color: var(--tg-primary);
}

.menu-action-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

.menu-action-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tg-text-main);
}

.composer-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #f1f3f4;
  border-radius: 24px;
  padding: 6px 10px;
  transition: box-shadow 0.2s, background-color 0.2s;
}

.composer-bar:focus-within {
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--tg-primary);
}

.composer-icon {
  padding: 8px;
  color: var(--tg-text-muted);
}

.composer-bar textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  max-height: 120px;
  line-height: 1.4;
  padding: 7px 4px;
}

.btn-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--tg-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s, transform 0.1s;
}

.btn-send:hover {
  background-color: var(--tg-primary-hover);
}

.btn-send:active {
  transform: scale(0.95);
}

/* ==========================================================================
   MODALS (GANTI PASSWORD & SESSION EXPIRED)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 9999;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  color: #111;
}

.close-modal {
  font-size: 24px;
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.expired-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.modal-desc {
  color: var(--tg-text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 12px 0 24px 0;
}

.full-width {
  width: 100%;
}

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

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(33, 33, 33, 0.95);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   KAMERA LANGSUNG & PRATINJAU FOTO
   ========================================================================== */
.camera-card {
  max-width: 500px;
  padding: 20px;
}

.camera-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 320px;
  max-height: 52vh;
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

#camera-video,
#camera-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  gap: 12px;
  font-size: 13.5px;
  z-index: 5;
}

.camera-controls {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.camera-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.btn-shutter {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--tg-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-shutter:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(36, 129, 204, 0.4);
}

.btn-shutter:active {
  transform: scale(0.94);
}

.shutter-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tg-primary);
  transition: background-color 0.15s;
}

.camera-sub-btn {
  font-size: 12.5px;
  font-weight: 600;
  background: #f1f3f4;
  border-radius: 20px;
  padding: 8px 14px;
  color: var(--tg-text-main);
  border: 1px solid var(--tg-border);
}

.camera-sub-btn:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   LOCATION CARD (SHARE LOCATION GPS)
   ========================================================================== */
.location-card {
  background: #f8fafc;
  border: 1px solid var(--tg-border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
  min-width: 220px;
}

.location-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #1e293b;
  font-size: 14px;
}

.location-coords {
  font-family: monospace;
  font-size: 12px;
  color: var(--tg-text-muted);
}

.btn-open-map {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--tg-primary);
  color: #ffffff;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 4px;
  transition: background-color 0.15s;
}

.btn-open-map:hover {
  background-color: var(--tg-primary-hover);
}

.bubble-user-photo {
  max-width: 260px;
  border-radius: 12px;
  margin-bottom: 4px;
  cursor: pointer;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   RESPONSIVE (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    transform: translateX(0);
  }

  .app-layout.chat-open .sidebar {
    transform: translateX(-100%);
  }

  .chat-area {
    width: 100%;
  }

  .mobile-only {
    display: flex;
  }

  .message-row {
    max-width: 88%;
  }
}

