/* ==========================================================================
   NxCom Design System — nx-website.css
   Áp dụng cho toàn bộ website erp.nxcom.vn
   Dùng CSS variables của Frappe v15 cho màu hệ thống, typography, shadow, radius.
   Chỉ định nghĩa brand colors NxCom (đỏ, tối) tại đây.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. NxCom Brand Tokens (chỉ giữ những gì Frappe không có)
   -------------------------------------------------------------------------- */
:root {
  /* Brand đỏ NxCom */
  --nx-red:        #C0392B;
  --nx-red-hover:  #A93226;
  --nx-red-light:  #E74C3C;
  --nx-red-pale:   #FDECEA;

}

/* --------------------------------------------------------------------------
   2. Base Reset & Typography
   -------------------------------------------------------------------------- */
body.website-list-permlink,
body {
  background-color: var(--bg-color) !important;
  color: var(--text-color);
  font-family: var(--font-stack);
}

/* --------------------------------------------------------------------------
   3. Navbar Override
   -------------------------------------------------------------------------- */
.navbar {
  background-color: var(--fg-color) !important;
  border-bottom: none !important;
  border-top: 3px solid var(--nx-red) !important;
  box-shadow: var(--shadow-sm) !important;
  padding: 0 24px !important;
  min-height: 56px;
}

.navbar .navbar-brand {
  color: var(--heading-color) !important;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-size: 20px;
}

.navbar .nav-link {
  color: var(--text-color) !important;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px !important;
  border-radius: var(--border-radius);
  transition: color 0.2s, background 0.2s;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--heading-color) !important;
  background: var(--bg-color);
}

.navbar .dropdown-menu {
  background: var(--fg-color);
  border: 1px solid var(--dark-border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
}

.navbar .dropdown-item {
  color: var(--text-color) !important;
  font-size: 14px;
  padding: 8px 16px;
  transition: background 0.15s;
}

.navbar .dropdown-item:hover {
  background: var(--bg-color);
  color: var(--heading-color) !important;
}

/* Nút CTA trên navbar */
.navbar .btn-nx-cta {
  background: var(--nx-red);
  color: #fff !important;
  border-radius: var(--border-radius);
  padding: 6px 16px !important;
  font-weight: 600;
  font-size: 13px;
  border: none;
  transition: background 0.2s;
}
.navbar .btn-nx-cta:hover {
  background: var(--nx-red-hover);
}

/* --------------------------------------------------------------------------
   4. Page Layout
   -------------------------------------------------------------------------- */
.nx-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
}

.nx-page-sm {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* --------------------------------------------------------------------------
   5. Cards & Widgets
   -------------------------------------------------------------------------- */
.nx-card {
  background: var(--fg-color);
  border: 1px solid var(--dark-border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-base);
  padding: 20px 24px;
  transition: box-shadow 0.25s, transform 0.25s;
}

.nx-card:hover {
  box-shadow: var(--shadow-lg);
}

.nx-card-clickable {
  cursor: pointer;
}

.nx-card-clickable:hover {
  transform: translateY(-3px);
}

.nx-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.nx-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nx-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.nx-card-icon.red    { background: var(--nx-red-pale);      color: var(--nx-red); }
.nx-card-icon.green  { background: var(--bg-green);          color: var(--text-on-green); }
.nx-card-icon.blue   { background: var(--bg-light-blue);     color: var(--text-on-light-blue); }
.nx-card-icon.yellow { background: var(--bg-yellow);         color: var(--text-on-yellow); }

.nx-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--heading-color);
  line-height: 1;
}

.nx-number-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   6. Widget Grid (Home Dashboard)
   -------------------------------------------------------------------------- */
.nx-widget-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.nx-widget-wide {
  grid-column: span 2;
}

.nx-widget-full {
  grid-column: span 3;
}

@media (max-width: 1024px) {
  .nx-widget-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nx-widget-wide { grid-column: span 2; }
  .nx-widget-full { grid-column: span 2; }
}

@media (max-width: 640px) {
  .nx-widget-grid {
    grid-template-columns: 1fr;
  }
  .nx-widget-wide,
  .nx-widget-full { grid-column: span 1; }
}

/* --------------------------------------------------------------------------
   7. Page Header
   -------------------------------------------------------------------------- */
.nx-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.nx-greeting {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--heading-color);
}

.nx-greeting-sub {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn-nx {
  background: var(--nx-red);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  padding: 8px 18px;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-nx:hover { background: var(--nx-red-hover); color: #fff; }

.btn-nx-outline {
  background: transparent;
  color: var(--nx-red);
  border: 1.5px solid var(--nx-red);
  border-radius: var(--border-radius);
  padding: 7px 16px;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-nx-outline:hover {
  background: var(--nx-red-pale);
  color: var(--nx-red);
}

.btn-nx-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 12px;
  font-size: var(--text-md);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.btn-nx-ghost:hover { background: var(--dark-border-color); color: var(--text-color); }

/* --------------------------------------------------------------------------
   9. Status Badges
   -------------------------------------------------------------------------- */
.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.nx-badge-red    { background: var(--nx-red-pale);       color: var(--nx-red);              }
.nx-badge-green  { background: var(--bg-green);           color: var(--text-on-green);       }
.nx-badge-blue   { background: var(--bg-light-blue);      color: var(--text-on-light-blue);  }
.nx-badge-yellow { background: var(--bg-yellow);          color: var(--text-on-yellow);      }
.nx-badge-gray   { background: var(--control-bg);         color: var(--text-muted);          }

/* --------------------------------------------------------------------------
   10. Progress Bar
   -------------------------------------------------------------------------- */
.nx-progress {
  height: 6px;
  background: var(--dark-border-color);
  border-radius: var(--border-radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.nx-progress-bar {
  height: 100%;
  border-radius: var(--border-radius-full);
  background: var(--blue-500);
  transition: width 0.4s ease;
}

.nx-progress-bar.green  { background: var(--dark-green-500); }
.nx-progress-bar.yellow { background: var(--yellow-500); }
.nx-progress-bar.red    { background: var(--nx-red); }

/* --------------------------------------------------------------------------
   11. List Items (Task, Notification, ...)
   -------------------------------------------------------------------------- */
.nx-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nx-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--dark-border-color);
}

.nx-list-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.nx-list-item-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-color);
  line-height: 1.4;
}

.nx-list-item-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 2px;
}

.nx-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.nx-list-dot.red    { background: var(--nx-red); }
.nx-list-dot.green  { background: var(--dark-green-500); }
.nx-list-dot.yellow { background: var(--yellow-500); }
.nx-list-dot.gray   { background: var(--text-muted); }

/* --------------------------------------------------------------------------
   12. Empty State
   -------------------------------------------------------------------------- */
.nx-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.nx-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}

.nx-empty-text {
  font-size: var(--text-base);
}

/* --------------------------------------------------------------------------
   13. Form Controls
   -------------------------------------------------------------------------- */
.nx-input {
  border: 1.5px solid var(--dark-border-color);
  border-radius: var(--border-radius);
  padding: 9px 14px;
  font-size: var(--text-base);
  color: var(--text-color);
  background: var(--fg-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.nx-input:focus {
  outline: none;
  border-color: var(--nx-red);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

/* --------------------------------------------------------------------------
   14. Toggle Switch (Widget settings)
   -------------------------------------------------------------------------- */
.nx-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.nx-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.nx-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--dark-border-color);
  border-radius: var(--border-radius-full);
  transition: background 0.2s;
}

.nx-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.nx-toggle input:checked + .nx-toggle-slider {
  background: var(--nx-red);
}

.nx-toggle input:checked + .nx-toggle-slider::before {
  transform: translateX(20px);
}

/* --------------------------------------------------------------------------
   15. Login Page Override
   -------------------------------------------------------------------------- */
.page-card .btn-primary {
  background: var(--nx-red) !important;
  border-color: var(--nx-red) !important;
}

.page-card .btn-primary:hover {
  background: var(--nx-red-hover) !important;
  border-color: var(--nx-red-hover) !important;
}

/* --------------------------------------------------------------------------
   16. Footer Override
   -------------------------------------------------------------------------- */
footer.web-footer {
  background: var(--fg-color) !important;
  color: var(--text-muted) !important;
  border-top: 2px solid var(--nx-red) !important;
  padding: 24px !important;
}

footer.web-footer a {
  color: var(--text-muted) !important;
}

footer.web-footer a:hover {
  color: var(--text-color) !important;
}

/* --------------------------------------------------------------------------
   17. Responsive Utilities
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .nx-page,
  .nx-page-sm { padding: 16px; }
  .nx-greeting { font-size: var(--text-xl); }
}
