/* ═══════════════════════════════════════════════════════════════════
   ServietSoft Soporte — portal.css
   Estilos exclusivos del Portal Cliente
   ═══════════════════════════════════════════════════════════════════ */

/* ── LAYOUT PORTAL ─────────────────────────────────────────────────── */
.portal-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER PORTAL ─────────────────────────────────────────────────── */
.portal-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.portal-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.portal-logo img {
  height: 36px;
  width: auto;
}

.portal-logo-sub {
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-weight: 500;
  border-left: 1px solid var(--color-border);
  padding-left: var(--space-3);
  margin-left: var(--space-1);
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.portal-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.portal-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-dark);
}

.portal-user-empresa {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ── MAIN CONTENT ──────────────────────────────────────────────────── */
.portal-main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  width: 100%;
}

.portal-page-header {
  margin-bottom: var(--space-8);
}

.portal-page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.portal-page-subtitle {
  color: var(--color-muted);
  font-size: var(--text-base);
}

/* ── FOOTER PORTAL ─────────────────────────────────────────────────── */
.portal-footer {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: var(--space-5) var(--space-6);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ── LOGIN PAGE ────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.login-visual {
  position: relative;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  overflow: hidden;
}

/* Mesh gradient animado */
.mesh-bg {
  position: absolute;
  inset: -50%;
  pointer-events: none;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.6;
}

.mesh-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(42,63,143,0.8), transparent 70%);
  top: -100px; left: -100px;
  animation: meshMove1 12s ease-in-out infinite;
}

.mesh-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(192,40,45,0.5), transparent 70%);
  bottom: -50px; right: -80px;
  animation: meshMove2 15s ease-in-out infinite;
}

.mesh-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(30,45,107,0.9), transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  animation: meshMove3 10s ease-in-out infinite;
}

.login-visual-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
}

.login-visual-logo {
  height: 56px;
  filter: brightness(0) invert(1);
  margin-bottom: var(--space-8);
}

.login-visual-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-4);
  line-height: 1.2;
}

.login-visual-subtitle {
  font-size: var(--text-base);
  color: rgba(255,255,255,0.75);
  max-width: 360px;
  line-height: 1.7;
}

.login-visual-features {
  margin-top: var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
  width: 100%;
  max-width: 360px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: rgba(255,255,255,0.85);
  font-size: var(--text-sm);
}

.login-feature-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

/* Panel del formulario */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  background: var(--color-white);
  overflow-y: auto;
}

.login-form-box {
  width: 100%;
  max-width: 420px;
}

.login-form-header {
  margin-bottom: var(--space-8);
}

.login-form-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: var(--space-2);
}

.login-form-subtitle {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* ── DASHBOARD PORTAL ──────────────────────────────────────────────── */
.tickets-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.tickets-filters {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  flex: 1;
}

.filter-select {
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-dark);
  background: var(--color-white);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A7A7A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  padding: var(--space-2) var(--space-4) var(--space-2) 40px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast);
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Ticket Card */
.ticket-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,45,107,0.06);
  border-left: 4px solid var(--color-primary);
  padding: var(--space-5) var(--space-6);
  transition: all var(--transition-base);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-4);
  align-items: start;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.ticket-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.ticket-card[data-estado="Abierto"]          { border-left-color: var(--color-primary); }
.ticket-card[data-estado="En Revisión"]      { border-left-color: var(--color-warning); }
.ticket-card[data-estado="En Proceso"]       { border-left-color: var(--color-success); }
.ticket-card[data-estado="Pendiente Cliente"]{ border-left-color: var(--color-accent); }
.ticket-card[data-estado="Resuelto"]         { border-left-color: var(--color-success); }
.ticket-card[data-estado="Cerrado"]          { border-left-color: var(--color-muted); }

.ticket-card-main { min-width: 0; }

.ticket-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.ticket-card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-dark);
  line-height: 1.4;
}

.ticket-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-muted);
  font-size: var(--text-xs);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.ticket-card-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.ticket-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}

.tickets-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tickets-empty {
  text-align: center;
  padding: var(--space-20) var(--space-8);
  color: var(--color-muted);
}

.tickets-empty-icon {
  font-size: 64px;
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

/* ── WIZARD NUEVO TICKET ───────────────────────────────────────────── */
.wizard-header {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,45,107,0.06);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.wizard-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-2);
}

.wizard-step-node {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all var(--transition-base);
  background: var(--color-border);
  color: var(--color-muted);
  border: 2px solid var(--color-border);
}

.wizard-step.active .wizard-step-node {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(30,45,107,0.15);
  animation: stepActive 0.3s ease both;
}

.wizard-step.completed .wizard-step-node {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin: 20px var(--space-3) 0;
  align-self: flex-start;
}

.wizard-step-line.completed {
  background: var(--color-success);
}

.wizard-step-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-align: center;
  white-space: nowrap;
}

.wizard-step.active .wizard-step-label { color: var(--color-primary); }
.wizard-step.completed .wizard-step-label { color: var(--color-success); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; animation: fadeInUp 0.4s ease both; }

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

/* Adjuntos */
.adjuntos-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  cursor: default;
  transition: border-color var(--transition-base), background var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.adjuntos-drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.adjuntos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.adjunto-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-border-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  max-width: 220px;
}

.adjunto-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.adjunto-file-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  color: var(--color-muted);
}

.adjunto-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.adjunto-name {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adjunto-size {
  font-size: 0.65rem;
  color: var(--color-muted);
}

.adjunto-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-shrink: 0;
  transition: color var(--transition-base);
}
.adjunto-remove:hover { color: var(--color-accent); }

/* Resumen del ticket (paso 3) */
.ticket-summary {
  background: var(--color-primary-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid rgba(30,45,107,0.1);
}

.ticket-summary-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(30,45,107,0.08);
  font-size: var(--text-sm);
}

.ticket-summary-row:last-child { border-bottom: none; }
.ticket-summary-label { font-weight: 600; color: var(--color-primary); width: 120px; flex-shrink: 0; }
.ticket-summary-value { color: var(--color-dark); }

/* ── TICKET DETALLE ────────────────────────────────────────────────── */
.ticket-detalle-header {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,45,107,0.06);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  border-top: 4px solid var(--color-primary);
}

.ticket-detalle-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.ticket-detalle-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.ticket-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.ticket-info-item { display: flex; flex-direction: column; gap: var(--space-1); }
.ticket-info-label { font-size: var(--text-xs); font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ticket-info-value { font-size: var(--text-sm); font-weight: 500; color: var(--color-dark); }

/* ── TIMELINE DE ESTADOS ───────────────────────────────────────────── */
.estado-timeline {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,45,107,0.06);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.estado-timeline-track {
  display: flex;
  align-items: center;
  min-width: 600px;
  padding: var(--space-4) 0;
}

.estado-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  cursor: default;
}

.estado-node-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: all var(--transition-base);
}

.estado-node.pending .estado-node-circle {
  background: var(--color-white);
  border: 2px dashed var(--color-border);
}

.estado-node.completed .estado-node-circle {
  background: var(--color-success);
  border: 2px solid var(--color-success);
}

.estado-node.active .estado-node-circle {
  background: var(--color-primary);
  border: 2px solid var(--color-primary);
  animation: ringPulse 2s ease-in-out infinite;
}

.estado-node-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  margin-top: var(--space-2);
  color: var(--color-muted);
  max-width: 80px;
  line-height: 1.3;
}

.estado-node.active .estado-node-label  { color: var(--color-primary); }
.estado-node.completed .estado-node-label { color: var(--color-success); }

.estado-connector {
  flex: 1;
  height: 3px;
  background: var(--color-border);
  margin-top: -22px;
  margin-bottom: var(--space-6);
  transition: background var(--transition-slow);
}

.estado-connector.filled {
  background: linear-gradient(90deg, var(--color-success), var(--color-success));
}

/* ── FEED DE ACTIVIDAD ─────────────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: var(--space-4);
  position: relative;
  padding-bottom: var(--space-6);
}

.activity-item:last-child { padding-bottom: 0; }
.activity-item:last-child .activity-line { display: none; }

.activity-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.activity-line {
  position: absolute;
  left: 50%;
  top: 44px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--color-border), transparent);
  transform: translateX(-50%);
}

.activity-body {
  flex: 1;
  min-width: 0;
  padding-top: var(--space-1);
}

.activity-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.activity-author {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--color-dark);
}

.activity-date {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.activity-content {
  background: var(--color-border-light);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-dark);
  line-height: 1.7;
  border: 1px solid var(--color-border);
}

.activity-item.admin-item .activity-content {
  background: var(--color-primary-light);
  border-color: rgba(30,45,107,0.1);
}

.activity-item.state-change .activity-content {
  background: linear-gradient(135deg, var(--color-border-light), var(--color-white));
  border-style: dashed;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-style: italic;
}

/* ── COMENTAR FORM ─────────────────────────────────────────────────── */
.comentar-form {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,45,107,0.06);
  padding: var(--space-6);
}

/* ── RESPONSIVE PORTAL ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-visual { display: none; }

  .login-form-panel {
    padding: var(--space-8) var(--space-6);
    min-height: 100vh;
  }

  .portal-main {
    padding: var(--space-6) var(--space-4);
  }

  .tickets-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .tickets-filters {
    flex-direction: column;
  }

  .search-input-wrap { max-width: none; }

  .ticket-card {
    grid-template-columns: 1fr;
  }

  .ticket-card-side {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ticket-detalle-top {
    flex-direction: column;
  }

  .estado-timeline-track { min-width: 480px; }

  .wizard-steps { gap: var(--space-2); }
}

@media (max-width: 480px) {
  .portal-header-inner { padding: 0 var(--space-4); }
  .portal-logo-sub { display: none; }
}
