/* PHPlans Native AI Chat Widget Styles */

.phplans-chat-launcher {
  position: fixed;
  bottom: 14px;
  right: 76px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  color: #ffffff;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999 !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.phplans-chat-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.55);
}

.phplans-chat-launcher .launcher-icon {
  font-size: 26px;
  transition: transform 0.2s ease;
}

.phplans-chat-launcher .close-icon {
  font-size: 24px;
  display: none;
}

.phplans-chat-launcher.is-open .launcher-icon {
  display: none;
}

.phplans-chat-launcher.is-open .close-icon {
  display: block;
}

.phplans-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
}

/* Chat Modal / Panel */
.phplans-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999 !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.phplans-chat-panel.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.phplans-chat-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.phplans-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.phplans-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.phplans-chat-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.phplans-chat-subtitle {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.phplans-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.phplans-chat-header-actions {
  display: flex;
  gap: 6px;
}

.phplans-chat-btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #cbd5e1;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
}

.phplans-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Chat Body / Messages */
.phplans-chat-body {
  flex: 1 1 auto;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phplans-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: phplansFadeIn 0.2s ease forwards;
}

.phplans-msg.msg-user {
  align-self: flex-end;
}

.phplans-msg.msg-assistant {
  align-self: flex-start;
}

.phplans-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.phplans-msg.msg-user .phplans-msg-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.phplans-msg.msg-assistant .phplans-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.phplans-msg-bubble p:last-child {
  margin-bottom: 0;
}

.phplans-msg-bubble ul {
  padding-left: 18px;
  margin: 6px 0;
}

.phplans-msg-bubble li {
  margin-bottom: 4px;
}

.phplans-msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 4px;
}

.phplans-msg.msg-user .phplans-msg-time {
  text-align: right;
}

/* Quick Suggestion Chips */
.phplans-chat-suggestions {
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid #edf2f7;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.phplans-chat-suggestions::-webkit-scrollbar {
  display: none;
}

.phplans-suggestion-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 16px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.phplans-suggestion-chip:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* Typing Indicator */
.phplans-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.phplans-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: phplansTypingBounce 1.4s infinite ease-in-out both;
}

.phplans-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.phplans-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes phplansTypingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

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

/* Chat Footer / Input */
.phplans-chat-footer {
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

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

.phplans-chat-input {
  flex: 1 1 auto;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
  background: #f8fafc;
}

.phplans-chat-input:focus {
  border-color: #2563eb;
  background: #ffffff;
}

.phplans-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.phplans-chat-send-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.phplans-chat-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
}

.phplans-chat-disclaimer {
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  margin-top: 6px;
}

/* Inline Interactive Plan Cards */
.phplans-plan-cards-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.phplans-plan-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  transition: transform 0.15s ease, border-color 0.15s ease;
  text-decoration: none !important;
  color: inherit !important;
}

.phplans-plan-card:hover {
  transform: translateY(-2px);
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.phplans-plan-thumb {
  width: 105px;
  height: 85px;
  object-fit: cover;
  background: #e2e8f0;
  flex-shrink: 0;
}

.phplans-plan-info {
  padding: 8px 10px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.phplans-plan-num {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
}

.phplans-plan-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.phplans-plan-specs {
  font-size: 11px;
  color: #64748b;
  display: flex;
  gap: 8px;
  align-items: center;
}

.phplans-plan-cta {
  font-size: 10.5px;
  font-weight: 700;
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  align-self: flex-start;
  margin-top: 4px;
}

/* Visual Search Footprint & Spatial Pin Card */
.phplans-vs-card {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.phplans-vs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.phplans-vs-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 5px;
}

.phplans-vs-canvas {
  position: relative;
  width: 100%;
  height: 130px;
  background: #f8fafc;
  border: 2px dashed #93c5fd;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.phplans-vs-footprint-label {
  position: absolute;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.phplans-vs-label-rear {
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.phplans-vs-label-front {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}

.phplans-vs-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border-radius: 12px;
  padding: 3px 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-size: 10px;
  font-weight: 700;
  color: #0f172a;
  border: 1.5px solid;
  animation: phplansPulsePin 2s infinite ease-in-out;
  white-space: nowrap;
}

@keyframes phplansPulsePin {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.06); }
}

.phplans-vs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  background: #16a34a;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s ease;
}

.phplans-vs-btn:hover {
  background: #15803d;
  color: #ffffff;
}

/* Keyword Search Action Button */
.phplans-keyword-search-action {
  margin-top: 8px;
}

.phplans-btn-keyword-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.phplans-btn-keyword-search:hover {
  background: #1d4ed8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.phplans-btn-keyword-search:active {
  transform: translateY(0);
}

.phplans-btn-view-plan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #16a34a;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.phplans-btn-view-plan:hover {
  background: #15803d;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35);
}

.phplans-btn-view-plan:active {
  transform: translateY(0);
}

.phplans-btn-ask-designer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #0284c7;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.phplans-btn-ask-designer:hover {
  background: #0369a1;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.phplans-btn-ask-designer:active {
  transform: translateY(0);
}

.phplans-btn-modify-plan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #7c3aed;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.phplans-btn-modify-plan:hover {
  background: #6d28d9;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35);
}

.phplans-btn-modify-plan:active {
  transform: translateY(0);
}

.phplans-btn-admin-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: #0f172a;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.3);
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.phplans-btn-admin-nav:hover {
  background: #1e293b;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.4);
}

.phplans-btn-admin-nav:active {
  transform: translateY(0);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .phplans-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
  }
  .phplans-chat-launcher {
    bottom: 16px;
    right: 16px;
  }
}
