/* Premium Widget & Chat Styles */
.near-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 500;
}

@media (max-width: 600px) {
  .near-fab { bottom: 16px; right: 16px; gap: 8px; }
  .near-fab-btn { width: 48px; height: 48px; border-radius: 14px; }
}
@media (max-width: 380px) {
  .near-fab { bottom: 12px; right: 12px; }
  .near-fab-btn { width: 42px; height: 42px; border-radius: 12px; }
}

.near-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.near-fab-btn:hover {
  transform: scale(1.1);
  background: var(--surface-hover);
  border-color: var(--primary);
}

.near-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: var(--bg);
  font-size: 10px;
  font-weight: 900;
  padding: 4px 6px;
  border-radius: 999px;
  border: 2px solid var(--bg);
  display: none;
}

.near-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-height: 500px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

.near-panel-head {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  color: var(--text);
}

.near-panel-body {
  overflow-y: auto;
  padding: 10px;
  background: var(--bg);
}

.near-row {
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
}

.near-row:hover {
  background: var(--surface-hover);
}

.near-row-title {
  font-weight: 700;
  font-size: 14px;
}

.near-row-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.near-chat {
  position: fixed;
  bottom: 24px;
  right: 96px;
  width: 400px;
  height: 600px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 501;
  animation: fadeIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (max-width: 500px) {
  .near-chat {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}

.near-chat-head {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}

.near-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.near-msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  background: var(--surface-hover);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  position: relative;
}

.near-msg.me {
  background: var(--primary);
  color: var(--bg);
  align-self: flex-end;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 4px;
}

.near-msg-img {
  display: block;
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  cursor: pointer;
  object-fit: contain;
}

.near-msg-img-only,
.near-msg-img-only.me {
  padding: 0;
  border: none;
  background: transparent !important;
  border-radius: 12px;
  box-shadow: none;
}

.near-msg-img-only .near-msg-img {
  border-radius: 12px;
}

.near-msg-img-only .t {
  padding: 4px 0 0;
}

/* Image viewer lightbox */
.near-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.92);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.near-viewer img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
}

.near-msg .t {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

.near-msg-report {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: var(--surface);
  color: var(--error);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: all 0.2s;
  padding: 0;
}
.near-msg:hover .near-msg-report {
  display: flex;
}
.near-msg-report:hover {
  opacity: 1;
  color: #fff;
  background: var(--error);
}
.near-msg.me .near-msg-report {
  right: auto;
  left: 6px;
}

.near-chat-foot {
  padding: 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
}

.near-preview {
  position: absolute;
  bottom: 72px;
  left: 64px;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  background-color: var(--surface);
  display: none;
}

.near-preview-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  line-height: 1;
}

.near-input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.near-input::placeholder {
  color: var(--text-muted);
}

.near-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

.near-x:hover {
  color: var(--text);
}
