/* CAM2 IT Help Desk — Styles */

:root {
  --primary: #0078d4;
  --primary-dark: #005a9e;
  --accent: #106ebe;
  --success: #107c10;
  --warning: #ff8c00;
  --danger: #d13438;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #323130;
  --text-muted: #605e5c;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-img { height: 36px; width: auto; }
.logo-icon { font-size: 28px; }
.logo-text { font-size: 20px; font-weight: 700; color: var(--text); }
.logo-accent { color: var(--primary); }

.main-nav { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary); color: white; }

/* Main */
#app { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

.page { display: none; }
.page.active { display: block; }

/* Hero */
.hero {
  text-align: center;
  padding: 48px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius);
  color: white;
  margin-bottom: 32px;
}
.hero h1 { font-size: 36px; margin-bottom: 12px; }
.hero-sub { font-size: 18px; opacity: 0.9; margin-bottom: 24px; }

.search-bar {
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  gap: 0;
}
.search-bar input {
  flex: 1;
  padding: 14px 18px;
  font-size: 16px;
  border: none;
  border-radius: var(--radius) 0 0 var(--radius);
  outline: none;
}
.search-bar button {
  padding: 14px 24px;
  background: var(--text);
  color: white;
  border: none;
  font-size: 15px;
  font-weight: 600;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
}
.search-bar button:hover { background: #000; }

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}
.action-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.action-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.action-icon { font-size: 36px; margin-bottom: 12px; }
.action-card h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.action-card p { font-size: 13px; color: var(--text-muted); }

/* Announcements Preview */
.announcements-preview {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}
.announcements-preview h2 { font-size: 18px; margin-bottom: 16px; }

/* Announcements List */
.announcements-list, .announcements-list-full { display: flex; flex-direction: column; gap: 12px; }
.announcement-card {
  background: var(--bg);
  border-left: 4px solid var(--primary);
  padding: 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.announcement-card h3 { font-size: 15px; margin-bottom: 6px; }
.announcement-card p { font-size: 14px; color: var(--text-muted); }
.announcement-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.announcement-card.expired { opacity: 0.6; border-left-color: var(--text-muted); }

/* Page Header */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 28px; margin-bottom: 8px; }
.page-header p { color: var(--text-muted); }

/* Forms */
.ticket-form, .track-search { max-width: 640px; }
.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0,120,212,0.2);
}
.form-group textarea { resize: vertical; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

.btn-primary {
  padding: 12px 28px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  padding: 12px 28px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--bg); }

.form-status { margin-top: 16px; font-size: 14px; }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }

/* Track Tickets */
.track-search { display: flex; gap: 12px; margin-bottom: 24px; }
.track-search input { flex: 1; padding: 10px 14px; font-size: 15px; border: 1px solid var(--border); border-radius: var(--radius); }

.ticket-results { display: flex; flex-direction: column; gap: 12px; }
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.ticket-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.ticket-card h3 { font-size: 16px; }
.ticket-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-Hardware { background: #e8f4fd; color: #0078d4; }
.badge-Software { background: #f3e8fd; color: #881798; }
.badge-IFS { background: #e8fdf0; color: #107c10; }
.badge-Connectivity { background: #fef3e8; color: #ff8c00; }
.badge-Printer { background: #fde8e8; color: #d13438; }
.badge-Zebra { background: #e8fdf4; color: #004b50; }
.badge-Password { background: #fff4e5; color: #b7472a; }
.badge-New { background: #e8f4fd; color: #0078d4; }
.badge-Open { background: #fff4e5; color: #ff8c00; }
.badge-In_x0020_Progress { background: #fff4e5; color: #ff8c00; }
.badge-Pending_x0020_Customer { background: #f3e8fd; color: #881798; }
.badge-Resolved { background: #e8fdf0; color: #107c10; }
.badge-Closed { background: #f3f4f6; color: #605e5c; }
.badge-Low { background: #f3f4f6; color: #605e5c; }
.badge-Medium { background: #fff4e5; color: #ff8c00; }
.badge-High { background: #fde8e8; color: #d13438; }
.badge-Critical { background: #d13438; color: white; }
.ticket-email { font-size: 13px; color: var(--text-muted); }

/* KB Grid */
.kb-controls { margin-bottom: 24px; }
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.kb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.kb-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.kb-card h3 { font-size: 16px; margin-bottom: 8px; }
.kb-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.kb-card .category-tag { font-size: 12px; color: var(--primary); font-weight: 600; }

/* KB Article Detail */
.kb-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 800px;
}
.kb-article h1 { font-size: 24px; margin-bottom: 12px; }
.kb-article .meta { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }
.kb-article .steps { white-space: pre-wrap; font-size: 15px; line-height: 1.8; }
.kb-article .back { display: inline-block; margin-bottom: 20px; color: var(--primary); cursor: pointer; }

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.site-footer a { color: var(--primary); }

.loading, .placeholder { color: var(--text-muted); font-size: 14px; padding: 20px 0; text-align: center; }
.error-msg { color: var(--danger); font-size: 14px; padding: 12px; background: #fde8e8; border-radius: var(--radius); }

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 24px; gap: 12px; }
  .main-nav { flex-wrap: wrap; justify-content: center; }
  .form-row { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 26px; }
}
@media (max-width: 480px) {
  .quick-actions { grid-template-columns: 1fr; }
  .search-bar { flex-direction: column; }
  .search-bar input, .search-bar button { border-radius: var(--radius); }
  .search-bar button { margin-top: 8px; }
}

/* Admin Dashboard */
.admin-only { display: none; }
body.is-admin .admin-only { display: inline; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border-left: 4px solid #ccc;
}
.stat-total { border-left-color: #6b7280; }
.stat-new { border-left-color: #3b82f6; }
.stat-open { border-left-color: #f59e0b; }
.stat-unassigned { border-left-color: #ef4444; }
.stat-high { border-left-color: #dc2626; }
.stat-number {
  font-size: 2.2em;
  font-weight: 800;
  color: #1e3a5f;
  line-height: 1;
}
.stat-label { font-size: .85em; color: #6b7280; margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

.admin-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-filters select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}

.admin-table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  background: #1e3a5f;
  color: #fff;
  padding: 12px 14px;
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table tr.priority-high td:first-of-type { border-left: 3px solid #dc2626; }
.admin-table tr.priority-critical td:first-of-type { border-left: 3px solid #7f1d1d; }

.status-select, .assign-select {
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.priority-badge.high, .priority-badge.critical { background: #fef2f2; color: #dc2626; }
.priority-badge.medium { background: #fffbeb; color: #d97706; }
.priority-badge.low { background: #f0fdf4; color: #16a34a; }
.category-badge {
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}
.btn-sm {
  padding: 4px 10px;
  background: #1e3a5f;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.btn-sm:hover { background: #2d4f7a; }
