/* ===========================
   Epidemic Marketing Ticketing System
   Brand: Navy / Cyan / Orange
=========================== */

:root {
  --navy: #0A2A4E;
  --navy-dark: #071d38;
  --cyan: #2FC6DE;
  --cyan-dark: #1AA9C0;
  --orange: #F5921B;
  --orange-dark: #DD7E0A;
  --black: #17191c;
  --gray-50: #f7f8fa;
  --gray-100: #eef1f4;
  --gray-200: #e2e6ea;
  --gray-400: #9aa4af;
  --gray-600: #5c6672;
  --white: #ffffff;
  --radius: 10px;
  --radius-pill: 999px;
  --shadow: 0 4px 18px rgba(10, 42, 78, 0.08);
  --shadow-lg: 0 10px 30px rgba(10, 42, 78, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--black);
  min-height: 100%;
}

a { text-decoration: none; color: inherit; }

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--black);
  margin: 0 0 8px 0;
}

p { line-height: 1.55; color: var(--gray-600); margin: 0 0 12px 0; }

.accent-cyan { color: var(--cyan-dark); }
.accent-orange { color: var(--orange); }

/* ===== Layout ===== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--black);
  color: var(--white);
  font-size: 13px;
  padding: 6px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}
.topbar span { opacity: 0.85; }
.topbar .phone { color: var(--orange); font-weight: 700; }

.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--navy);
}
.brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--navy) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 16px;
}
.brand .brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  display: block;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all .15s ease;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--cyan-dark);
  border-bottom-color: var(--cyan);
}
.nav-links .user-chip {
  background: var(--gray-100);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

main.content {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

footer.site-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.7);
  padding: 22px 32px;
  text-align: center;
  font-size: 13px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: none;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  text-transform: uppercase;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(245, 146, 27, 0.35);
}
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary {
  background: var(--navy);
  color: var(--white);
}
.btn-secondary:hover { background: var(--navy-dark); }
.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  padding: 10px 24px;
}
.btn-outline:hover { background: var(--navy); color: white; }
.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-danger { background: #d94f4f; color: white; }
.btn-block { width: 100%; }

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border: 1px solid var(--gray-200);
}
.card + .card { margin-top: 20px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 28px; margin: 0; }
.page-header p { margin: 4px 0 0; }

/* ===== Auth pages ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 60%);
  padding: 24px;
}
.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-card .headline {
  text-align: center;
  margin-bottom: 28px;
}
.auth-card .headline h1 {
  font-size: 22px;
  margin-bottom: 4px;
}
.auth-card .headline p { font-size: 13px; margin: 0; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
input[type=text], input[type=email], input[type=password], input[type=tel],
select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--black);
  transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
}
textarea { resize: vertical; min-height: 110px; }
.file-input-wrap {
  border: 2px dashed var(--gray-200);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  background: var(--gray-50);
}
.file-input-wrap input[type=file] { width: 100%; }
.form-row { display: flex; gap: 16px; }
.form-row > div { flex: 1; }

.helper-text { font-size: 12px; color: var(--gray-400); margin-top: -12px; margin-bottom: 18px; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-open { background: #E7F6FB; color: var(--cyan-dark); }
.badge-in-progress { background: #FFF1DE; color: var(--orange-dark); }
.badge-waiting { background: #F1EBFF; color: #7A4FE0; }
.badge-resolved { background: #E7F7EC; color: #2E9E52; }
.badge-closed { background: var(--gray-100); color: var(--gray-600); }

.priority-low { color: var(--gray-600); }
.priority-normal { color: var(--navy); }
.priority-high { color: var(--orange-dark); font-weight: 800; }
.priority-urgent { color: #d94f4f; font-weight: 800; }

/* ===== Tables / Lists ===== */
.ticket-list { width: 100%; border-collapse: collapse; }
.ticket-list th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-600);
  padding: 12px 14px;
  border-bottom: 2px solid var(--gray-200);
}
.ticket-list td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  vertical-align: middle;
}
.ticket-list tr:hover { background: var(--gray-50); }
.ticket-list a.ticket-link { font-weight: 700; color: var(--navy); }
.ticket-list a.ticket-link:hover { color: var(--cyan-dark); }
.ticket-id { color: var(--gray-400); font-weight: 700; font-size: 12px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }

/* ===== Filters bar ===== */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar select, .filters-bar input[type=text] {
  width: auto;
  min-width: 160px;
}
.filters-bar form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; width: 100%; }

/* ===== Stat cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
}
.stat-card .stat-num { font-size: 30px; font-weight: 800; color: var(--navy); }
.stat-card .stat-label { font-size: 12px; text-transform: uppercase; color: var(--gray-600); font-weight: 700; letter-spacing: .03em; }

/* ===== Ticket Detail ===== */
.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.ticket-header .meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.meta-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  background: var(--gray-100);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.thread { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.message {
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
  background: var(--white);
}
.message.from-client { background: #F5FAFD; border-color: #D7ECF3; }
.message.from-staff { background: #FFFDF8; border-color: #F5E4C4; }
.message.internal { background: #FFF7F0; border-color: #F5921B44; }
.message-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 8px;
  font-weight: 700;
}
.message-head .who { color: var(--navy); }
.message-body { font-size: 14px; color: var(--black); white-space: pre-wrap; line-height: 1.6; }
.internal-tag {
  background: var(--orange);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-left: 8px;
  text-transform: uppercase;
}

.attachments-list { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  border: 1px solid var(--gray-200);
}
.attachment-chip:hover { background: var(--gray-200); }

.reply-box { margin-top: 24px; }

/* ===== Sidebar layout for ticket detail ===== */
.ticket-detail-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .ticket-detail-grid { grid-template-columns: 1fr; }
}

.sidebar-block { margin-bottom: 20px; }
.sidebar-block h4 { font-size: 13px; text-transform: uppercase; color: var(--gray-600); margin-bottom: 10px; letter-spacing: 0.04em; }

.activity-item {
  font-size: 12px;
  color: var(--gray-600);
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-item .when { color: var(--gray-400); }

/* ===== Alerts / flash ===== */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
}
.alert-success { background: #E7F7EC; color: #2E9E52; border: 1px solid #bfe9cc; }
.alert-error { background: #FDECEC; color: #c0392b; border: 1px solid #f5c6c6; }
.alert-info { background: #E7F6FB; color: var(--cyan-dark); border: 1px solid #bfe7f0; }

/* Login role toggle */
.role-toggle {
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 24px;
}
.role-toggle a {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
}
.role-toggle a.active { background: var(--navy); color: white; }

/* Responsive nav */
@media (max-width: 720px) {
  .navbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .nav-links { gap: 14px; flex-wrap: wrap; }
  main.content { padding: 24px 14px 40px; }
  .form-row { flex-direction: column; }
}

.section-divider { height: 1px; background: var(--gray-200); margin: 26px 0; }

.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
