:root {
  --navy: #0e1f3c;
  --navy-light: #16305c;
  --teal: #14b8a6;
  --teal-dark: #0d9488;
  --teal-light: #5eead4;
  --bg: #ffffff;
  --bg-soft: #f4f7fb;
  --text: #1f2937;
  --text-muted: #5b6472;
  --border: #e3e8f0;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(14, 31, 60, 0.08);
  --gradient: linear-gradient(135deg, var(--teal) 0%, var(--navy) 100%);
  --gradient-btn: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* Empuja el footer al fondo cuando el contenido es más corto que la pantalla */
body > main {
  flex: 1 0 auto;
}

body > .site-footer {
  flex-shrink: 0;
}

h1, h2, h3, h4 {
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  border-top: 4px solid;
  border-image: linear-gradient(90deg, var(--teal) 0%, var(--navy) 100%) 1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy);
}

.nav-brand img {
  height: 38px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-links a {
  position: relative;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy-light);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-links a:hover {
  background: var(--bg-soft);
}

.nav-links a.active {
  color: var(--teal-dark);
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
}

.nav-links a.btn-nav.active::after {
  display: none;
}

.nav-links a.btn-nav {
  background: var(--gradient-btn);
  color: #fff;
}

.nav-links a.btn-nav:hover {
  opacity: 0.92;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding: 8px 16px;
  background: var(--bg-soft);
  border-radius: 999px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.nav-user .company-name {
  font-weight: 700;
  color: var(--navy);
}

.nav-user .user-email {
  color: var(--text-muted);
}

.nav-user .link-btn {
  font-size: 0.85rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--navy);
  cursor: pointer;
}

/* Hero */
.hero {
  position: relative;
  background: var(--bg-soft);
  padding: 72px 0;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}

.hero::before {
  width: 420px;
  height: 420px;
  top: -160px;
  right: -120px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.22), transparent 70%);
}

.hero::after {
  width: 320px;
  height: 320px;
  bottom: -140px;
  left: -100px;
  background: radial-gradient(circle, rgba(14, 31, 60, 0.14), transparent 70%);
}

.hero .container {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 48px;
}

.logo-frame {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.hero-text {
  flex: 1;
}

.hero-text h1 {
  font-size: 2.6rem;
  line-height: 1.15;
  margin: 0 0 18px;
  color: var(--navy);
}

.hero-text h1 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-image {
  flex: 0 0 320px;
  display: flex;
  justify-content: center;
}

.hero-image img {
  width: 100%;
  max-width: 320px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--gradient-btn);
  color: #fff;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 10px 22px rgba(13, 148, 136, 0.34);
}

.btn-outline {
  background: transparent;
  border-color: var(--navy);
  color: var(--navy);
}

.btn-outline:hover {
  background: var(--navy);
  color: #fff;
}

.btn-block {
  width: 100%;
  text-align: center;
}

/* Sections */
section {
  padding: 72px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 12px;
  color: var(--navy);
  font-size: 2rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 48px;
}

/* Cards / grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
}

.card .icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.28);
}

.card .icon svg {
  width: 26px;
  height: 26px;
}

.card h3 {
  margin: 0 0 10px;
  color: var(--navy);
}

.card p {
  color: var(--text-muted);
  margin: 0;
}

/* Contact / info blocks */
.info-block {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.info-block h4 {
  margin: 0 0 6px;
  color: var(--navy);
}

.info-block p {
  margin: 0;
  color: var(--text-muted);
}

/* Forms */
.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--navy);
  font-size: 0.92rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.96rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.form-field textarea {
  resize: vertical;
  min-height: 110px;
}

.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  max-width: 520px;
  margin: 0 auto;
}

.form-msg {
  margin-top: 14px;
  font-size: 0.92rem;
  padding: 12px 14px;
  border-radius: 8px;
  display: none;
}

.form-msg.show {
  display: block;
}

.form-msg.success {
  background: #e6fbf7;
  color: var(--teal-dark);
}

.form-msg.error {
  background: #fdecec;
  color: #b42318;
}

/* Support portal */
.support-wrap {
  max-width: 880px;
  margin: 0 auto;
}

.panel-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.portal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.support-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 32px;
}

.ticket-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.ticket-item:hover {
  box-shadow: var(--shadow);
}

.ticket-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.ticket-item h4 {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}

.ticket-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.ticket-desc {
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--text-muted);
  display: none;
}

.ticket-contact {
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.ticket-attachment {
  display: inline-block;
  margin-top: 12px;
}

.ticket-attachment img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.admin-controls {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.admin-controls .form-field {
  margin-bottom: 0;
  min-width: 160px;
}

.admin-controls select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.closed-note {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 480px;
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.resolution-note {
  background: #eefdfa;
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--text);
}

/* Filtros por estado (admin) */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.filter-tab {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-tab:hover {
  background: #eef2f7;
}

.filter-tab.active {
  background: var(--gradient-btn);
  color: #fff;
  border-color: transparent;
}

/* Chat dentro de cada ticket */
.ticket-chat {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.ticket-chat-title {
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.ticket-chat-messages {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding-right: 4px;
}

.ticket-chat-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

.chat-bubble {
  background: var(--bg-soft);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.chat-bubble-admin {
  border-left-color: var(--teal);
  background: #e6fbf7;
}

.chat-bubble-cliente {
  border-left-color: var(--navy-light);
}

.chat-bubble-sender {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--navy);
  margin-bottom: 2px;
}

.chat-bubble-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.ticket-chat-form {
  display: flex;
  gap: 8px;
}

.ticket-chat-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.ticket-chat-form input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.ticket-chat-form .btn {
  padding: 10px 18px;
  font-size: 0.88rem;
}

.ticket-item.open .ticket-desc {
  display: block;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: capitalize;
}

.badge.abierto {
  background: #fff4e5;
  color: #b25e09;
}

.badge.en_progreso {
  background: #e8f0fe;
  color: #1a56db;
}

.badge.resuelto {
  background: #e6fbf7;
  color: var(--teal-dark);
}

.badge.cerrado {
  background: #eceff3;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 40px 0;
}

/* Footer */
.site-footer {
  background: var(--navy);
  color: #cbd5e1;
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-grid h4 {
  color: #fff;
  margin: 0 0 14px;
  font-size: 0.95rem;
}

.footer-grid a {
  display: block;
  color: #9fb0c9;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.footer-grid a:hover {
  color: #fff;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-brand img {
  height: 28px;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: #8b9bb5;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

.grid .card.reveal:nth-child(2) {
  transition-delay: 0.1s;
}

.grid .card.reveal:nth-child(3) {
  transition-delay: 0.2s;
}

/* Responsive */
@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .portal-columns {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .hero .container {
    flex-direction: column;
  }
  .hero-image {
    order: -1;
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 24px 20px;
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.show {
    display: flex;
  }
  .nav-links a {
    text-align: center;
  }
  .hero-text h1 {
    font-size: 2rem;
  }
}
