/* Portal do Colaborador — Anglo Rede Sul */
:root {
  --primary: #0066CC;
  --primary-dark: #004C99;
  --primary-light: #E3F2FD;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --text: #111827;
  --text-secondary: #6B7280;
  --bg: #F3F4F6;
  --white: #FFFFFF;
  --radius: 8px;
  --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-top: 68px;
  padding-bottom: 0;
}

/* Header */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo-wrapper {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.3);
}
.header-logo { height: 32px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.header-avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); }
.btn-logout {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  color: var(--white); padding: 7px 16px; border-radius: 20px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all 0.2s; letter-spacing: 0.3px;
}
.btn-logout:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.4); }

/* Desktop Navigation (inside header) */
.desktop-nav {
  display: flex; align-items: center; gap: 4px;
}
.desktop-nav a {
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; color: rgba(255,255,255,0.75); font-size: 13px; font-weight: 500;
  padding: 8px 16px; border-radius: 20px; transition: all 0.2s;
}
.desktop-nav a:hover { color: #FFFFFF; background: rgba(255,255,255,0.12); }
.desktop-nav a.active { color: #FFFFFF; background: rgba(255,255,255,0.2); }

/* Bottom Navigation (mobile only) */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white);
  border-top: 1px solid #E5E7EB;
  height: 60px;
  justify-content: space-around; align-items: center;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--text-secondary); font-size: 11px;
  padding: 6px 12px; border-radius: var(--radius); transition: color 0.2s;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--primary); }
.bottom-nav a .nav-icon { font-size: 20px; }

@media (max-width: 767px) {
  .bottom-nav { display: flex; }
  .desktop-nav { display: none; }
  body { padding-bottom: 68px; }
}

/* Main content */
#app { max-width: 900px; margin: 0 auto; padding: 20px 16px; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* Ticket cards */
.ticket-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  border-left: 4px solid transparent;
}
.ticket-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.ticket-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ticket-card-id { font-weight: 600; color: var(--primary); font-size: 14px; }
.ticket-card-body { font-size: 13px; color: var(--text-secondary); }
.ticket-card-body .ticket-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 12px; }
.ticket-meta-item { display: flex; align-items: center; gap: 4px; }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-open { background: #DBEAFE; color: #1E40AF; }
.badge-in_progress { background: #FEF3C7; color: #92400E; }
.badge-waiting_material { background: #EDE9FE; color: #5B21B6; }
.badge-waiting_user { background: #FEF9C3; color: #854D0E; }
.badge-resolved { background: #D1FAE5; color: #065F46; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.badge-duplicate { background: #F3F4F6; color: #4B5563; }

/* Priority badges */
.priority-baixa { color: var(--success); }
.priority-media, .priority-média { color: var(--warning); }
.priority-alta { color: #F97316; }
.priority-urgente { color: var(--danger); font-weight: 700; }

/* Filter buttons */
.search-bar { margin-bottom: 12px; }
.search-bar input {
  width: 100%; padding: 12px 16px; border: 1px solid #D1D5DB;
  border-radius: var(--radius-lg); font-size: 14px; font-family: inherit;
  background: var(--white); color: var(--text); transition: border-color 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px; border: 1px solid #D1D5DB;
  background: var(--white); color: var(--text-secondary);
  font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--primary); color: var(--white); border-color: var(--primary);
}

/* Conversation thread */
.conversation { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.msg-bubble {
  max-width: 80%; padding: 12px 16px;
  border-radius: 16px; font-size: 14px; line-height: 1.5;
  position: relative;
}
.msg-bubble.colaborador {
  align-self: flex-end;
  background: var(--primary); color: var(--white);
  border-bottom-right-radius: 4px;
}
.msg-bubble.admin {
  align-self: flex-start;
  background: #E5E7EB; color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-meta {
  font-size: 11px; margin-top: 6px; opacity: 0.7;
  display: flex; justify-content: space-between; gap: 8px;
}
.msg-bubble.colaborador .msg-meta { color: rgba(255,255,255,0.7); }
.msg-bubble.admin .msg-meta { color: var(--text-secondary); }

.msg-input-area {
  display: flex; gap: 8px; margin-top: 12px;
}
.msg-input-area textarea {
  flex: 1; padding: 10px 14px; border: 1px solid #D1D5DB;
  border-radius: var(--radius); font-size: 14px; resize: none;
  font-family: inherit; min-height: 44px; max-height: 120px;
}
.msg-input-area textarea:focus { outline: none; border-color: var(--primary); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-group select, .form-group textarea, .form-group input {
  width: 100%; padding: 10px 14px; border: 1px solid #D1D5DB;
  border-radius: var(--radius); font-size: 14px; font-family: inherit;
  background: var(--white); color: var(--text); transition: border-color 0.2s;
}
.form-group select:focus, .form-group textarea:focus, .form-group input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group.error select, .form-group.error textarea, .form-group.error input {
  border-color: var(--danger);
}
.form-group .error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius); font-size: 14px;
  font-weight: 500; cursor: pointer; border: none; transition: all 0.2s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #DC2626; }
.btn-secondary { background: #E5E7EB; color: var(--text); }
.btn-secondary:hover { background: #D1D5DB; }

/* Toast notifications */
.toast-container { position: fixed; top: 76px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius); color: var(--white);
  font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
  max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-message { font-size: 13px; opacity: 0.9; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* Loading spinner */
.spinner-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text-secondary); gap: 10px; font-size: 14px;
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 16px;
}
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 24px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 25px rgba(0,0,0,0.1);
}
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Section titles */
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.section-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }

/* Ticket detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.detail-item label { font-size: 12px; color: var(--text-secondary); display: block; }
.detail-item span { font-size: 14px; font-weight: 500; }
@media (max-width: 480px) { .detail-grid { grid-template-columns: 1fr; } }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Unread badge */
.unread-badge {
  background: var(--danger); color: var(--white);
  font-size: 11px; font-weight: 600; padding: 2px 6px;
  border-radius: 10px; min-width: 18px; text-align: center;
}

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--primary); text-decoration: none; font-size: 14px;
  margin-bottom: 16px;
}
.back-link:hover { text-decoration: underline; }
