/* ============================================
   COMUNICACIÓN PRO — estilo.css (TEMA CLARO)
   RED ENTRE RIOS · redentrerios.com
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg:          #f0f4f8;
  --bg2:         #ffffff;
  --bg3:         #f8fafc;
  --border:      #e2e8f0;
  --border2:     #cbd5e1;
  --text:        #0f172a;
  --text2:       #475569;
  --text3:       #94a3b8;
  --accent:      #2563eb;
  --accent2:     #1d4ed8;
  --accentbg:    #eff6ff;
  --accentlight: #dbeafe;
  --green:       #059669;
  --greenbg:     #ecfdf5;
  --yellow:      #d97706;
  --yellowbg:    #fffbeb;
  --red:         #dc2626;
  --redbg:       #fef2f2;
  --blue:        #2563eb;
  --bluebg:      #eff6ff;
  --purple:      #7c3aed;
  --purplebg:    #f5f3ff;
  --radius:      0.75rem;
  --radius-sm:   0.5rem;
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 24px rgba(0,0,0,0.10);
  --font:        'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── TOPBAR ─────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; height: 60px;
}

.topbar-logo {
  font-size: 1.1rem; font-weight: 800;
  color: var(--accent); text-decoration: none;
  letter-spacing: -0.5px;
  display: flex; align-items: center; gap: 0.4rem;
}
.topbar-logo span { color: var(--text); }
.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--text2); font-size: 0.82rem;
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accentbg);
  border: 2px solid var(--accentlight);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--accent); flex-shrink: 0;
}

.notif-badge {
  background: var(--red); color: #fff;
  font-size: 0.62rem; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  margin-left: -8px; margin-top: -18px;
  display: inline-block; line-height: 1.4;
}

.btn-logout {
  color: var(--text3); font-size: 0.78rem;
  text-decoration: none; padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.btn-logout:hover { background: var(--redbg); color: var(--red); border-color: #fecaca; }

/* ── LAYOUT ─────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 1.75rem 1rem 4rem; }

/* ── CARDS ──────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card-sm { padding: 1rem 1.25rem; }

/* ── SECTION HEADER ─────────────────────── */
.section-header {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.section-title {
  font-size: 1.3rem; font-weight: 800;
  color: var(--text); letter-spacing: -0.5px;
}
.section-sub { font-size: 0.8rem; color: var(--text3); margin-top: 1px; }

/* ── BADGES ─────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  letter-spacing: 0.2px; text-transform: uppercase;
}
.badge-nuevo      { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-en_proceso { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-respondido { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-cerrado    { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.badge-baja       { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-media      { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-alta       { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── TICKET LIST ────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: 0.5rem; }

.ticket-item {
  display: flex; align-items: center; gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: var(--shadow);
}
.ticket-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accentlight);
  transform: translateY(-1px);
}
.ticket-item.unread { border-left: 3px solid var(--accent); }

.ticket-icon {
  width: 42px; height: 42px; border-radius: 0.65rem;
  background: var(--accentbg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}

.ticket-info { flex: 1; min-width: 0; }
.ticket-asunto {
  font-size: 0.92rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticket-meta {
  font-size: 0.75rem; color: var(--text3);
  margin-top: 2px; display: flex; gap: 0.6rem; flex-wrap: wrap;
}
.ticket-right {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 0.3rem; flex-shrink: 0;
}
.ticket-time { font-size: 0.68rem; color: var(--text3); }

/* ── FORMS ──────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text2); margin-bottom: 0.4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select, textarea {
  width: 100%; padding: 0.7rem 1rem;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font);
  font-size: 0.9rem; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accentlight);
}
textarea { resize: vertical; min-height: 110px; }
select option { background: #fff; }
input::placeholder, textarea::placeholder { color: var(--text3); }

/* ── BUTTONS ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 1.25rem; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: all 0.15s; white-space: nowrap;
}

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 4px 14px rgba(37,99,235,0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: #fff; color: var(--text2);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); border-color: var(--border2); color: var(--text); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

.btn-danger {
  background: var(--redbg); color: var(--red);
  border: 1.5px solid #fecaca;
}
.btn-danger:hover { background: #fee2e2; }

.btn-success {
  background: var(--greenbg); color: var(--green);
  border: 1.5px solid #a7f3d0;
}
.btn-success:hover { background: #d1fae5; }

/* ── ALERTS ─────────────────────────────── */
.alert {
  padding: 0.8rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 0.5rem;
}
.alert-error   { background: var(--redbg);   color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--greenbg);  color: #065f46; border: 1px solid #a7f3d0; }
.alert-info    { background: var(--bluebg);   color: #1e40af; border: 1px solid #bfdbfe; }

/* ── HILO ───────────────────────────────── */
.hilo { display: flex; flex-direction: column; gap: 1rem; margin: 1.25rem 0; }

.mensaje-burbuja { display: flex; gap: 0.75rem; animation: fadeUp 0.3s ease; }
.mensaje-burbuja.admin-msg { flex-direction: row-reverse; }

.burbuja-cuerpo {
  max-width: 85%;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 1rem 1rem 1rem 0.25rem;
  padding: 0.8rem 1rem;
}
.admin-msg .burbuja-cuerpo {
  background: var(--accentbg);
  border-color: var(--accentlight);
  border-radius: 1rem 1rem 0.25rem 1rem;
}

.burbuja-autor {
  font-size: 0.72rem; font-weight: 700;
  color: var(--text3); margin-bottom: 0.25rem;
}
.admin-msg .burbuja-autor { color: var(--accent); text-align: right; }

.burbuja-texto {
  font-size: 0.88rem; color: var(--text);
  line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.burbuja-time {
  font-size: 0.68rem; color: var(--text3);
  margin-top: 0.3rem;
}
.admin-msg .burbuja-time { text-align: right; }

/* ── STATS ──────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
  text-align: center; box-shadow: var(--shadow);
}
.stat-num {
  font-size: 2rem; font-weight: 800;
  letter-spacing: -1px; line-height: 1; margin-bottom: 0.2rem;
}
.stat-label { font-size: 0.7rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.4px; }

/* ── FILTROS ────────────────────────────── */
.filtros { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filtro-btn {
  padding: 0.35rem 0.9rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); background: #fff;
  color: var(--text2); font-family: var(--font); transition: all 0.15s;
}
.filtro-btn.active,
.filtro-btn:hover {
  background: var(--accent); border-color: var(--accent);
  color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

/* ── EMPTY STATE ────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text3); }
.empty-state .icon { font-size: 3rem; margin-bottom: 0.75rem; display: block; }
.empty-state h3 { font-size: 1rem; color: var(--text2); margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.82rem; }

/* ── DIVIDER ────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── TICKET DETAIL HEADER ───────────────── */
.ticket-detail-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.ticket-id { font-size: 0.72rem; color: var(--text3); margin-bottom: 0.2rem; }
.ticket-asunto-big {
  font-size: 1.15rem; font-weight: 800;
  color: var(--text); letter-spacing: -0.3px; line-height: 1.3;
}

/* ── ANIMS ──────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.fade-in { animation: fadeIn 0.35s ease; }

/* ── FAB ────────────────────────────────── */
.fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37,99,235,0.45);
  text-decoration: none; border: none; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s; z-index: 50;
}
.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(37,99,235,0.55);
}

/* ── USER TABLE ─────────────────────────── */
.user-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.user-table th {
  text-align: left; padding: 0.6rem 0.75rem;
  color: var(--text3); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.user-table td {
  padding: 0.75rem; border-bottom: 1px solid var(--border); color: var(--text);
}
.user-table tr:last-child td { border-bottom: none; }
.user-table tr:hover td { background: var(--bg3); }

/* ── ADJUNTOS ───────────────────────────── */
.adjuntos-lista {
  display: flex; flex-direction: column; gap: 0.35rem;
  margin-top: 0.6rem; padding-top: 0.6rem;
  border-top: 1px solid rgba(0,0,0,0.07);
}
.adj-item {
  display: flex; align-items: center; gap: 0.6rem;
  background: rgba(0,0,0,0.04); border-radius: 0.5rem;
  padding: 0.45rem 0.65rem; font-size: 0.8rem;
}
.adj-img { flex-direction: column; align-items: flex-start; }
.adj-preview-wrap { display: block; }
.adj-preview {
  max-width: 240px; max-height: 180px; border-radius: 0.5rem;
  display: block; cursor: zoom-in; object-fit: cover;
  border: 1px solid var(--border);
}
.adj-icon { font-size: 1.3rem; flex-shrink: 0; }
.adj-info  { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.adj-nombre { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.8rem; }
.adj-nombre-link { color: var(--blue); text-decoration: none; }
.adj-nombre-link:hover { text-decoration: underline; }
.adj-dl { color: var(--accent); text-decoration: none; font-size: 0.75rem; }
.adj-dl:hover { text-decoration: underline; }
.adj-size { color: var(--text3); font-size: 0.7rem; }

/* ── DROPZONE ───────────────────────────── */
.dropzone {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg3); position: relative;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accentbg); }
.dropzone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.dropzone-icon  { font-size: 2rem; display: block; margin-bottom: 0.3rem; }
.dropzone-label { font-size: 0.85rem; color: var(--text2); }
.dropzone-hint  { font-size: 0.7rem; color: var(--text3); margin-top: 0.2rem; }

.preview-lista { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.75rem; }
.preview-item {
  display: flex; align-items: center; gap: 0.6rem;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
  font-size: 0.82rem; animation: fadeUp 0.25s ease;
}
.preview-item .pname { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.preview-item .psize { color: var(--text3); font-size: 0.7rem; white-space: nowrap; }
.preview-item .pthumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }

.reply-dropzone {
  border: 1.5px dashed var(--border2); border-radius: var(--radius-sm);
  padding: 0.6rem 1rem; display: flex; align-items: center; gap: 0.6rem;
  cursor: pointer; background: var(--bg3); font-size: 0.8rem; color: var(--text3);
  transition: border-color 0.2s, background 0.2s; position: relative; margin-top: 0.5rem;
}
.reply-dropzone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.reply-dropzone:hover, .reply-dropzone.over { border-color: var(--accent); color: var(--accent); background: var(--accentbg); }
.reply-preview { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.reply-prev-chip {
  display: flex; align-items: center; gap: 0.3rem;
  background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 0.2rem 0.6rem;
  font-size: 0.75rem; color: var(--text2);
}
.reply-prev-thumb { width: 22px; height: 22px; border-radius: 3px; object-fit: cover; }

/* ── LOGIN PAGE ─────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 1.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f4f8 50%, #ecfdf5 100%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 1.25rem; padding: 2rem;
  box-shadow: var(--shadow-md); animation: fadeUp 0.4s ease;
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo .logo-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.login-logo p  { font-size: 0.8rem; color: var(--text3); }
.powered { text-align: center; font-size: 0.7rem; color: var(--text3); margin-top: 1.5rem; }
.powered a { color: var(--accent); text-decoration: none; }

/* ── TABS ───────────────────────────────── */
.tabs { display: flex; border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1.5rem; }
.tab-btn {
  flex: 1; padding: 0.6rem; background: transparent; border: none; cursor: pointer;
  color: var(--text2); font-family: var(--font); font-size: 0.85rem; font-weight: 600;
  transition: all 0.15s;
}
.tab-btn.active { background: var(--accent); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MODAL ──────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.4);
  z-index: 200; align-items: center; justify-content: center; padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-md); animation: fadeUp 0.2s ease;
}
.modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }

/* ── AUTO REFRESH INDICATOR ─────────────── */
.refresh-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--border); z-index: 999;
}
.refresh-bar-inner {
  height: 100%; background: var(--accent);
  width: 100%; transform-origin: left;
  animation: refreshCountdown 10s linear infinite;
}
@keyframes refreshCountdown {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.refresh-indicator {
  position: fixed; bottom: 8px; right: 10px;
  font-size: 0.65rem; color: var(--text3);
  background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px;
  z-index: 1000; font-family: var(--font);
}

/* ── RESPONSIVE ─────────────────────────── */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .ticket-item { padding: 0.85rem 1rem; }
  .burbuja-cuerpo { max-width: 92%; }
  .topbar-user .nombre { display: none; }
  .container { padding: 1rem 0.75rem 4rem; }
}
