:root {
  --bg: #f4f1e8;
  --panel: #fffaf0;
  --text: #1f1f1f;
  --accent: #005f73;
  --accent-2: #0a9396;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #e9d8a6, var(--bg));
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.app-shell {
  width: min(760px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, white);
  border: 1px solid #e5e2d9;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.landing-shell {
  max-width: 820px;
}

.top-demo-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 0.7rem;
}

.landing-content h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.landing-content p {
  margin-top: 0.5rem;
  line-height: 1.5;
}

.cta-btn {
  display: inline-block;
  margin-top: 0.75rem;
  background: var(--accent-2);
  color: #fff;
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 600;
}

.cta-row {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.social-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.site-footer-social {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 0.9rem;
}

.social-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dcecf0;
  border: 1px solid #c4dde5;
  color: #0c4f69;
}

.social-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.secondary-link {
  color: #1f4f63;
  text-decoration: none;
  font-weight: 600;
}

.auth-shell {
  width: min(520px, 100%);
}

label {
  font-weight: 600;
}

input[type="password"] {
  width: 100%;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 1rem;
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 1rem;
}

.error-msg {
  margin: 0;
  color: #9b2c2c;
  font-weight: 600;
}

header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.site-logo {
  width: clamp(2.2rem, 5vw, 3rem);
  height: clamp(2.2rem, 5vw, 3rem);
  border-radius: 10px;
  object-fit: cover;
}

.chat-window {
  min-height: 48vh;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid #ddd8c8;
  border-radius: 12px;
  background: #fff;
  display: grid;
  gap: 0.6rem;
}

.msg {
  white-space: pre-wrap;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  max-width: 90%;
}

.msg-user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
}

.msg-bot {
  background: #edf8f8;
  border: 1px solid #cfe7e8;
}

.msg-bot a {
  color: #0a5f84;
  text-decoration: underline;
  word-break: break-word;
}

.msg-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.typing-label {
  color: #42646f;
  font-weight: 600;
  font-size: 0.92rem;
}

.typing-dots {
  display: inline-flex;
  gap: 0.22rem;
}

.typing-dots span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #4d7f8f;
  opacity: 0.35;
  animation: typingPulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

.chat-form {
  display: grid;
  gap: 0.6rem;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 1rem;
  font-family: inherit;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.62rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button[type="submit"] {
  background: var(--accent-2);
  color: #fff;
}

.secondary-btn {
  background: #dcecf0;
  color: #213a43;
}

.logout-form {
  margin: 0;
}

.success-msg {
  margin: 0;
  color: #146c2e;
  font-weight: 600;
}

/* Exam banner */
.exam-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  background: linear-gradient(135deg, #005f73, #0a9396);
  color: white;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.banner-label {
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.72rem;
  opacity: 0.95;
  flex-shrink: 0;
  padding-right: 0.6rem;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.banner-track-wrapper {
  overflow: hidden;
  flex: 1;
}

.banner-track {
  display: flex;
  gap: 2.5rem;
  width: max-content;
  animation: marquee 32s linear infinite;
}

.banner-track a {
  color: white;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.92;
}

.banner-track a:hover {
  opacity: 1;
  text-decoration: underline;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Domicilio button */
.domicilio-btn {
  background: #ee9b00;
  color: #fff;
}

.domicilio-btn:hover {
  background: #ca6702;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-content {
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  width: min(580px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  background: var(--accent);
  color: white;
  border-radius: 16px 16px 0 0;
  position: sticky;
  top: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: transparent;
  color: white;
  font-size: 1rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  opacity: 0.75;
  line-height: 1;
}

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

.modal-body {
  padding: 1.4rem;
  display: grid;
  gap: 0.9rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group {
  display: grid;
  gap: 0.3rem;
}

select {
  width: 100%;
  border: 1px solid #c7c7c7;
  border-radius: 10px;
  padding: 0.7rem;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  appearance: auto;
}

.radio-group {
  display: flex;
  gap: 1.5rem;
  padding: 0.4rem 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.4rem;
}

@media (max-width: 640px) {
  body {
    display: block;
    padding: 0;
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-sizing: border-box;
  }

  .chat-window {
    flex: 1;
    min-height: 0;
    max-height: none;
  }

  .chat-form {
    flex-shrink: 0;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
