/* ==============================================================================
   METAKOMIK CLIENT FLOATING CHAT WIDGET
   ============================================================================== */

:root {
  --mcw-primary: #e63946;
  --mcw-primary-hover: #d62828;
  --mcw-dark: #121316;
  --mcw-card: #1c1d22;
  --mcw-card-border: rgba(255, 255, 255, 0.08);
  --mcw-bubble-admin: #282932;
  --mcw-bubble-client: #e63946;
  --mcw-text: #f8f9fa;
  --mcw-muted: #9496a1;
  --mcw-green: #2ec4b6;
}

/* Floating Action Button (FAB) */
.meta-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mcw-primary), #b71c1c);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(230, 57, 70, 0.45);
  z-index: 9999;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease;
}

.meta-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(230, 57, 70, 0.6);
}

.meta-chat-fab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.meta-chat-fab.open svg {
  transform: rotate(90deg);
}

/* Badge Notifikasi Belum Dibaca */
.meta-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ffb703;
  color: #121316;
  font-size: 11px;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #121316;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Container Jendela Chat */
.meta-chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 540px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: var(--mcw-card);
  border: 1px solid var(--mcw-card-border);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.meta-chat-widget.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header Widget */
.mcw-header {
  padding: 14px 18px;
  background: rgba(18, 19, 22, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--mcw-card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 10;
}

.mcw-header-studio {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mcw-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2a2b34;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: visible;
}

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

.mcw-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--mcw-green);
  border: 2px solid var(--mcw-card);
}

.mcw-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--mcw-text);
  line-height: 1.2;
}

.mcw-header-info span {
  font-size: 11px;
  color: var(--mcw-green);
  font-weight: 500;
}

.mcw-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tombol Place Order di Header */
.mcw-btn-place-order {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f77f00, #d62828);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(247, 127, 0, 0.3);
}

.mcw-btn-place-order:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(247, 127, 0, 0.45);
}

.mcw-btn-close {
  background: transparent;
  border: none;
  color: var(--mcw-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.mcw-btn-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* State Tamu / Belum Login */
.mcw-guest-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 24px;
  height: 100%;
}

.mcw-guest-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(230, 57, 70, 0.12);
  color: var(--mcw-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.mcw-guest-state h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #fff;
}

.mcw-guest-state p {
  font-size: 13px;
  color: var(--mcw-muted);
  line-height: 1.5;
  margin: 0 0 24px;
}

.mcw-guest-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.mcw-btn-login {
  background: var(--mcw-primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.15s;
}

.mcw-btn-login:hover {
  background: var(--mcw-primary-hover);
}

.mcw-btn-register {
  background: transparent;
  color: var(--mcw-muted);
  font-weight: 600;
  font-size: 13px;
  padding: 8px;
  text-decoration: none;
  transition: color 0.15s;
}

.mcw-btn-register:hover {
  color: #fff;
}

/* Messages Body Area (Klien Login) */
.mcw-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #15161a;
}

.mcw-body::-webkit-scrollbar {
  width: 5px;
}

.mcw-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Bubble Chat */
.mcw-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: fadeInMsg 0.2s ease;
}

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

.mcw-msg-row.client {
  align-self: flex-end;
  align-items: flex-end;
}

.mcw-msg-row.admin {
  align-self: flex-start;
  align-items: flex-start;
}

.mcw-msg-sender {
  font-size: 11px;
  color: var(--mcw-muted);
  margin-bottom: 3px;
  padding: 0 4px;
}

.mcw-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.mcw-msg-row.client .mcw-bubble {
  background: var(--mcw-bubble-client);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.mcw-msg-row.admin .mcw-bubble {
  background: var(--mcw-bubble-admin);
  color: var(--mcw-text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mcw-bubble img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
  margin-top: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.mcw-bubble img:hover {
  opacity: 0.9;
}

.mcw-msg-time {
  font-size: 10px;
  color: var(--mcw-muted);
  margin-top: 3px;
  padding: 0 4px;
}

/* Footer / Input Area */
.mcw-footer {
  padding: 12px 14px;
  background: var(--mcw-card);
  border-top: 1px solid var(--mcw-card-border);
}

.mcw-attachment-preview {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--mcw-muted);
}

.mcw-attachment-preview.show {
  display: flex;
}

.mcw-attachment-preview img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.mcw-remove-attachment {
  background: none;
  border: none;
  color: #ff4d4f;
  cursor: pointer;
  font-weight: bold;
  padding: 2px 6px;
  margin-left: auto;
}

.mcw-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mcw-input-row textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  height: 40px;
  max-height: 100px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
}

.mcw-input-row textarea:focus {
  border-color: var(--mcw-primary);
}

.mcw-btn-attach {
  background: transparent;
  border: none;
  color: var(--mcw-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.mcw-btn-attach:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

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

.mcw-btn-send:hover {
  background: var(--mcw-primary-hover);
  transform: scale(1.05);
}

.mcw-btn-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Shopee-Style Artwork Inquiry Bar above composer */
.mcw-inquiry-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 11px;
  margin-bottom: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  animation: mcwSlideUp 0.2s ease-out;
}

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

#mcw-inquiry-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.mcw-inquiry-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mcw-inquiry-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #e63946;
  letter-spacing: 0.04em;
}

#mcw-inquiry-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

#mcw-inquiry-category {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.mcw-inquiry-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mcw-btn-inquiry-send {
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.mcw-btn-inquiry-send:hover {
  background: #e63946;
  transform: scale(1.04);
}

.mcw-btn-inquiry-dismiss {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
}

/* Desktop Resize Handles */
.meta-chat-widget.is-resizing {
  transition: none !important;
  user-select: none !important;
}

.chat-resizer-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  z-index: 9999;
  padding: 4px;
  box-sizing: border-box;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.chat-resizer-handle:hover,
.meta-chat-widget.is-resizing .chat-resizer-handle {
  opacity: 1;
}

.chat-resizer-handle::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-top: 2px solid #94a3b8;
  border-left: 2px solid #94a3b8;
  border-top-left-radius: 4px;
}

.chat-resizer-top {
  position: absolute;
  top: 0;
  left: 22px;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 9998;
}

.chat-resizer-left {
  position: absolute;
  top: 22px;
  bottom: 0;
  left: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 9998;
}

@media (max-width: 768px) {
  .chat-resizer-handle,
  .chat-resizer-top,
  .chat-resizer-left {
    display: none !important;
  }
}

/* Shopee-Style Artwork Inquiry Card - Crisp White Minimalist */
.chat-artwork-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff !important;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  text-decoration: none;
  color: #0f172a !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chat-artwork-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  border-color: #cbd5e1;
}

.chat-artwork-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-artwork-details {
  flex: 1;
  min-width: 0;
}

.chat-artwork-badge {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fee2e2;
  color: #e63946;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.chat-artwork-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.chat-artwork-cat {
  font-size: 11px;
  color: #64748b;
  display: block;
}

.chat-artwork-link {
  font-size: 11px;
  font-weight: 700;
  color: #e63946;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
}

.chat-artwork-card:hover .chat-artwork-link {
  text-decoration: underline;
}

/* Crisp White Minimalist Studio Offer Card */
.mcw-msg-row.has-offer {
  max-width: 90% !important;
  width: 90%;
}

.mcw-msg-row.has-offer .mcw-bubble {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  width: 100% !important;
}

.mcw-offer-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 4px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  color: #0f172a;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mcw-offer-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -5px rgba(0, 0, 0, 0.3);
}

.mcw-offer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
}

.mcw-offer-title {
  font-size: 15.5px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.mcw-offer-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.mcw-offer-price {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.mcw-offer-price-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 2px 7px;
  border-radius: 4px;
}

.mcw-offer-notes {
  font-size: 12.5px;
  line-height: 1.5;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #0f172a;
  padding: 9px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  word-break: break-word;
}

.mcw-offer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: #0f172a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  padding: 11px 16px;
  border-radius: 9px;
  border: none;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  transition: all 0.2s ease;
}

.mcw-offer-btn:hover {
  background: #e63946;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.35);
}