/* ============================================================
   GWS Manager — app.css
   Design: Clean professional, Google-inspired dark sidebar
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --blue:        #1A73E8;
  --blue-light:  #4285F4;
  --blue-dim:    #E8F0FE;
  --green:       #34A853;
  --yellow:      #FBBC04;
  --red:         #EA4335;
  --sidebar-bg:  #0D1117;
  --sidebar-w:   240px;
  --bg:          #F6F8FC;
  --surface:     #FFFFFF;
  --surface2:    #F1F3F4;
  --border:      #E0E4EA;
  --text:        #1C2437;
  --text-muted:  #6B7A99;
  --text-light:  #A0ABBE;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.08);
  --shadow:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);
  --radius:      12px;
  --radius-sm:   8px;
  --font:        'Be Vietnam Pro', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --transition:  .2s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--blue-light), #0052CC);
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff;
  letter-spacing: .5px;
  flex-shrink: 0;
}
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-weight: 700; font-size: .9rem; color: #fff; line-height: 1.2; }
.logo-sub   { font-size: .68rem; color: rgba(255,255,255,.4); }

.nav-menu { list-style: none; padding: 12px 10px; flex: 1; }
.nav-menu li { margin-bottom: 2px; }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .85rem; font-weight: 500;
  transition: var(--transition);
}
.nav-link svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-link:hover  { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: rgba(26,115,232,.25); color: #7BAFF4; }
.nav-link.active svg { stroke: #7BAFF4; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.company-badge {
  font-size: .72rem;
  color: rgba(255,255,255,.3);
  text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── MAIN CONTENT ────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ── PAGE HEADER ─────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.page-sub   { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

/* ── STAT CARDS ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--blue));
}
.stat-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.9rem; font-weight: 800; color: var(--text); margin: 6px 0 2px; line-height: 1; }
.stat-change { font-size: .78rem; color: var(--text-muted); }
.stat-icon {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: var(--blue-dim);
  border-radius: 9px;
  display: grid; place-items: center;
}
.stat-icon svg { width: 18px; height: 18px; stroke: var(--blue); fill: none; stroke-width: 2; }

/* ── CARDS ───────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-body  { padding: 22px; }

/* ── TABLE ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
thead th {
  background: var(--surface2);
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── BADGES ──────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem; font-weight: 600;
  white-space: nowrap;
}
.badge-blue   { background: #E8F0FE; color: #1A73E8; }
.badge-green  { background: #E6F4EA; color: #1E7E34; }
.badge-yellow { background: #FEF7E0; color: #B06000; }
.badge-red    { background: #FCE8E6; color: #C5221F; }
.badge-gray   { background: var(--surface2); color: var(--text-muted); }

/* Status dots */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green  { background: var(--green); }
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-gray   { background: var(--text-light); }

/* ── PACKAGE COLOR PILLS ─────────────────────── */
.pkg-starter  { background: #E8F0FE; color: #1A73E8; }
.pkg-standard { background: #E6F4EA; color: #1E7E34; }
.pkg-plus     { background: #FEF7E0; color: #B06000; }
.pkg-enterprise { background: #FCE8E6; color: #C5221F; }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: .85rem; font-weight: 600;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1557B0; }
.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #2A8A43; }
.btn-outline   { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: var(--blue-dim); }
.btn-ghost     { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm        { padding: 6px 12px; font-size: .78rem; border-radius: 6px; }
.btn-icon      { padding: 7px; }

/* ── FORMS ───────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: .78rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px;
}
input, select, textarea {
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: .88rem;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
input[readonly] { background: var(--surface2); color: var(--text-muted); cursor: default; }
textarea { resize: vertical; min-height: 80px; }

.input-group { position: relative; }
.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-weight: 600; color: var(--text-muted); pointer-events: none; font-size: .85rem;
}
.input-group input { padding-left: 28px; }

/* ── PRICING PREVIEW BOX ─────────────────────── */
.price-box {
  background: linear-gradient(135deg, #0D1117 0%, #1C2437 100%);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  margin-top: 8px;
}
.price-box-title {
  font-size: .72rem; font-weight: 700; color: rgba(255,255,255,.5);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px;
}
.price-line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .85rem; color: rgba(255,255,255,.7);
}
.price-line:last-child { border-bottom: none; }
.price-line strong { color: #fff; font-weight: 700; }
.price-total-line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 0 0;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.15);
}
.price-total-label { font-size: .9rem; font-weight: 700; color: rgba(255,255,255,.85); }
.price-total-value { font-size: 1.7rem; font-weight: 800; color: #7BAFF4; line-height: 1; }
.price-vnd { font-size: .8rem; color: rgba(255,255,255,.45); text-align: right; margin-top: 3px; }

/* months remaining bar */
.months-bar {
  background: rgba(255,255,255,.1);
  border-radius: 4px; height: 6px;
  margin: 12px 0 4px;
  overflow: hidden;
}
.months-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #4285F4, #34A853);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.months-label { font-size: .72rem; color: rgba(255,255,255,.45); display: flex; justify-content: space-between; }

/* ── ALERTS ──────────────────────────────────── */
.alert {
  padding: 13px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: .86rem;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #E6F4EA; color: #1E7E34; border-left: 4px solid var(--green); }
.alert-error   { background: #FCE8E6; color: #C5221F; border-left: 4px solid var(--red); }
.alert-info    { background: var(--blue-dim); color: var(--blue); border-left: 4px solid var(--blue); }
.alert-warning { background: #FEF7E0; color: #B06000; border-left: 4px solid var(--yellow); }

/* ── EXPIRY WARNING ──────────────────────────── */
.expiry-critical { color: var(--red); font-weight: 700; }
.expiry-warning  { color: #B06000; font-weight: 600; }
.expiry-ok       { color: var(--green); }

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  z-index: 500; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(600px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn { from { opacity:0; transform:scale(.95) translateY(8px); } to { opacity:1; transform:none; } }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: var(--surface2); border: none; border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; display: grid; place-items: center;
  font-size: 1.1rem; color: var(--text-muted);
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── MISC ────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mono        { font-family: var(--font-mono); font-size: .82rem; }
.divider     { height: 1px; background: var(--border); margin: 20px 0; }
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin: 0 auto 12px; display: block; }
.empty-state p { font-size: .9rem; }

/* Search bar */
.search-bar {
  display: flex; align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--surface);
  padding: 0 12px; gap: 8px;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.search-bar svg { width: 16px; height: 16px; stroke: var(--text-light); fill: none; stroke-width: 2; flex-shrink: 0; }
.search-bar input { border: none; box-shadow: none; padding: 9px 0; background: transparent; }
.search-bar input:focus { box-shadow: none; border: none; }

/* ── PRINT / PDF ─────────────────────────────── */
@media print {
  .sidebar, .page-actions, .btn, nav { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
