/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --gp-blue:    #1B73BE;
  --gp-dark:    #0F4C81;
  --gp-light:   #E8F2FB;
  --halsys:     #2D3748;
  --accent:     #1B73BE;
  --bg:         #F4F7FB;
  --card-bg:    #FFFFFF;
  --border:     #E2E8F0;
  --text:       #1A202C;
  --text-muted: #718096;
  --green:      #38A169;
  --red:        #E53E3E;
  --radius:     10px;
  --shadow:     0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--gp-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── Shared components ─────────────────────────────────────────────────── */
.hidden { display: none !important; }

.btn-primary {
  display: block; width: 100%; padding: 13px;
  background: var(--gp-blue); color: #fff; border: none;
  border-radius: var(--radius); font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--gp-dark); }
.btn-primary.sm { width: auto; display: inline-block; padding: 9px 20px; }

.error-banner {
  background: #FFF5F5; border: 1px solid #FEB2B2; color: #C53030;
  padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}
.success-banner {
  background: #F0FFF4; border: 1px solid #9AE6B4; color: #276749;
  padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}

.logo { height: 32px; object-fit: contain; }
.logo-sm { height: 24px; object-fit: contain; }
.logo-text { font-weight: 700; font-size: 18px; color: var(--halsys); }
.logo-text-sm { font-weight: 700; font-size: 14px; color: #fff; }

/* ── Login page ────────────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(135deg, var(--gp-dark) 0%, #1a56a0 50%, #2d6bb5 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.login-wrap { width: 100%; max-width: 420px; }

.login-logos { text-align: center; margin-bottom: 24px; }

.logo-pill {
  display: inline-flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  padding: 12px 24px; border-radius: 100px; border: 1px solid rgba(255,255,255,.25);
}
.logo-sep {
  display: block; width: 1px; height: 24px; background: rgba(255,255,255,.4);
}

.login-card {
  background: #fff; border-radius: 16px; padding: 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

.tab-bar { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  flex: 1; padding: 10px; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--gp-blue); border-bottom-color: var(--gp-blue); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; outline: none; transition: border-color .15s;
  background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gp-blue);
}

.sent-state { text-align: center; padding: 20px 0; }
.sent-icon { font-size: 48px; margin-bottom: 16px; }
.sent-state h3 { font-size: 18px; margin-bottom: 8px; }
.sent-state p { color: var(--text-muted); font-size: 14px; }

.login-tagline { text-align: center; margin-top: 10px; color: rgba(255,255,255,.55); font-size: 12px; letter-spacing: .3px; }
.login-footer { text-align: center; margin-top: 20px; color: rgba(255,255,255,.7); font-size: 13px; }
.login-footer a { color: rgba(255,255,255,.9); }

/* ── Portal ────────────────────────────────────────────────────────────── */
.portal-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }

.portal-header {
  background: var(--halsys); color: #fff; padding: 0 24px; height: 60px;
  display: flex; align-items: center; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1100px; margin: 0 auto; }
.header-logos { display: flex; align-items: center; gap: 12px; }
.header-sep { color: rgba(255,255,255,.4); font-size: 18px; }
.header-product { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.7); letter-spacing: .3px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.user-badge { font-size: 13px; color: rgba(255,255,255,.7); }

.btn-logout {
  padding: 6px 14px; background: rgba(255,255,255,.15); color: #fff;
  border-radius: 6px; font-size: 13px; font-weight: 500; transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.25); text-decoration: none; }

.portal-hero {
  background: linear-gradient(135deg, var(--gp-blue), var(--gp-dark));
  color: #fff; padding: 48px 24px 56px; text-align: center;
}
.portal-hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.portal-hero p { opacity: .85; font-size: 15px; }

.portal-main {
  max-width: 960px; margin: -20px auto 0; padding: 0 24px 48px;
  flex: 1;
}

.section-tabs {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; overflow: hidden; margin-bottom: 24px;
}
.stab {
  flex: 1; padding: 14px 8px; background: none; border: none; cursor: pointer;
  font-weight: 500; color: var(--text-muted); font-size: 14px;
  border-bottom: 3px solid transparent; transition: color .15s, border-color .15s;
}
.stab.active { color: var(--gp-blue); border-bottom-color: var(--gp-blue); background: var(--gp-light); }

.section { display: block; }
.loading-state { text-align: center; padding: 48px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); font-size: 14px; }

/* Product blocks */
.product-block {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; margin-bottom: 20px;
}
.product-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.product-icon { font-size: 32px; line-height: 1; }
.product-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.product-desc { color: var(--text-muted); font-size: 13px; }

.latest-download {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--gp-light); border: 1.5px solid #BEE3F8;
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
}
.latest-badge {
  background: var(--gp-blue); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 100px; text-transform: uppercase; letter-spacing: .5px;
}
.latest-info { display: flex; align-items: center; gap: 12px; flex: 1; flex-wrap: wrap; }

.version-tag {
  background: var(--halsys); color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 6px; font-family: monospace;
}
.version-tag.small { font-size: 11px; padding: 2px 8px; }
.release-date { color: var(--text-muted); font-size: 13px; }
.release-label { color: var(--text-muted); font-size: 13px; font-style: italic; }

.btn-download {
  padding: 10px 22px; background: var(--gp-blue); color: #fff;
  border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s;
}
.btn-download:hover { background: var(--gp-dark); text-decoration: none; }

.archive-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
  margin-bottom: 12px; transition: border-color .15s;
}
.archive-toggle:hover { border-color: var(--gp-blue); color: var(--gp-blue); }

.archive-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.archive-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.archive-row:last-child { border-bottom: none; }
.btn-archive {
  margin-left: auto; padding: 6px 14px; border: 1.5px solid var(--gp-blue);
  color: var(--gp-blue); border-radius: 6px; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.btn-archive:hover { background: var(--gp-blue); color: #fff; text-decoration: none; }

/* Release notes */
.rn-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px; }
.rn-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.rn-product { font-weight: 600; font-size: 14px; }
.rn-content { color: var(--text); font-size: 14px; line-height: 1.7; border-top: 1px solid var(--border); padding-top: 16px; }

/* Documents */
.doc-category { margin-bottom: 28px; }
.cat-title { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.doc-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px 16px; transition: border-color .15s, box-shadow .15s;
}
.doc-card:hover { border-color: var(--gp-blue); box-shadow: var(--shadow); text-decoration: none; }
.doc-icon { font-size: 28px; margin-bottom: 10px; }
.doc-title { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.doc-type { font-size: 11px; color: var(--text-muted); background: var(--bg); padding: 2px 8px; border-radius: 100px; }

/* Videos */
.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.video-card {
  background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.video-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.12); text-decoration: none; }
.video-thumb { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 48px; height: 48px; background: rgba(0,0,0,.65); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; padding-left: 4px;
}
.video-thumb-placeholder { width: 100%; height: 100%; background: #1a1a2e; display: flex; align-items: center; justify-content: center; font-size: 40px; color: rgba(255,255,255,.4); }
.video-info { padding: 14px 16px; }
.video-title { display: block; font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 4px; }
.video-desc { display: block; font-size: 13px; color: var(--text-muted); }

.portal-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); }

/* ── Admin ─────────────────────────────────────────────────────────────── */
.admin-body { background: var(--bg); min-height: 100vh; }

.admin-header {
  background: var(--halsys); color: #fff; padding: 0 24px; height: 56px;
  display: flex; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky; top: 0; z-index: 100;
}
.admin-title { font-weight: 700; font-size: 16px; flex: 1; }

.btn-sm {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,.15); color: #fff; border: none; cursor: pointer;
  margin-left: 8px; transition: background .15s;
}
.btn-sm:hover { background: rgba(255,255,255,.25); text-decoration: none; }
.btn-sm.danger { background: rgba(229,62,62,.4); }
.btn-sm.danger:hover { background: rgba(229,62,62,.7); }

.admin-main { display: flex; min-height: calc(100vh - 56px); }

.admin-nav {
  width: 200px; background: #fff; border-right: 1px solid var(--border);
  padding: 16px 8px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
}
.anav-btn {
  display: block; width: 100%; text-align: left; padding: 10px 12px;
  border: none; background: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text-muted); transition: all .15s;
}
.anav-btn:hover { background: var(--bg); color: var(--text); }
.anav-btn.active { background: var(--gp-light); color: var(--gp-blue); font-weight: 600; }

.admin-content { flex: 1; padding: 28px; overflow-y: auto; }

.panel { display: none; }
.panel.active { display: block; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-header h2 { font-size: 20px; font-weight: 700; }

.btn-add {
  padding: 8px 18px; background: var(--gp-blue); color: #fff; border: none;
  border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .15s;
}
.btn-add:hover { background: var(--gp-dark); }

.admin-table {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; font-size: 13px;
}
.admin-table th {
  background: var(--bg); padding: 10px 14px; text-align: left;
  font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600;
}
.badge.green { background: #C6F6D5; color: #276749; }
.badge.grey  { background: var(--border); color: var(--text-muted); }

.btn-del {
  padding: 4px 10px; background: none; border: 1px solid #FEB2B2;
  color: var(--red); border-radius: 6px; cursor: pointer; font-size: 12px;
  transition: all .15s;
}
.btn-del:hover { background: var(--red); color: #fff; border-color: var(--red); }

.link-sm { font-size: 12px; color: var(--gp-blue); }

/* Toast */
.toast {
  position: fixed; top: 72px; right: 24px; z-index: 9999;
  padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); transition: opacity .3s;
}
.toast.ok  { background: #276749; color: #fff; }
.toast.err { background: var(--red); color: #fff; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.field small { color: var(--text-muted); font-size: 11px; display: block; }
