/* ========================================
   MODAL & CHAT
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding: 40px 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  margin: auto;
  background: #fff;
  width: 100%;
  max-width: 580px;
  border-radius: 16px;
  position: relative;
  transform: translateY(20px);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: #f4f7fb;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0078d9;
  font-weight: bold;
  z-index: 10;
  transition: background 0.2s;
}
.modal-close:hover {
  background: #e6f2fb;
}

.form-state {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbar for inner elements */
.form-state::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.form-state::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.form-state::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #202020;
  padding-right: 40px; /* Evitar sobrepor o botao de fechar */
}

.modal-desc {
  font-size: 14px;
  color: #767676;
  margin-bottom: 16px;
  line-height: 1.4;
}

.simulation-summary {
  background: #f4f7fb;
  border-radius: 12px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.sim-item {
  display: flex;
  flex-direction: column;
}

.sim-label {
  font-size: 12px;
  color: #767676;
  font-weight: 500;
  margin-bottom: 4px;
}

.sim-value {
  font-size: 16px;
  font-weight: 700;
  color: #202020;
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #202020;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
  border-color: #0078d9;
  box-shadow: 0 0 0 2px rgba(0, 120, 217, 0.1);
}

.form-checkbox {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 4px;
  align-items: flex-start;
}

.form-checkbox input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: #0078d9;
}

.form-checkbox label {
  font-size: 12px;
  color: #767676;
  line-height: 1.4;
  cursor: pointer;
}

.btn-block {
  width: 100%;
  max-width: 100%;
}

/* Chat State */
.chat-state {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 32px 24px 24px 24px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  margin-bottom: 16px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-msg.admin {
  background: #f4f7fb;
  color: #202020;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  background: #0078d9;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg .time {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  opacity: 0.7;
}

.chat-msg.user .time {
  text-align: right;
  color: rgba(255,255,255,0.8);
}

.chat-input-area {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid #f0f5f5;
  margin-top: auto;
}

.chat-input-area input {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}

.chat-input-area button {
  background: #0078d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-input-area button:hover {
  background: #006bbd;
}

/* File Download Button (client chat) */
.file-download-btn {
  display: block;
  margin-top: 10px;
  padding: 12px 20px;
  background: #0078d9;
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  cursor: pointer;
  letter-spacing: 0.2px;
}
.file-download-btn:hover {
  background: #005fa8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 120, 217, 0.3);
}
.file-download-btn:active {
  transform: translateY(0);
}

/* ========================================
   MOBILE - Reduzir espaços para evitar rolagem
   ======================================== */
@media (max-width: 600px) {
  .modal-overlay {
    padding: 16px 8px;
  }

  .modal-container {
    border-radius: 12px;
  }

  .modal-close {
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
  }

  .form-state {
    padding: 16px 16px;
  }

  .modal-title {
    font-size: 20px;
    margin-bottom: 2px;
    padding-right: 32px;
  }

  .modal-desc {
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.3;
  }

  .simulation-summary {
    padding: 10px 12px;
    gap: 6px;
    margin-bottom: 10px;
    border-radius: 8px;
  }

  .sim-label {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .sim-value {
    font-size: 14px;
  }

  .form-group {
    margin-bottom: 6px;
  }

  .form-group label {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .form-group input[type="text"],
  .form-group input[type="email"] {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 6px;
  }

  .form-checkbox {
    gap: 8px;
    margin-bottom: 10px;
    margin-top: 2px;
  }

  .form-checkbox label {
    font-size: 11px;
    line-height: 1.3;
  }

  .form-checkbox input {
    width: 14px;
    height: 14px;
    margin-top: 2px;
  }
}
