/* =========================================
   1. BIẾN TOÀN CỤC (DARK THEME)
   ========================================= */
:root {
  --radius: 14px;

  /* Radius mới cho form / card */
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Primary blue */
  --primary-50:  #eff6ff;
  --primary-100: #dbeafe;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;

  /* Trạng thái */
  --success-500: #22c55e;
  --warning-500: #eab308;
  --danger-500:  #ef4444;

  /* Nền / border / text cho dark UI */
  --surface-elevated: rgba(15,23,42,0.95);
  --surface-muted:    rgba(15,23,42,0.8);
  --border-subtle:    rgba(148,163,184,0.45);
  --border-strong:    rgba(148,163,184,0.7);

  --text-primary: #e5e7eb;
  --text-muted:   #9ca3af;

  /* Màu cho summary cards */
  --yellow-500:#F59E0B; --yellow-100:rgba(245,158,11,.12);
  --green-500:#10B981;  --green-100:rgba(16,185,129,.12);
  --red-500:#EF4444;    --red-100:rgba(239,68,68,.12);

  --card-border:#273244;
  --card-bg:#0b0f16;
  --card-text:#e5e7eb;
}

* {
  box-sizing: border-box;
}

/* =========================================
   2. BODY + LAYOUT CƠ BẢN
   ========================================= */
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  background: #0f2027;
  background: linear-gradient(135deg,#0f2027,#203a43,#2c5364);
}

.container {
  max-width: 1600px !important;
  margin: 0 auto;
  padding: 24px 32px;
  color: #fff;
}

/* Nếu muốn rộng hơn nữa trên màn lớn */
@media (min-width: 1800px){
  .container{ max-width: 1720px; }
}

/* Grid / card / form cũ – vẫn dùng trên nhiều trang */
.grid {
  display:grid;
  grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  gap:16px;
}

.card {
  background: rgba(255,255,255,.06);
  padding:16px;
  border-radius: var(--radius);
}

.form {
  background: rgba(255,255,255,.06);
  padding:16px;
  border-radius: var(--radius);
}

/* Table wrapper dùng cho trang dashboard cũ */
.table-wrapper {
  overflow:auto;
  background: rgba(255,255,255,.06);
  padding:12px;
  border-radius: var(--radius);
}

.table {
  width:100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

/* Phân bổ bề rộng cột cho bảng card sửa chữa */
.table th:nth-child(1), .table td:nth-child(1){ width: 70px; }   /* ID */
.table th:nth-child(2), .table td:nth-child(2){ width: 90px; }   /* Số lượng */
.table th:nth-child(3), .table td:nth-child(3){ width: 180px; }  /* Mã đơn */
.table th:nth-child(4), .table td:nth-child(4){ width: 190px; }  /* Card */
.table th:nth-child(5), .table td:nth-child(5){ width: 160px; }  /* Trạng Thái 1 */
.table th:nth-child(6), .table td:nth-child(6){ width: 160px; }  /* Trạng Thái 2 */
.table th:nth-child(7), .table td:nth-child(7){ width: 260px; }  /* Ghi chú */
.table th:last-child,   .table td:last-child{  width: 80px; }    /* nút Sửa */

.table th,
.table td{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hero / success box cũ */
.hero,
.success {
  background: rgba(255,255,255,.06);
  padding: 24px;
  border-radius: var(--radius);
  margin: 18px 0;
}

/* Footer */
footer {
  font-size: 15px;
  padding: 10px 0;
  color: #ccc;
  border-top: 1px solid #333;
  margin-top: 40px;
  text-align:center;
}

/* =========================================
   3. BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  padding: 8px 16px;
  border-radius: 999px;

  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;

  cursor: pointer;
  white-space: nowrap;

  box-shadow: 0 8px 20px rgba(37,99,235,0.35);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.08s ease;
}

.btn:hover {
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  box-shadow: 0 10px 28px rgba(37,99,235,0.5);
  transform: translateY(-1px);
}

.btn:active {
  box-shadow: 0 4px 14px rgba(15,23,42,0.6);
  transform: translateY(0);
}

/* Biến thể */
.btn.outline {
  background: transparent;
  color:#fff;
  border:1px solid rgba(255,255,255,.3);
  box-shadow: none;
}

.btn.outline:hover {
  border-color: var(--primary-500);
  background: rgba(37,99,235,0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(148,163,184,0.1);
}

.btn-danger {
  background: linear-gradient(135deg, #f97373, var(--danger-500));
  box-shadow: 0 8px 20px rgba(239,68,68,0.4);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn-xs,
.btn.tiny {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-icon {
  padding: 6px;
  border-radius: 999px;
  width: 32px;
  height: 32px;
}

/* =========================================
   4. THÔNG BÁO (Django messages)
   ========================================= */
.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.messages li {
  padding: 10px 12px;
  margin: 6px 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(34,197,94,0.5);
  background: rgba(22,163,74,0.14);
  color: var(--text-primary);
  font-size: 0.88rem;
}

/* Theo level Django: error, success, info, warning */
.messages li.error {
  border-color: rgba(239,68,68,0.7);
  background: rgba(239,68,68,0.12);
}

.messages li.warning {
  border-color: rgba(234,179,8,0.7);
  background: rgba(234,179,8,0.13);
}

.messages li.info {
  border-color: rgba(59,130,246,0.65);
  background: rgba(59,130,246,0.12);
}

/* =========================================
   5. FORM / INPUT / DROPDOWN
   ========================================= */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-group label {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Áp dụng cho form trên site */
form input[type="text"],
form input[type="password"],
form input[type="number"],
form input[type="email"],
form input[type="month"],
form input[type="date"],
form select,
form textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-muted);
  color: var(--text-primary);
  font-size: 0.9rem;

  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

form input::placeholder,
form textarea::placeholder {
  color: rgba(148,163,184,0.8);
}

form input:focus,
form select:focus,
form textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.6);
  background: rgba(15,23,42,0.95);
}

/* Trạng thái lỗi */
.field-error,
input.is-error,
select.is-error,
textarea.is-error {
  border-color: var(--danger-500) !important;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.7);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  /* thường dùng chung với .btn */
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);

  min-width: 180px;
  padding: 6px;
  border-radius: var(--radius-md);

  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  z-index: 40;

  display: none;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(37,99,235,0.22);
}

/* =========================================
   6. DASHBOARD CŨ (BỘ LỌC NHỎ)
   ========================================= */
.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.dashboard-filters .field-group {
  display: flex;
  flex-direction: column;
  min-width: 140px;
}

.dashboard-filters .field-group input[type="text"] {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.2);
  color: #fff;
}

.dashboard-filters .checkbox-row {
  flex-direction: row;
  gap: 8px;
}

.dashboard-filters .buttons {
  flex-direction: row;
  gap: 8px;
}

/* Dashboard layout wrapper */
.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-dashboard {
  border-radius: var(--radius-lg);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.page-title {
  margin: 0 0 4px;
  font-size: 1.16rem;
  font-weight: 700;
}

.page-subtitle {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.7);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* =========================================
   7. MONTHLY SUMMARY CARDS
   ========================================= */
.summary-bar{
  display:flex;
  align-items:center;
  gap:12px;
  margin:10px 0 16px;
  flex-wrap:wrap;
}

.summary-cards{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.summary-card{
  min-width:220px;
  padding:14px 16px;
  border:1px solid var(--card-border);
  border-radius:14px;
  background:var(--card-bg);
  color:var(--card-text);
  box-shadow:0 3px 10px rgba(0,0,0,.06);
  transition:transform .15s, box-shadow .15s, border-color .15s;
}

.summary-card:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 22px rgba(0,0,0,.12);
}

.summary-title{
  font-size:.92rem;
  opacity:.82;
  margin-bottom:6px;
}

.summary-value{
  font-size:1.8rem;
  font-weight:800;
  letter-spacing:.2px;
}

.summary-card.yellow{
  border-color:var(--yellow-500);
  background:var(--yellow-100);
}

.summary-card.yellow .summary-title,
.summary-card.yellow .summary-value{
  color:var(--yellow-500);
}

.summary-card.green{
  border-color:var(--green-500);
  background:var(--green-100);
}

.summary-card.green .summary-title,
.summary-card.green .summary-value{
  color:var(--green-500);
}

.summary-card.red{
  border-color:var(--red-500);
  background:var(--red-100);
}

.summary-card.red .summary-title,
.summary-card.red .summary-value{
  color:var(--red-500);
}

.summary-progress{margin-top:8px;}

.progress-track{
  position:relative;
  width:100%;
  height:8px;
  background:rgba(0,0,0,.08);
  border-radius:999px;
  overflow:hidden;
}

@media (prefers-color-scheme: dark){
  .progress-track{background:rgba(255,255,255,.08);}
}

.progress-fill{
  height:100%;
  width:0%;
  transition:width .35s ease;
}

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

.sparkline{margin-top:8px;opacity:.9;}
.sparkline svg{display:block;width:100%;height:auto;}

.summary-bar label{
  color:#fff;
  opacity:.9;
}

/* =========================================
   8. HEADER / NAVBAR KIỂU INDEX.HTML
   ========================================= */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: linear-gradient(
    to bottom,
    rgba(3, 7, 18, 0.95),
    rgba(3, 7, 18, 0.7),
    transparent
  );
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #38bdf8, #0a84ff);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.45);
  font-weight: 700;
  font-size: 18px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text-main {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 16px;
}

.logo-text-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.nav-links a {
  position: relative;
  padding: 4px 0;
  text-decoration: none;
}

.nav-links a:hover {
  color: #e5e7eb;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, #38bdf8, #0a84ff);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.header-cta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-small {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: var(--text-muted);
}

.menu-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

/* Mobile navbar */
@media (max-width: 960px) {
  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 0;
  }

  .nav-links {
    flex-wrap: wrap;
    width: 100%;
    gap: 8px 10px;
  }

  .nav-links a {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.45);
  }

  .header-cta {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

