/* ==========================================================
   barox Firmware Portal – Main Stylesheet
   Colors: #002D4E (navy) · #F7A600 (gold) · #063150 (deep navy)
   ========================================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:      #002D4E;
  --deep-navy: #063150;
  --gold:      #F7A600;
  --gold-soft: rgba(247,166,0,.15);
  --gold-border: rgba(247,166,0,.4);
  --text:      #002D4E;
  --muted:     #5a7080;
  --bg:        #f4f7fa;
  --white:     #ffffff;
  --border:    #dce4ea;
  --success:   #1a7f4b;
  --danger:    #c0392b;
  --warn:      #e67e22;
  --radius:    6px;
  --shadow:    0 2px 10px rgba(0,45,78,.10);
}

body {
  font-family: "Helvetica Now", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Flash messages ---- */
.flash {
  padding: 12px 20px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-weight: 500;
}
.flash-success { background: #eaf7ef; border-left: 4px solid var(--success); color: var(--success); }
.flash-error   { background: #fdf0ef; border-left: 4px solid var(--danger);  color: var(--danger); }
.flash-info    { background: #e8f4fd; border-left: 4px solid #2980b9;         color: #1a5f8a; }

/* ==========================================================
   LOGIN PAGE
   ========================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--deep-navy) 0%, var(--navy) 60%, #1a4a6e 100%);
}

.login-box {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-box .logo-wrap {
  margin-bottom: 32px;
}
.login-box .logo-wrap img {
  height: 56px;
  width: auto;
}

.login-box h1 {
  font-size: 22px;
  color: var(--navy);
  margin-bottom: 8px;
}
.login-box .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.login-box .form-group { margin-bottom: 16px; text-align: left; }
.login-box label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.login-box input[type=text],
.login-box input[type=password] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--navy);
  transition: border-color .2s;
  outline: none;
}
.login-box input:focus { border-color: var(--gold); }

.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  letter-spacing: .3px;
}
.btn-primary:hover { background: #e09500; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

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

.btn-wp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  text-decoration: none;
}
.btn-wp:hover { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); text-decoration: none; }

/* ==========================================================
   LAYOUT – ADMIN & CUSTOMER SHARED
   ========================================================== */
.app-wrap {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--deep-navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar .sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .sidebar-logo img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar nav { flex: 1; padding: 12px 0; }

.sidebar .nav-section {
  padding: 16px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.35);
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.72);
  font-size: 13.5px;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(247,166,0,.12);
  color: var(--white);
  border-left-color: var(--gold);
  text-decoration: none;
}
.sidebar .nav-link .icon {
  font-size: 16px;
  opacity: .8;
  width: 20px;
  text-align: center;
}

.sidebar .sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(255,255,255,.4);
}
.sidebar .sidebar-footer a { color: rgba(255,255,255,.6); }
.sidebar .sidebar-footer a:hover { color: var(--gold); }

/* ---- Main content ---- */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar .page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.topbar .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.topbar .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}

.content-area { padding: 28px 32px; flex: 1; }

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

.btn-gold    { background: var(--gold);  color: var(--navy);  border-color: var(--gold); }
.btn-gold:hover { background: #e09500; border-color: #e09500; }

.btn-navy    { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn-navy:hover { background: var(--deep-navy); border-color: var(--deep-navy); }

.btn-outline { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #a93226; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }

/* ==========================================================
   CARDS
   ========================================================== */
.card {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 700; color: var(--navy); }
.card-body { padding: 20px; }

/* ---- Stats cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.stat-card .stat-accent { color: var(--gold); }
.stat-card.stat-published .stat-value { color: var(--success); }
.stat-card.stat-draft .stat-value { color: var(--warn); }
.stat-card.stat-archived .stat-value { color: var(--muted); }

/* ==========================================================
   TABLES
   ========================================================== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ---- Status badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.badge-published { background: #eaf7ef; color: var(--success); }
.badge-draft     { background: #fff8e1; color: #8a6200; }
.badge-archived  { background: #f0f2f4; color: var(--muted); }

/* ==========================================================
   FORMS
   ========================================================== */
.form-grid { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.form-group .req { color: var(--gold); }

input[type=text],
input[type=email],
input[type=password],
input[type=number],
select,
textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--navy);
  background: var(--white);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 2px solid var(--gold);
  padding-bottom: 6px;
  margin: 24px 0 16px;
}

/* ---- File upload zones ---- */
.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.file-drop input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-drop .file-icon { font-size: 24px; margin-bottom: 4px; color: var(--muted); }
.file-drop .file-label { font-size: 12px; color: var(--muted); }
.file-drop .file-name { font-size: 12px; color: var(--navy); font-weight: 600; margin-top: 4px; }

/* ---- Model selection grid ---- */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
}
.model-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.model-check-item:hover { border-color: var(--gold); }
.model-check-item.selected { border-color: var(--gold); background: var(--gold-soft); }
.model-check-item input[type=checkbox] { accent-color: var(--gold); }
.model-check-item .model-label { font-size: 13px; font-weight: 600; color: var(--navy); }
.model-check-item .series-badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--border);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ---- Per-model file upload blocks ---- */
.model-file-blocks { display: grid; gap: 16px; margin-top: 16px; }
.model-file-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.model-file-block .mfb-header {
  background: #f8fafc;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.model-file-block .mfb-header .model-name { font-weight: 700; font-size: 13px; }
.model-file-block .mfb-body { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Notes editor */
.notes-editor-wrap { position: relative; }
.notes-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.notes-toolbar button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  color: var(--navy);
  font-weight: 600;
}
.notes-toolbar button:hover { background: var(--gold-soft); border-color: var(--gold); }
.notes-editor-wrap textarea {
  border-radius: 0 0 var(--radius) var(--radius);
}
.notes-preview {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 120px;
  background: #fafbfc;
  font-size: 13px;
  display: none;
}

/* ==========================================================
   CUSTOMER PORTAL
   ========================================================== */
.portal-header {
  background: var(--deep-navy);
  color: var(--white);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.portal-header img { height: 36px; filter: brightness(0) invert(1); }
.portal-header .user-info { font-size: 13px; color: rgba(255,255,255,.7); display: flex; align-items: center; gap: 12px; }
.portal-header .user-info a { color: var(--gold); }

.portal-content { max-width: 1100px; margin: 0 auto; padding: 32px 20px; }

.series-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.series-tab {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.series-tab:hover, .series-tab.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  text-decoration: none;
}

/* Firmware cards grid */
.fw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.fw-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.fw-card:hover { box-shadow: 0 6px 24px rgba(0,45,78,.14); transform: translateY(-2px); }

.fw-card-header {
  padding: 16px 20px;
  border-bottom: 3px solid var(--gold);
  background: linear-gradient(135deg, #f8fafc, var(--white));
}
.fw-card-header .model-title { font-size: 16px; font-weight: 800; color: var(--navy); }
.fw-card-header .series-label { font-size: 11px; color: var(--muted); margin-top: 2px; }

.fw-card-body { padding: 16px 20px; }
.fw-version { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.fw-date { font-size: 11px; color: var(--muted); margin-bottom: 16px; }

.fw-download-list { display: flex; flex-direction: column; gap: 8px; }
.fw-dl-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .2s, background .2s;
  text-decoration: none;
}
.fw-dl-btn:hover { border-color: var(--gold); background: var(--gold-soft); text-decoration: none; }
.fw-dl-btn .dl-icon { font-size: 18px; color: var(--gold); }
.fw-dl-btn .dl-info { flex:1; }
.fw-dl-btn .dl-type { font-size: 11px; color: var(--muted); }
.fw-dl-btn .dl-arrow { color: var(--muted); font-size: 14px; }

/* ==========================================================
   RELEASE NOTE VIEWER (inline modal)
   ========================================================== */
.note-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,20,40,.55);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.note-modal-overlay.open { display: flex; }

.note-modal {
  background: var(--white);
  border-radius: 10px;
  max-width: 780px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}
.note-modal-top {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.note-modal-top h3 { font-size: 17px; color: var(--navy); }
.note-modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: #f0f2f4;
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.note-modal-close:hover { background: var(--border); }
.note-modal-body { padding: 24px; }

/* ==========================================================
   RELEASE NOTE CONTENT STYLES
   (shared between modal, print view, and PDF)
   ========================================================== */
.rn-content h2 {
  margin: 20px 0 8px;
  font-size: 15px;
  color: var(--navy);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.rn-content h2:first-child { margin-top: 0; }
.rn-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.rn-content li {
  position: relative;
  padding-left: 20px;
  margin: 5px 0;
  font-size: 13px;
}
.rn-content li::before {
  content: ">";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--gold);
}
.rn-content p { font-size: 13px; margin: 6px 0; }
.rn-content code {
  font-family: Consolas, Menlo, monospace;
  background: #f2f2f2;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #ddd;
  font-size: 12px;
}

/* ==========================================================
   CVE TABLE
   ========================================================== */
.cve-table-wrap { overflow-x: auto; }
.cve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cve-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
}
.cve-table tr:nth-child(even) { background: #f4f7fa; }
.cve-table td { padding: 8px 14px; border-bottom: 1px solid var(--border); }
.cve-table .severity-critical { color: #c0392b; font-weight: 700; }
.cve-table .severity-high     { color: #e67e22; font-weight: 700; }
.cve-table .severity-medium   { color: #f39c12; }
.cve-table .severity-low      { color: var(--success); }

/* ==========================================================
   SEARCH / FILTER BAR
   ========================================================== */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar input[type=text] { max-width: 280px; }
.filter-bar select { width: auto; }

/* ==========================================================
   PAGINATION
   ========================================================== */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
}
.page-link {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.page-link:hover, .page-link.active {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--navy);
}

/* ==========================================================
   STATUS CHANGE UI
   ========================================================== */
.status-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.status-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.status-arrow { color: var(--muted); font-size: 16px; }

/* ==========================================================
   UTILITY
   ========================================================== */
.text-muted  { color: var(--muted); }
.text-gold   { color: var(--gold); }
.text-navy   { color: var(--navy); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-sm     { font-size: 12px; }
.fw-bold     { font-weight: 700; }
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 16px; color: var(--navy); margin-bottom: 6px; }

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

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .model-file-block .mfb-body { grid-template-columns: 1fr; }
}
