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

/* ══════════════════════════════════════════════
   WinnSS Support Dashboard — Mobile-First CSS
   Brand: WinnSS green palette (winnss.com)
   ══════════════════════════════════════════════ */

:root {
  --bg-primary:    #131A16;
  --bg-card:       #1C2A22;
  --bg-surface:    rgba(255,255,255,0.04);
  --bg-deep:       #0C1210;
  --accent-green:  #2D6A4F;
  --accent-light:  #52B788;
  --accent-warm:   #1B4332;
  --accent-dim:    rgba(82,183,136,0.15);
  --accent-glow:   rgba(45,106,79,0.35);
  --accent-blue:   #1e6fd9;
  --text-primary:  #FFFFFF;
  --text-muted:    #7A9186;
  --border:        rgba(255,255,255,0.10);
  --border-faint:  rgba(255,255,255,0.06);
  --border-bright: rgba(255,255,255,0.10);
  --accent-border: rgba(45,106,79,0.35);
  --priority-critical: #f85149;
  --priority-high:     #d29922;
  --priority-medium:   #1e6fd9;
  --priority-low:      #3fb950;
  --radius: 10px;
  --radius-sm: 5px;
  --shadow-card: 0 2px 12px rgba(0,0,0,.55), 0 1px 3px rgba(0,0,0,.4);
  --shadow-hover: 0 6px 24px rgba(0,0,0,.7), 0 2px 8px rgba(45,106,79,0.18);
  --transition: .18s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; color: #74cfa3; }

/* ── Layout ── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Topbar ── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 0.3px;
  white-space: nowrap;
  position: relative;
  padding-bottom: 2px;
}

/* Green accent line under logo */
.topbar-logo::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-light), transparent);
  border-radius: 1px;
}

.topbar-logo span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
  margin-left: 6px;
  font-family: 'Inter', sans-serif;
}

/* Hamburger button — shown on mobile */
.topbar-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.topbar-hamburger:hover { background: var(--bg-surface); }
.topbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}
/* Open state */
.topbar-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.topbar-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav drawer */
.topbar-nav {
  display: none;
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 12px;
  z-index: 99;
}
.topbar-nav.nav-open { display: flex; }

.nav-link {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  border-left: 3px solid transparent;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}
.nav-link.active {
  color: var(--accent-light);
  background: var(--accent-dim);
  border-left-color: var(--accent-light);
}

/* Topbar user — hidden on mobile to save space */
.topbar-user {
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-green);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}

/* ── Main content ── */
.main-content {
  flex: 1;
  padding: 16px;
  width: 100%;
  margin: 0 auto;
  max-width: 1400px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .9px;
  margin-bottom: 16px;
}

/* ── Stat Cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  cursor: default;
}
.stat-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-card.critical .stat-value { color: var(--priority-critical); }
.stat-card.high .stat-value { color: var(--priority-high); }
.stat-card.low .stat-value { color: var(--priority-low); }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; min-width: 520px; }

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-card);
}

td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border-faint);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { cursor: pointer; transition: background var(--transition); }
tbody tr:hover { background: var(--bg-surface); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge-critical { background: rgba(248,81,73,.2);  color: #ff6b63; border: 1px solid rgba(248,81,73,.45); }
.badge-high     { background: rgba(210,153,34,.2);  color: #e8ae3a; border: 1px solid rgba(210,153,34,.45); }
.badge-medium   { background: rgba(30,111,217,.2);  color: #5b9cf6; border: 1px solid rgba(30,111,217,.45); }
.badge-low      { background: rgba(63,185,80,.2);   color: #4dd862; border: 1px solid rgba(63,185,80,.45); }

.badge-open       { background: rgba(30,111,217,.2);  color: #6db3ff; border: 1px solid rgba(30,111,217,.45); }
.badge-inprogress { background: rgba(82,183,136,.18); color: #52B788; border: 1px solid rgba(82,183,136,.40); }
.badge-resolved   { background: rgba(63,185,80,.2);   color: #4dd862; border: 1px solid rgba(63,185,80,.45); }
.badge-closed     { background: rgba(139,148,158,.12); color: #9ea8b4; border: 1px solid rgba(139,148,158,.28); }

.badge-bug            { background: rgba(248,81,73,.12);  color: #f87171; border: 1px solid rgba(248,81,73,.28); }
.badge-featurerequest { background: rgba(139,92,246,.15);  color: #b09ef5; border: 1px solid rgba(139,92,246,.32); }
.badge-billing        { background: rgba(82,183,136,.15);  color: #52B788; border: 1px solid rgba(82,183,136,.32); }
.badge-hosting        { background: rgba(20,184,166,.15);  color: #2dd4bf; border: 1px solid rgba(20,184,166,.32); }
.badge-generalsupport { background: rgba(30,111,217,.12);  color: #60a5fa; border: 1px solid rgba(30,111,217,.28); }
.badge-urgent         { background: rgba(248,81,73,.25);   color: #ff6b63; border: 1px solid rgba(248,81,73,.5); }
.badge-unknown        { background: rgba(139,148,158,.1);  color: #8b949e; border: 1px solid rgba(139,148,158,.2); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  white-space: nowrap; font-family: inherit;
}
.btn-primary   { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.btn-primary:hover { background: #1a5fc7; border-color: #1a5fc7; }
.btn-gold      { background: var(--accent-green); color: #fff; border-color: var(--accent-green); font-weight: 600; }
.btn-gold:hover { background: #255c44; border-color: #255c44; }
.btn-outline   { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-surface); border-color: var(--accent-light); }
.btn-danger    { background: transparent; color: var(--priority-critical); border-color: rgba(248,81,73,.4); }
.btn-danger:hover { background: rgba(248,81,73,.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }

input, select, textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.12);
}
select option { background: var(--bg-card); }

/* ── Ticket Detail Layout ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.info-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.info-label { font-size: 11px; color: var(--text-muted); font-weight: 500; min-width: 100px; padding-top: 1px; }
.info-value { font-size: 13px; color: var(--text-primary); }

.email-quote {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.7;
}

.email-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

.ai-summary { font-size: 14px; color: var(--text-primary); line-height: 1.7; margin-bottom: 12px; }
.ai-suggestion {
  background: rgba(30,111,217,.07);
  border: 1px solid rgba(30,111,217,.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.7;
}
.ai-suggestion-label { font-size: 11px; color: var(--accent-blue); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }

.confidence-bar { margin-top: 10px; }
.confidence-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.confidence-track { background: var(--bg-surface); border-radius: 4px; height: 4px; }
.confidence-fill  { background: var(--accent-light); height: 4px; border-radius: 4px; transition: width .4s ease; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
  padding: 0;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 100%;
  padding: 24px 20px;
  box-shadow: 0 -8px 32px rgba(0,0,0,.6);
}
.modal-title { font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 600; margin-bottom: 20px; letter-spacing: 0.3px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ── Page header ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-title  { font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 700; letter-spacing: 0.3px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Filters ── */
.filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.filters select { width: 100%; }
.filters input  { width: 100%; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }

/* ── Loading ── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-light);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-muted); }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 20px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .2s ease;
  min-width: 220px;
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
}
.toast.success { border-left: 3px solid var(--priority-low); }
.toast.error   { border-left: 3px solid var(--priority-critical); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Login page ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-deep);
  padding: 20px;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--accent-border);
  border-radius: var(--radius); padding: 40px 32px; max-width: 400px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.login-logo { font-family: 'Barlow Condensed', sans-serif; font-size: 32px; font-weight: 700; color: var(--accent-light); margin-bottom: 8px; letter-spacing: 0.5px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.login-btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* ══════════════════════════════════════════════
   Tablet — ≥ 640px
   ══════════════════════════════════════════════ */
@media (min-width: 640px) {
  .topbar { padding: 0 24px; gap: 24px; }
  .main-content { padding: 20px 24px; }

  .stats-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
  }

  .filters {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .filters select { width: auto; min-width: 130px; }
  .filters input  { width: auto; min-width: 200px; flex: 1; }

  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
  .modal {
    border-radius: var(--radius);
    max-width: 520px;
  }

  .page-title { font-size: 24px; }
}

/* ══════════════════════════════════════════════
   Desktop — ≥ 900px
   ══════════════════════════════════════════════ */
@media (min-width: 900px) {
  .topbar { gap: 32px; }

  /* Hide hamburger, show inline nav */
  .topbar-hamburger { display: none; }
  .topbar-nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    border: none;
    padding: 0;
    gap: 4px;
    background: transparent;
    flex: 1;
  }
  .nav-link {
    padding: 6px 12px;
    font-size: 13px;
    border-left: none;
  }
  .nav-link.active {
    border-left: none;
    border-bottom: 2px solid var(--accent-light);
    border-radius: 0;
    background: transparent;
    color: var(--accent-light);
  }
  .nav-link:hover {
    background: var(--bg-surface);
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm);
  }

  .topbar-user { display: flex; }

  .main-content { padding: 24px 32px; }

  .detail-grid {
    grid-template-columns: 1fr 320px;
    gap: 20px;
  }

  .stat-value { font-size: 32px; }
}

/* ══════════════════════════════════════════════
   Wide Desktop — ≥ 1200px
   ══════════════════════════════════════════════ */
@media (min-width: 1200px) {
  .main-content { padding: 28px 40px; }
  .card { padding: 22px 24px; }
}
