.modal-chatia {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.hidden-chatia {
  display: none;
}

.modal-content-chatia {
  width: min(760px, 100%);
  max-height: 88vh;
  background: #111827;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head-chatia {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-wrap: wrap;
}

.modal-controls-chatia {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.modal-head-chatia h3 {
  margin: 0;
  font-size: 16px;
  flex-shrink: 0;
}

.toggle-chatia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  opacity: 0.95;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.toggle-chatia:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.toggle-chatia input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #10b981;
}

.btn-close-chatia {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #e5e7eb;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.modal-body-chatia {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-chatia {
  max-width: 92%;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.item-user-chatia {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
}

.item-assistant-chatia {
  align-self: flex-start;
  background: #1f2937;
}

.item-system-chatia {
  align-self: center;
  background: #374151;
  font-size: 13px;
}

.modal-footer-chatia {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-footer-chatia input {
  width: 100%;
  min-width: 0;
  background: #0f172a;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 11px;
}

.modal-footer-chatia button,
.modal-actions-chatia button {
  background: #10b981;
  color: #052e22;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.modal-actions-chatia {
  padding: 0 12px 12px;
}

.modal-actions-chatia button {
  width: 100%;
  background: #f59e0b;
  color: #2d1b00;
}

@media (max-width: 640px) {
  .modal-chatia {
    align-items: flex-end;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .modal-content-chatia {
    width: 100%;
    max-height: 95dvh;
    border-radius: 12px;
  }

  .modal-head-chatia {
    flex-wrap: wrap;
  }

  .modal-footer-chatia {
    grid-template-columns: 1fr;
  }

  .modal-footer-chatia input {
    font-size: 16px;
  }

  #inputChatia {
    font-size: 16px;
  }

  .item-chatia {
    max-width: 100%;
  }
}

/* ============================================================
   MODAL UPLOAD CV - Estilos adicionales
   ============================================================ */

.hidden-modal {
  display: none;
  visibility: hidden;
  opacity: 0;
}

.modal-upload-cv {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 13000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-content-cv {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-head-cv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-head-cv h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.btn-close-cv {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.btn-close-cv:hover {
  background-color: #f0f0f0;
}

.modal-body-cv {
  padding: 30px;
  flex-grow: 1;
  overflow-y: auto;
}

.modal-body-cv > p {
  color: #666;
  font-size: 14px;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.upload-area-cv {
  border: 2px dashed #10b981;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  background-color: #f0fdf4;
  transition: all 0.3s ease;
  position: relative;
}

.upload-area-cv:hover {
  border-color: #059669;
  background-color: #ecfdf5;
}

.upload-area-cv.drag-over {
  border-color: #059669;
  background-color: #d1fae5;
}

.file-label-cv {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.icon-upload {
  font-size: 32px;
}

.text-upload {
  color: #333;
  font-weight: 500;
  font-size: 15px;
}

.text-small {
  color: #999;
  font-size: 12px;
  display: block;
}

.file-preview-cv {
  margin-top: 20px;
  padding: 15px;
  background-color: #f9f9f9;
  border-radius: 6px;
  border-left: 4px solid #10b981;
}

.file-preview-cv.hidden {
  display: none;
}

.file-preview-cv .file-name {
  font-weight: 500;
  color: #333;
  font-size: 14px;
  margin-bottom: 8px;
}

.file-preview-cv .file-size {
  color: #999;
  font-size: 12px;
}

.modal-footer-cv {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  background-color: #fafafa;
  border-radius: 0 0 12px 12px;
}

.btn-secondary-cv,
.btn-primary-cv {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary-cv {
  background-color: #e0e0e0;
  color: #333;
}

.btn-secondary-cv:hover {
  background-color: #d0d0d0;
}

.btn-primary-cv {
  background-color: #10b981;
  color: white;
}

.btn-primary-cv:hover:not(:disabled) {
  background-color: #059669;
}

.btn-primary-cv:disabled {
  background-color: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.6;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Global CV spinner */
.cv-global-spinner {
  position: fixed;
  inset: 0;
  z-index: 14000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cv-spinner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
.cv-spinner {
  position: relative;
  z-index: 14001;
  background: #0f172a;
  color: #fff;
  padding: 18px 22px;
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 10px 30px rgba(2,6,23,0.6);
}
.spinner-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.12);
  border-top-color: #10b981;
  animation: spin 1s linear infinite;
}
.spinner-text {
  font-size: 14px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
  .modal-content-cv {
    max-width: 95%;
  }

  .modal-head-cv {
    padding: 16px;
  }

  .modal-head-cv h3 {
    font-size: 16px;
  }

  .modal-body-cv {
    padding: 20px;
  }

  .upload-area-cv {
    padding: 30px 20px;
  }

  .icon-upload {
    font-size: 24px;
  }

  .text-upload {
    font-size: 13px;
  }
}

