/* ══════════════════════════════════════════
   OptiNC Helpdesk – Stylesheet v2.0
   ══════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --hd-blue:     #3B82F6;
  --hd-blue-dk:  #2563EB;
  --hd-dark:     #3D3D4E;
  --hd-dark-hov: #2e2e3c;
  --hd-bg:       #F5F5F5;
  --hd-white:    #FFFFFF;
  --hd-border:   #E2E8F0;
  --hd-text:     #1A202C;
  --hd-muted:    #64748B;
  --hd-radius:   8px;
  --hd-shadow:   0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --hd-nav-h:    60px;

  /* status */
  --hd-open-bg:      #EBF3FF; --hd-open-color:   #1D4ED8;
  --hd-wc-bg:        #FFF4E5; --hd-wc-color:     #C05200;
  --hd-ws-bg:        #F3EFFF; --hd-ws-color:     #5B21B6;
  --hd-closed-bg:    #F1F5F9; --hd-closed-color: #475569;
}

/* ── App shell ── */
.hd-app { font-family:'Segoe UI',system-ui,-apple-system,sans-serif; color:var(--hd-text); background:var(--hd-bg); min-height:69.6532vh; display:flex; flex-direction:column; }
.hd-app *, .hd-app *::before, .hd-app *::after { box-sizing:border-box; }

/* ── Navbar ── */
.hd-navbar { background:var(--hd-white); border-bottom:1px solid var(--hd-border); height:var(--hd-nav-h); flex-shrink:0; position:sticky; top:0; z-index:100; }
.hd-navbar-inner { max-width:1200px; margin:0 auto; padding:0 24px; height:100%; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.hd-navbar-left { display:flex; align-items:center; gap:0; height:100%; }
.hd-navbar-right { display:flex; align-items:center; gap:12px; }
.hd-navbar-divider { width:1px; background:var(--hd-border); height:28px; margin:0 20px; }

/* Logo */
.hd-nav-logo { display:flex; align-items:center; }
.hd-logo-img { height:36px; width:auto; display:block; }
.hd-logo-fallback { display:flex; align-items:baseline; gap:0; font-size:1.3rem; font-weight:900; }
.hd-logo-opti { color:var(--hd-blue); }
.hd-logo-nc   { color:var(--hd-text); }

/* Nav links */
.hd-nav-link { display:inline-flex; align-items:center; gap:6px; padding:0 14px; height:var(--hd-nav-h); font-size:.88rem; font-weight:600; color:var(--hd-muted); text-decoration:none; border-bottom:2px solid transparent; transition:color .15s,border-color .15s; }
.hd-nav-link:hover { color:var(--hd-text); }
.hd-nav-link--active { color:var(--hd-text); border-bottom-color:var(--hd-text); }

/* User info + logout in navbar */
.hd-nav-user    { display:flex; align-items:center; gap:10px; }
.hd-nav-avatar  { width:32px; height:32px; border-radius:50%; background:#CBD5E1; color:var(--hd-muted); display:flex; align-items:center; justify-content:center; font-size:.8rem; font-weight:700; flex-shrink:0; }
.hd-nav-greeting { font-size:.88rem; color:var(--hd-muted); }
.hd-nav-greeting strong { color:var(--hd-text); }

/* ── Main content ── */
.hd-main { flex:1; max-width:1200px; width:100%; margin:0 auto; padding:32px 24px 60px; }

/* ── Page header ── */
.hd-page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; gap:12px; }
.hd-page-title { font-size:1.5rem; font-weight:800; margin:0; color:var(--hd-text); }

/* ── Tabs ── */
.hd-tabs { display:flex; border-bottom:2px solid var(--hd-border); margin-bottom:24px; gap:0; }
.hd-tab { background:none; border:none; border-bottom:2px solid transparent; margin-bottom:-2px; padding:10px 20px; font-size:.82rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--hd-muted); cursor:pointer; transition:color .15s,border-color .15s; }
.hd-tab--active { color:var(--hd-text); border-bottom-color:var(--hd-text); }

/* ── Ticket list ── */
.hd-ticket-list { display:flex; flex-direction:column; border:1px solid var(--hd-border); border-radius:var(--hd-radius); overflow:hidden; background:var(--hd-white); }
.hd-ticket-row { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; text-decoration:none; color:var(--hd-text); border-bottom:1px solid var(--hd-border); gap:16px; transition:background .12s; }
.hd-ticket-row:last-child { border-bottom:none; }
.hd-ticket-row:hover { background:#F8FAFC; }
.hd-ticket-row--closed { opacity:.6; }
.hd-ticket-row-main { display:flex; align-items:center; gap:12px; min-width:0; flex:1; }
.hd-ticket-row-subject { font-size:.93rem; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hd-ticket-row-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; flex-shrink:0; }

/* ── Chips ── */
.hd-chip { display:inline-flex; align-items:center; padding:3px 10px; border-radius:20px; font-size:.75rem; font-weight:700; border:1px solid; }
.hd-chip--type { background:#EDF2FF; color:#3730A3; border-color:#C7D2FE; }
.hd-chip--priority { /* color/bg set inline */ }

/* ── Status badges ── */
.hd-badge { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:20px; font-size:.75rem; font-weight:700; }
.hd-badge--open             { background:var(--hd-open-bg);   color:var(--hd-open-color); }
.hd-badge--waiting_customer { background:var(--hd-wc-bg);     color:var(--hd-wc-color); }
.hd-badge--waiting_support  { background:var(--hd-ws-bg);     color:var(--hd-ws-color); }
.hd-badge--closed           { background:var(--hd-closed-bg); color:var(--hd-closed-color); }

/* ── Ticket number ── */
.hd-ticket-num { font-family:monospace; font-size:.82rem; background:var(--hd-bg); padding:2px 8px; border-radius:4px; color:var(--hd-blue); flex-shrink:0; }

/* ── Date ── */
.hd-date { color:var(--hd-muted); font-size:.80rem; white-space:nowrap; }

/* ── Empty state ── */
.hd-empty-state { background:var(--hd-white); border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:64px 24px; text-align:center; }
.hd-empty-state svg { display:block; margin:0 auto 24px; }
.hd-empty-title { font-size:1.1rem; font-weight:700; margin:0 0 10px; color:var(--hd-text); }
.hd-empty-sub { color:var(--hd-muted); font-size:.9rem; margin:0 0 24px; line-height:1.7; }

/* ── Ticket detail ── */
.hd-ticket-detail-header { background:var(--hd-white); border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:20px 24px; margin-bottom:24px; }
.hd-ticket-detail-top { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:8px; }
.hd-ticket-detail-badges { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.hd-ticket-detail-title { font-size:1.25rem; font-weight:800; margin:0; }

/* ── Thread ── */
.hd-thread { display:flex; flex-direction:column; gap:12px; margin-bottom:24px; max-width:860px; }
.hd-bubble { border-radius:var(--hd-radius); padding:16px 20px; }
.hd-bubble--client { background:#F0F7FF; border:1px solid #C7DFFF; }
.hd-bubble--admin  { background:var(--hd-white); border:1px solid var(--hd-border); }
.hd-bubble-meta    { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; gap:10px; }
.hd-bubble-sender  { font-weight:700; font-size:.85rem; }
.hd-bubble-time    { font-size:.78rem; color:var(--hd-muted); white-space:nowrap; }
.hd-bubble-body    { font-size:.93rem; line-height:1.7; white-space:pre-line; }
.hd-attachments    { margin-top:10px; display:flex; flex-wrap:wrap; gap:8px; }
.hd-attach-link    { display:inline-flex; align-items:center; gap:5px; font-size:.82rem; background:var(--hd-bg); border:1px solid var(--hd-border); padding:4px 10px; border-radius:6px; text-decoration:none; color:var(--hd-blue); }
.hd-attach-link:hover { background:var(--hd-blue); color:#fff; border-color:var(--hd-blue); }

/* ── Reply card ── */
.hd-reply-card { background:var(--hd-white); border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:20px 24px; max-width:860px; }
.hd-reply-card textarea { width:100%; padding:12px 14px; border:1px solid var(--hd-border); border-radius:var(--hd-radius); font-size:.93rem; resize:vertical; min-height:100px; outline:none; font-family:inherit; transition:border-color .15s; }
.hd-reply-card textarea:focus { border-color:var(--hd-blue); box-shadow:0 0 0 3px rgba(59,130,246,.12); }
.hd-reply-actions { display:flex; align-items:center; justify-content:space-between; margin-top:12px; flex-wrap:wrap; gap:10px; }
.hd-closed-notice { background:var(--hd-closed-bg); color:var(--hd-closed-color); border-radius:var(--hd-radius); padding:14px 18px; font-size:.9rem; max-width:860px; }

/* ── Login screen ── */
.hd-login-screen { flex:1; display:flex; align-items:center; justify-content:center; padding:40px 16px; }
.hd-login-card { background:var(--hd-white); border-radius:12px; box-shadow:var(--hd-shadow); padding:44px 40px; width:100%; max-width:400px; }
.hd-login-logo { display:flex; justify-content:center; margin-bottom:28px; }
.hd-login-title { font-size:1.35rem; font-weight:800; margin:0 0 28px; text-align:center; color:var(--hd-text); }
.hd-login-sub { font-size:.88rem; color:var(--hd-muted); margin:0 0 20px; }

/* ── Form fields ── */
.hd-field { margin-bottom:18px; }
.hd-field label { display:block; font-size:.88rem; font-weight:600; margin-bottom:6px; color:var(--hd-text); }
.hd-field input,
.hd-field textarea { width:100%; padding:11px 14px; border:1px solid var(--hd-border); border-radius:var(--hd-radius); font-size:.93rem; outline:none; transition:border-color .15s; background:var(--hd-bg); color:var(--hd-text); font-family:inherit; }
.hd-field input:focus,
.hd-field textarea:focus { background:var(--hd-white); border-color:var(--hd-blue); box-shadow:0 0 0 3px rgba(59,130,246,.12); }
.hd-select-wrap { position:relative; }
.hd-select-wrap::after { content:''; position:absolute; right:14px; top:50%; transform:translateY(-50%); width:0; height:0; border-left:5px solid transparent; border-right:5px solid transparent; border-top:6px solid var(--hd-muted); pointer-events:none; }
.hd-field select { width:100%; padding:11px 36px 11px 14px; border:1px solid var(--hd-border); border-radius:var(--hd-radius); font-size:.93rem; outline:none; appearance:none; background:var(--hd-bg); color:var(--hd-text); transition:border-color .15s; cursor:pointer; }
.hd-field select:focus { background:var(--hd-white); border-color:var(--hd-blue); box-shadow:0 0 0 3px rgba(59,130,246,.12); }
.hd-required { color:#E53E3E; }

/* ── Buttons ── */
.hd-app .hd-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 22px; border-radius: var(--hd-radius);
  font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none;
  border: none; white-space: nowrap; font-family: inherit;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  outline: none; appearance: none; -webkit-appearance: none;
}
.hd-app .hd-btn:active   { transform: scale(.98); }
.hd-app .hd-btn:disabled,
.hd-app .hd-btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.hd-app .hd-btn--full { width: 100%; }
.hd-app .hd-btn--dark,
.hd-app .hd-btn--dark:visited,
.hd-app .hd-btn--dark:link  { background: var(--hd-dark) !important; color: #ffffff !important; border: none !important; }
.hd-app .hd-btn--dark:hover,
.hd-app .hd-btn--dark:focus { background: var(--hd-dark-hov) !important; color: #ffffff !important; }
.hd-app .hd-btn--outline,
.hd-app .hd-btn--outline:visited { background: transparent !important; color: var(--hd-text) !important; border: 1.5px solid var(--hd-border) !important; }
.hd-app .hd-btn--outline:hover,
.hd-app .hd-btn--outline:focus  { background: var(--hd-bg) !important; color: var(--hd-text) !important; border-color: #CBD5E1 !important; }
.hd-app .hd-btn--sm { padding: 7px 14px; font-size: .82rem; }
/* Danger buttons (admin, outside .hd-app) */
.hd-btn--danger      { display:inline-flex; align-items:center; gap:6px; padding:9px 18px; border-radius:var(--hd-radius); font-size:.88rem; font-weight:600; cursor:pointer; background:#FFF5F5 !important; color:#C53030 !important; border:1.5px solid #FEB2B2 !important; transition:all .15s; }
.hd-btn--danger:hover      { background:#C53030 !important; color:#fff !important; border-color:#C53030 !important; }
.hd-btn--danger-hard { display:inline-flex; align-items:center; gap:6px; padding:9px 18px; border-radius:var(--hd-radius); font-size:.88rem; font-weight:600; cursor:pointer; background:#C53030 !important; color:#fff !important; border:1.5px solid #C53030 !important; transition:all .15s; }
.hd-btn--danger-hard:hover { background:#9B1C1C !important; color:#fff !important; border-color:#9B1C1C !important; }
.hd-danger-zone { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:24px; padding-top:20px; border-top:2px solid #FEB2B2; }

/* ── Form card (new ticket) ── */
.hd-form-card { background:var(--hd-white); border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:28px 32px; max-width:640px; }
.hd-form-actions { margin-top:8px; }

/* ── File input ── */
.hd-file-input { display:none; }
.hd-file-label-btn {
  display:inline-flex; align-items:center; gap:7px;
  cursor:pointer; font-size:.88rem; font-weight:600; color:var(--hd-muted);
  background:var(--hd-white); border:1.5px solid var(--hd-border);
  border-radius:var(--hd-radius); padding:9px 18px;
  transition:background .15s, border-color .15s, color .15s;
  user-select:none;
}
.hd-file-label-btn:hover { border-color:var(--hd-blue); color:var(--hd-blue); background:#F0F7FF; }
.hd-file-list { margin-top:10px; display:flex; flex-wrap:wrap; gap:8px; }
.hd-file-chip { display:inline-flex; align-items:center; gap:5px; background:#f0f5ff; border:1px solid #c7d9f8; border-radius:20px; padding:3px 10px 3px 8px; font-size:.80rem; color:#2d5b99; max-width:260px; }
.hd-file-chip-icon { font-size:.85rem; flex-shrink:0; }
.hd-file-chip-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:160px; font-weight:500; }
.hd-file-chip-size { color:#7a9cc5; flex-shrink:0; font-size:.75rem; }

/* ── Messages / alerts ── */
.hd-msg { margin-top:12px; font-size:.88rem; min-height:18px; }
.hd-msg--ok  { color:#276749; }
.hd-msg--err { color:#C53030; }

/* ── Error ── */
.hd-error { background:#FFF5F5; color:#C53030; border:1px solid #FEB2B2; border-radius:var(--hd-radius); padding:20px; margin:30px auto; max-width:500px; text-align:center; }

/* ── Admin (keep old wrap for backward compat) ── */
.hd-wrap { font-family:'Segoe UI',system-ui,sans-serif; color:var(--hd-text); max-width:1100px; margin:0 auto; padding:0 16px 60px; }
.hd-wrap *, .hd-wrap *::before, .hd-wrap *::after { box-sizing:border-box; }
.hd-admin-title { font-size:1.5rem; font-weight:800; margin-bottom:20px; }
.hd-admin-form-box { background:#fff; border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:20px 24px; margin-bottom:28px; }
.hd-admin-form-box h2 { margin:0 0 16px; font-size:1rem; }
.hd-admin-stats { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:20px; }
.hd-stat-card { display:flex; flex-direction:column; gap:6px; background:#fff; border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:16px 22px; text-decoration:none; color:var(--hd-text); min-width:130px; transition:box-shadow .15s; }
.hd-stat-card:hover { box-shadow:var(--hd-shadow); }
.hd-stat-active { border-color:var(--hd-blue); background:var(--hd-open-bg); }
.hd-stat-count { font-size:1.9rem; font-weight:800; line-height:1; }
.hd-admin-ticket-header { display:flex; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:16px 20px; background:#fff; border:1px solid var(--hd-border); border-radius:var(--hd-radius); margin-bottom:20px; }
.hd-admin-select { padding:6px 10px; border:1px solid var(--hd-border); border-radius:6px; font-size:.88rem; }
.hd-admin-messages .hd-message, .hd-admin-messages .hd-bubble { max-width:100%; }
.hd-admin-reply textarea { width:100%; min-height:100px; padding:12px; border:1px solid var(--hd-border); border-radius:8px; font-size:.93rem; }
.hd-admin-form-box .hd-file-label-btn { display:inline-flex; }
.hd-table-wrap { overflow-x:auto; border:1px solid var(--hd-border); border-radius:var(--hd-radius); }
.hd-table { width:100%; border-collapse:collapse; font-size:.9rem; }
.hd-table thead th { padding:12px 16px; text-align:left; font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--hd-muted); background:var(--hd-bg); border-bottom:1px solid var(--hd-border); }
.hd-table tbody td { padding:12px 16px; border-bottom:1px solid var(--hd-border); vertical-align:middle; }
.hd-table-row { cursor:pointer; transition:background .1s; }
.hd-table-row:hover { background:var(--hd-bg); }
/* legacy message styles for admin */
.hd-message { border-radius:var(--hd-radius); padding:18px 22px; max-width:760px; }
.hd-message--client { background:#F0F7FF; border:1px solid #C7DFFF; }
.hd-message--admin  { background:#FFFFFF; border:1px solid var(--hd-border); }
.hd-message--email  { background:#FFF8F0; border:1px solid #FFD8A8; }
.hd-message-meta    { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; gap:12px; }
.hd-sender          { font-weight:700; font-size:.85rem; }
.hd-msg-time        { font-size:.78rem; color:var(--hd-muted); white-space:nowrap; }
.hd-message-body    { font-size:.93rem; line-height:1.7; white-space:pre-line; }
.hd-messages        { display:flex; flex-direction:column; gap:14px; margin-bottom:28px; }
.hd-reply-box       { background:var(--hd-white); border:1px solid var(--hd-border); border-radius:var(--hd-radius); padding:24px; }
.hd-reply-box h3    { margin:0 0 14px; font-size:1rem; }
.hd-reply-box textarea { width:100%; padding:12px; border:1px solid var(--hd-border); border-radius:8px; font-size:.93rem; resize:vertical; min-height:100px; }
.hd-form-row        { display:flex; align-items:center; justify-content:space-between; margin-top:12px; flex-wrap:wrap; gap:10px; }
.hd-btn--primary    { background:var(--hd-blue); color:#fff; }
.hd-btn--primary:hover { background:var(--hd-blue-dk); color:#fff; }
.hd-btn--ghost      { background:transparent; color:var(--hd-text); border:1px solid var(--hd-border); }
.hd-btn--ghost:hover { background:var(--hd-bg); }

/* ── Responsive ── */
@media (max-width:640px) {
  .hd-navbar-inner { padding:0 16px; }
  .hd-main { padding:20px 16px 48px; }
  .hd-login-card { padding:32px 20px; }
  .hd-form-card  { padding:20px 18px; }
  .hd-ticket-row { flex-direction:column; align-items:flex-start; }
  .hd-ticket-row-meta { margin-top:6px; }
  .hd-reply-actions { flex-direction:column; align-items:flex-start; }
  .hd-nav-greeting { display:none; }
}


