/* ============================================================
   SIMPLY SMART PORTAL — MASTER STYLESHEET
   Brand: Electric Blue #3BB8F3 on Deep Black #080A0D
   ============================================================ */

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

:root {
  --blue: #3BB8F3;
  --blue-dark: #1a8fd1;
  --blue-glow: rgba(59, 184, 243, 0.15);
  --black: #080A0D;
  --surface: #0f1318;
  --surface2: #161c24;
  --surface3: #1e2530;
  --border: rgba(59, 184, 243, 0.12);
  --border-bright: rgba(59, 184, 243, 0.35);
  --text: #e8edf3;
  --text-muted: #5a6a7a;
  --text-dim: #8a9aaa;
  --green: #22d3a0;
  --amber: #f59e0b;
  --red: #ef4444;
  --font: 'Barlow', sans-serif;
  --font-display: 'Barlow Condensed', sans-serif;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-blue: 0 0 30px rgba(59,184,243,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--black);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Background grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,184,243,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,184,243,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ── UTILITY ── */
.hidden { display: none !important; }
.page { display: none; }
.page.active { display: block; }

/* ── LOADING SCREEN ── */
#loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--black);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 20px;
}
.loader-logo { width: 80px; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.6;transform:scale(0.96)} }
.loader-bar {
  width: 160px; height: 2px; background: var(--surface3);
  border-radius: 2px; overflow: hidden;
}
.loader-bar::after {
  content: ''; display: block; height: 100%;
  width: 40%; background: var(--blue);
  animation: slide 1s ease-in-out infinite;
}
@keyframes slide { 0%{transform:translateX(-100%)} 100%{transform:translateX(350%)} }

/* ── AUTH PAGE ── */
#auth-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 20px; position: relative; z-index: 1;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 16px; padding: 40px;
  box-shadow: var(--shadow), var(--shadow-blue);
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo img { width: 90px; }
.auth-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 900;
  letter-spacing: 0.05em; text-align: center;
  color: var(--text); margin-bottom: 4px;
}
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--surface3); border-radius: var(--radius);
  color: var(--text); padding: 11px 14px;
  font-family: var(--font); font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--blue); }
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 22px; border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; border: none; transition: all 0.18s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue), #1a8fd1);
  color: #fff; width: 100%;
  box-shadow: 0 4px 16px rgba(59,184,243,0.25);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(59,184,243,0.4); transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--blue);
  border: 1px solid var(--border-bright);
}
.btn-ghost:hover { background: var(--blue-glow); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-sm { padding: 7px 14px; font-size: 11px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 8px; }

/* ── MAIN LAYOUT ── */
#app-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ── SIDEBAR ── */
.sidebar {
  width: 240px; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 50; transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-header img { width: 44px; }
.sidebar-brand { font-family: var(--font-display); font-size: 15px; font-weight: 900; letter-spacing: 0.08em; color: var(--text); line-height: 1.2; }
.sidebar-brand span { color: var(--blue); display: block; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 10px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  cursor: pointer; transition: all 0.15s;
  color: var(--text-dim); font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em; margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--blue-glow); color: var(--blue); border: 1px solid var(--border-bright); }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 14px 10px; border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface2);
  border-radius: 8px; margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #1a8fd1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 700; color: var(--text); }
.user-role { font-size: 10px; color: var(--text-muted); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 240px; flex: 1; min-height: 100vh;
}
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
}
.topbar-title {
  font-family: var(--font-display); font-size: 18px;
  font-weight: 900; letter-spacing: 0.06em; color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 10px;
  font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.badge-blue { background: var(--blue-glow); color: var(--blue); border: 1px solid var(--border-bright); }
.badge-green { background: rgba(34,211,160,0.1); color: var(--green); border: 1px solid rgba(34,211,160,0.3); }
.badge-amber { background: rgba(245,158,11,0.1); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.badge-red { background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }

/* ── PAGE CONTENT ── */
.page-content { padding: 24px; }
.section-title {
  font-family: var(--font-display); font-size: 20px;
  font-weight: 900; letter-spacing: 0.05em; color: var(--text);
  margin-bottom: 16px;
}

/* ── CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-bright); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: linear-gradient(90deg, var(--blue), transparent);
}
.stat-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 900; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── EQUIPMENT TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; font-size: 10px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 14px; font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(59,184,243,0.03); }
.device-icon { font-size: 20px; margin-right: 8px; }

/* ── KNOWLEDGE BASE ── */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.brand-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px;
  text-align: center; cursor: pointer; transition: all 0.2s;
}
.brand-card:hover { border-color: var(--blue); background: var(--blue-glow); transform: translateY(-2px); }
.brand-card .brand-icon { font-size: 32px; margin-bottom: 8px; }
.brand-card .brand-name { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; color: var(--text-dim); }
.article-list { display: flex; flex-direction: column; gap: 8px; }
.article-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; transition: all 0.15s;
}
.article-item:hover { border-color: var(--blue); background: var(--blue-glow); }
.article-item .article-icon { font-size: 18px; flex-shrink: 0; }
.article-title { font-size: 13px; font-weight: 600; color: var(--text); }
.article-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── MESSAGES ── */
.message-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; height: calc(100vh - 120px); }
.message-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; }
.message-thread-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.message-thread-item:hover { background: var(--surface2); }
.message-thread-item.active { background: var(--blue-glow); border-left: 2px solid var(--blue); }
.thread-name { font-size: 13px; font-weight: 700; color: var(--text); }
.thread-preview { font-size: 11px; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-time { font-size: 10px; color: var(--text-muted); }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.message-window { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.message-window-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.messages-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.message-bubble { max-width: 68%; }
.message-bubble.from-us { align-self: flex-end; }
.message-bubble.from-customer { align-self: flex-start; }
.bubble-text {
  padding: 11px 15px; border-radius: 12px; font-size: 13px; line-height: 1.6;
}
.from-us .bubble-text { background: linear-gradient(135deg, var(--blue), #1a8fd1); color: #fff; border-bottom-right-radius: 3px; }
.from-customer .bubble-text { background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-bottom-left-radius: 3px; }
.bubble-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; padding: 0 4px; }
.from-us .bubble-time { text-align: right; }
.message-input-area { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.message-input-area textarea {
  flex: 1; background: var(--surface2); border: 1px solid var(--surface3);
  border-radius: 8px; color: var(--text); padding: 10px 14px;
  font-family: var(--font); font-size: 13px; resize: none; height: 44px;
  outline: none; transition: border-color 0.2s;
}
.message-input-area textarea:focus { border-color: var(--blue); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface); border: 1px solid var(--border-bright);
  border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow), var(--shadow-blue);
  animation: fadeUp 0.25s ease;
}
.modal-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 900; letter-spacing: 0.05em; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px; }
.close-btn:hover { color: var(--text); }

/* ── NOTIFICATION TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border-bright);
  color: var(--text); padding: 12px 22px; border-radius: 8px;
  font-size: 13px; font-weight: 600; z-index: 999;
  box-shadow: var(--shadow); animation: fadeUp 0.2s ease;
  display: flex; align-items: center; gap: 8px;
}

/* ── MOBILE ── */
.hamburger {
  display: none; background: none; border: none;
  color: var(--text); font-size: 22px; cursor: pointer; padding: 4px;
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .message-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── ARTICLE MODAL ── */
.article-content h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 16px 0 8px; }
.article-content p { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 10px; }
.article-content ol, .article-content ul { padding-left: 18px; }
.article-content li { font-size: 13px; color: var(--text-dim); line-height: 1.8; }
.article-content .tip {
  background: var(--blue-glow); border: 1px solid var(--border-bright);
  border-radius: 8px; padding: 12px 14px; margin: 12px 0;
  font-size: 13px; color: var(--blue);
}

/* ── WARRANTY STATUS ── */
.warranty-bar { height: 4px; background: var(--surface3); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.warranty-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--green), var(--blue)); }
// portal.css version bump
