/* CRM modal overlay on WordPress */

.btn-crm-chat {
  background: #1a73e8;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-crm-chat:hover {
  background: #1557b0;
}

.btn-crm-login {
  display: inline-block;
  background: #1a73e8;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.btn-crm-login:hover {
  background: #1557b0;
  color: #fff;
}

.crm-chat-trigger-wrap {
  margin: 1rem 0 1.5rem;
}

.crm-chat-hint {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0.5rem 0 0;
}

.crm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: background 0.3s ease;
}

.crm-modal-container {
  background: #fff;
  width: 90%;
  max-width: 800px;
  height: 80vh;
  min-width: min(400px, 100%);
  min-height: min(400px, 80vh);
  border-radius: 12px;
  overflow: auto;
  resize: both;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transition: width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
  box-sizing: border-box;
}

.crm-modal-container.fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  resize: none;
}

.crm-modal-container.fullscreen::after {
  display: none;
}

.crm-modal-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, transparent 50%, #1a73e8 50%);
  border-bottom-right-radius: 12px;
  pointer-events: none;
  z-index: 2;
}

.crm-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a73e8;
  color: #fff;
  flex-shrink: 0;
}

.crm-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.crm-modal-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.crm-modal-expand,
.crm-modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  opacity: 0.9;
  transition: opacity 0.2s, background 0.2s;
}

.crm-modal-expand:hover,
.crm-modal-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.crm-modal-body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

#crm-modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 900px) {
  .crm-modal-container {
    width: 94%;
    max-width: 720px;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .crm-modal-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    height: 90vh;
    border-radius: 8px;
    resize: none;
  }

  .crm-modal-header {
    padding: 12px 14px;
  }

  .crm-modal-header h3 {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .crm-modal-overlay {
    padding: 8px;
  }

  .crm-modal-container {
    height: 92vh;
    border-radius: 6px;
  }
}
