/* ── KC NETWORK TECH — SUPPORT PORTAL STYLESHEET ── */
/* Mirrors kcnetwork.tech design system exactly */

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

:root {
  --navy:    #0b1a2e;
  --navy2:   #112440;
  --navy3:   #1a3459;
  --blue:    #2563eb;
  --blue2:   #3b82f6;
  --sky:     #60a5fa;
  --gold:    #f59e0b;
  --green:   #10b981;
  --red:     #ef4444;
  --orange:  #f97316;
  --white:   #ffffff;
  --offwhite:#f0f4fa;
  --text:    #e2e8f4;
  --muted:   #94a3b8;
  --border:  rgba(255,255,255,0.08);
  --card:    rgba(255,255,255,0.04);
  --glow:    rgba(37,99,235,0.25);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--navy);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── NOISE TEXTURE ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── SHARED NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  background: rgba(11,26,46,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-brand span { color: var(--sky); }

.nav-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: rgba(37,99,235,0.18);
  border: 1px solid rgba(37,99,235,0.3);
  color: var(--sky);
  padding: 3px 8px;
  border-radius: 20px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.nav-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(37,99,235,0.2);
  border: 1px solid rgba(37,99,235,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--sky);
}

.nav-link-plain {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link-plain:hover { color: var(--white); }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--blue);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 9px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(37,99,235,0.3);
  font-family: 'DM Sans', sans-serif;
}
.btn-primary:hover { background: var(--blue2); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 9px;
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.25); color: var(--white); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--sky);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid rgba(96,165,250,0.2);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-ghost:hover { background: rgba(96,165,250,0.08); border-color: rgba(96,165,250,0.4); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,68,68,0.1);
  color: #f87171;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 7px;
  border: 1px solid rgba(239,68,68,0.2);
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

/* ── FORM ELEMENTS ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(37,99,235,0.6);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #4a5568; }

.form-group select option { background: var(--navy2); }
.form-group textarea { resize: vertical; min-height: 90px; }

/* ── STATUS BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 20px;
}

.badge-open {
  background: rgba(37,99,235,0.15);
  color: var(--sky);
  border: 1px solid rgba(37,99,235,0.25);
}
.badge-open::before { content: '●'; font-size: 7px; }

.badge-progress {
  background: rgba(249,115,22,0.15);
  color: #fb923c;
  border: 1px solid rgba(249,115,22,0.25);
}
.badge-progress::before { content: '●'; font-size: 7px; }

.badge-resolved {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}
.badge-resolved::before { content: '●'; font-size: 7px; }

.badge-waiting {
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.2);
}
.badge-waiting::before { content: '●'; font-size: 7px; }

.badge-paid {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}

.badge-unpaid {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
}

.badge-high {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
}
.badge-medium {
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.2);
}
.badge-low {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}

/* ── CARDS ── */
.card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.card-sm {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #f87171; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: #34d399; }
.alert-info { background: rgba(37,99,235,0.1); border: 1px solid rgba(37,99,235,0.2); color: var(--sky); }
.alert:empty { display: none; }

/* ── LOADING SPINNER ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--white); margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.6; max-width: 320px; margin: 0 auto 24px; }

/* ── FOOTER ── */
.portal-footer {
  background: var(--navy);
  border-top: 1px solid var(--border);
  padding: 24px 5%;
  text-align: center;
  position: relative;
  z-index: 1;
  margin-top: auto;
}

.portal-footer p {
  font-size: 12px;
  color: var(--muted);
}
.portal-footer a {
  color: var(--sky);
  text-decoration: none;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav { padding: 0 4%; }
  .nav-user span { display: none; }
}

/* ═══════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px;
  position: relative;
}

.login-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.login-box {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--white);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.login-logo span { color: var(--sky); }

.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 12px;
  color: var(--muted);
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-hubspot-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 122, 0, 0.1);
  border: 1px solid rgba(255, 122, 0, 0.25);
  color: #ff7a00;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
}
.login-hubspot-btn:hover { background: rgba(255, 122, 0, 0.16); }

.login-submit {
  width: 100%;
  background: var(--blue);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 4px 24px rgba(37,99,235,0.3);
}
.login-submit:hover { background: var(--blue2); transform: translateY(-1px); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 20px;
}
.login-footer-note a { color: var(--sky); text-decoration: none; }

/* ═══════════════════════════════════════════
   PORTAL LAYOUT (DASHBOARD, TICKET, PAYMENT)
═══════════════════════════════════════════ */

.portal-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 68px;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--navy2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 68px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 20px 16px 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 8px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.sidebar-nav a.active {
  background: rgba(37,99,235,0.12);
  color: var(--sky);
  font-weight: 600;
}

.sidebar-nav-icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-count {
  margin-left: auto;
  background: rgba(37,99,235,0.2);
  color: var(--sky);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(37,99,235,0.2);
  border: 1px solid rgba(37,99,235,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--sky);
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── MAIN CONTENT ── */
.portal-main {
  flex: 1;
  margin-left: 250px;
  padding: 36px 40px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  color: var(--white);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
}

/* ── STATS ROW ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.blue::before { background: linear-gradient(90deg, var(--blue), var(--sky)); }
.stat-card.green::before { background: linear-gradient(90deg, #059669, #34d399); }
.stat-card.orange::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.stat-card.red::before { background: linear-gradient(90deg, #dc2626, #f87171); }

.stat-card-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card-value {
  font-family: 'DM Serif Display', serif;
  font-size: 36px;
  color: var(--white);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ── TICKET TABLE ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
}

.tickets-table-wrap {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 28px;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
}

.tickets-table th {
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.tickets-table td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.tickets-table tr:hover td { background: rgba(255,255,255,0.02); }

.ticket-link {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.ticket-link:hover { color: var(--sky); }

.ticket-id {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── TICKET DETAIL ── */
.ticket-detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.ticket-conversation { display: flex; flex-direction: column; gap: 16px; }

.message-block {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.message-block.staff {
  border-color: rgba(37,99,235,0.2);
  background: rgba(37,99,235,0.05);
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.message-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.message-avatar.client { background: rgba(37,99,235,0.2); border: 1px solid rgba(37,99,235,0.3); color: var(--sky); }
.message-avatar.staff { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.25); color: #34d399; }

.message-sender { font-size: 13px; font-weight: 600; color: var(--white); }
.message-time { font-size: 12px; color: var(--muted); margin-left: auto; }
.message-body { font-size: 14px; color: var(--text); line-height: 1.7; }

.reply-box {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.reply-box h4 { font-size: 14px; font-weight: 600; color: var(--white); margin-bottom: 14px; }

/* ── TICKET SIDEBAR META ── */
.ticket-meta { display: flex; flex-direction: column; gap: 16px; }

.meta-card {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.meta-card h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.meta-row:last-child { border-bottom: none; }
.meta-row-label { color: var(--muted); }
.meta-row-value { color: var(--white); font-weight: 500; text-align: right; max-width: 60%; }

/* ── PAYMENT PAGE ── */
.invoices-section { margin-bottom: 28px; }

.invoice-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.invoice-row:hover { background: rgba(255,255,255,0.02); }
.invoice-row:last-child { border-bottom: none; }

.invoice-icon {
  width: 42px; height: 42px;
  background: rgba(37,99,235,0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.invoice-info { flex: 1; }
.invoice-name { font-size: 14px; font-weight: 600; color: var(--white); margin-bottom: 3px; }
.invoice-date { font-size: 12px; color: var(--muted); }

.invoice-amount {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--white);
  margin-right: 12px;
}

.payment-form-box {
  background: var(--navy2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}

.payment-form-box h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 6px;
}

.payment-form-box p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

#stripe-card-element {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

#stripe-card-element.StripeElement--focus { border-color: rgba(37,99,235,0.6); }

.pay-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-bottom: 16px;
}

.pay-total-label { font-size: 14px; color: var(--muted); }
.pay-total-amount { font-family: 'DM Serif Display', serif; font-size: 28px; color: var(--white); }

.stripe-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}

/* ── RESPONSIVE (PORTAL) ── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .portal-main { margin-left: 0; padding: 24px 20px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .ticket-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .login-box { padding: 32px 24px; }
}
