/* ============================================================
   views.css — Estilos específicos de cada vista
   Responsabilidad: auth, ticket form, ticket detail, dashboards
   y panel de admin.
   ============================================================ */

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
}

.auth-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 180, 255, 0.12) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.auth-card {
  background: var(--glass);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(0, 180, 255, 0.05);
  animation: fadeUp 0.4s ease;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2rem;
}

.auth-logo-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 180, 255, 0.3);
}

.auth-logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: 0.5px;
}

.auth-logo-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 1px;
}

.auth-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 0.3rem;
}

.auth-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1.8rem;
  line-height: 1.5;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch a {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

/* Demo accounts */
.demo-box {
  margin-top: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.demo-box-title {
  font-size: 11px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.demo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.demo-row strong {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.demo-row span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--hint);
}

/* ============================================================
   TICKET FORM
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ============================================================
   TICKET LIST (compartida cliente / agente)
   ============================================================ */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  transition: all 0.15s;
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 14px;
  align-items: center;
}

.ticket-item:hover {
  border-color: var(--border2);
  background: var(--surface2);
  transform: translateX(2px);
}

.ticket-item-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.ticket-item-subject {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-hi);
  margin-bottom: 4px;
}

.ticket-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.ticket-item-meta i {
  font-size: 13px;
  vertical-align: -2px;
  margin-right: 3px;
  color: var(--hint);
}

.ticket-item-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

/* ============================================================
   TICKET DETAIL
   ============================================================ */
.detail-back {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.2rem;
}

.detail-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accentbg);
  border: 1px solid rgba(0, 180, 255, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.detail-card-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
}

.detail-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-hi);
  line-height: 1.3;
  margin-bottom: 8px;
}

.detail-badges {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 600px) {
  .detail-meta-grid { grid-template-columns: 1fr 1fr; }
}

.meta-item label {
  font-size: 10px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
}

.meta-item p {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* ------------------------------------------------------------
   AGENT CONTROLS (within ticket detail)
   ------------------------------------------------------------ */
.agent-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.agent-controls-label {
  font-size: 11px;
  color: var(--hint);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.agent-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 5px 10px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
  transition: border 0.15s;
}

.agent-select:focus { border-color: var(--accent); }

.apply-btn {
  background: var(--accentbg);
  border: 1px solid rgba(0, 180, 255, 0.25);
  color: var(--accent);
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
}

.apply-btn:hover {
  background: var(--accentbg2);
  border-color: var(--accent);
}

/* ------------------------------------------------------------
   MESSAGES THREAD
   ------------------------------------------------------------ */
.messages-section { padding: 1.2rem 1.5rem; }

.messages-label {
  font-size: 11px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.messages-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.msg {
  display: flex;
  gap: 12px;
  margin-bottom: 1.2rem;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

.msg-avatar-agent {
  background: var(--accentbg);
  color: var(--accent);
  border: 1px solid rgba(0, 180, 255, 0.2);
}

.msg-avatar-client {
  background: var(--bluebg);
  color: var(--blue);
  border: 1px solid rgba(59, 158, 255, 0.2);
}

.msg-content { flex: 1; min-width: 0; }

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.msg-name { font-size: 13px; font-weight: 600; color: var(--text-hi); }

.msg-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.msg-role-agent  { background: var(--accentbg); color: var(--accent); }
.msg-role-client { background: var(--bluebg);   color: var(--blue); }

.msg-date {
  font-size: 11px;
  color: var(--hint);
  margin-left: auto;
}

.msg-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.msg-file {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}

.msg-file:hover { color: var(--accent); border-color: var(--border-hi); }

/* ------------------------------------------------------------
   REPLY AREA
   ------------------------------------------------------------ */
.reply-section {
  border-top: 1px solid var(--border);
  padding: 1.2rem 1.5rem;
}

.reply-label {
  font-size: 11px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.reply-section textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text-hi);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  resize: none;
  min-height: 90px;
  transition: border 0.15s, box-shadow 0.15s;
}

.reply-section textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.1);
}

.reply-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 1rem;
  flex-wrap: wrap;
}

.reply-hint {
  font-size: 11px;
  color: var(--hint);
  display: flex;
  align-items: center;
  gap: 5px;
}

.reply-hint i { font-size: 14px; color: var(--accent); }

.closed-notice {
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--hint);
}

.closed-notice i { color: var(--green); }

/* ============================================================
   TICKET SUCCESS
   ============================================================ */
.success-wrap {
  max-width: 500px;
  margin: 3rem auto;
  text-align: center;
}

.success-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--greenbg);
  border: 1px solid rgba(0, 208, 132, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--green);
  margin: 0 auto 1.2rem;
  box-shadow: 0 0 30px rgba(0, 208, 132, 0.15);
}

.success-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-hi);
  margin-bottom: 0.5rem;
}

.success-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.ticket-ref-box {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accentbg);
  border: 1px solid rgba(0, 180, 255, 0.2);
  border-radius: var(--radius);
  padding: 0.6rem 1.5rem;
  display: inline-block;
  margin-bottom: 1.5rem;
  letter-spacing: 1px;
}

.success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   AGENT DASHBOARD
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
  transition: border 0.15s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--stat-accent, var(--accent));
  opacity: 0.7;
}

.stat-card:hover { border-color: var(--border2); }

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--stat-accent, var(--accent));
  line-height: 1;
  margin-bottom: 3px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.stat-icon {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-size: 22px;
  color: var(--stat-accent, var(--accent));
  opacity: 0.2;
}

/* Filters */
.filters-bar {
  display: flex;
  gap: 7px;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}

.filter-pill:hover {
  background: var(--surface2);
  color: var(--text);
}

.filter-pill.active {
  background: var(--accentbg);
  border-color: rgba(0, 180, 255, 0.3);
  color: var(--accent);
}

.search-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-body);
  outline: none;
  min-width: 200px;
  transition: border 0.15s;
}

.search-box:focus      { border-color: var(--border-hi); }
.search-box::placeholder { color: var(--hint); }

/* ============================================================
   ADMIN — Categories panel
   ============================================================ */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-card-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-hi);
}

.category-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface2);
}

.category-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-hi);
}

.category-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.1s;
}

.icon-btn:hover {
  background: var(--surface3);
  color: var(--text-hi);
  border-color: var(--border-hi);
}

.icon-btn.danger:hover {
  background: var(--redbg);
  color: var(--red);
  border-color: rgba(255, 68, 85, 0.3);
}
