/* ============================================================
   QT-CMS Stylesheet
   Clean, professional, large touch targets for shop floor use
   ============================================================ */

:root {
  --blue-dark:   #1B4F8A;
  --blue:        #2E75B6;
  --blue-light:  #D6E4F0;
  --green:       #1D6A3A;
  --green-light: #D6EFE0;
  --red:         #C0392B;
  --red-light:   #FDECEA;
  --orange:      #D35400;
  --orange-light:#FDEBD0;
  --yellow:      #F39C12;
  --gray-dark:   #343A40;
  --gray:        #6C757D;
  --gray-light:  #F5F7FA;
  --white:       #FFFFFF;
  --border:      #DEE2E6;
  --shadow:      0 2px 8px rgba(0,0,0,0.08);
  --radius:      8px;
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--gray-dark);
  background: var(--gray-light);
  min-height: 100vh;
}

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

/* ── TOP NAV ─────────────────────────────────────────────── */
.topnav {
  background: var(--blue-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.topnav-brand {
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.topnav-brand span { color: #90C9F9; }

.topnav-user {
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
}

.topnav-user a {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}

.topnav-user a:hover { color: white; text-decoration: none; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-light);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray);
  padding: 10px 20px 4px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--gray-dark);
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar a:hover {
  background: var(--blue-light);
  color: var(--blue-dark);
  text-decoration: none;
  border-left-color: var(--blue);
}

.sidebar a.active {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-weight: 600;
  border-left-color: var(--blue-dark);
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 28px;
  overflow-x: auto;
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue-dark);
}

.page-subtitle {
  font-size: 14px;
  color: var(--gray);
  margin-top: 2px;
}

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  color: var(--blue-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 20px; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.15s;
  text-decoration: none;
}

.btn:hover { opacity: 0.9; text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary   { background: var(--blue-dark); color: white; }
.btn-success   { background: var(--green);     color: white; }
.btn-danger    { background: var(--red);       color: white; }
.btn-warning   { background: var(--orange);    color: white; }
.btn-secondary { background: var(--gray);      color: white; }
.btn-outline   { background: white; color: var(--blue-dark); border: 1.5px solid var(--blue-dark); }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn-lg        { padding: 13px 28px; font-size: 16px; }

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

table.qt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.qt-table th {
  background: var(--blue-dark);
  color: white;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.qt-table th a {
  color: white;
  display: flex;
  align-items: center;
  gap: 4px;
}

.qt-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.qt-table tr:last-child td { border-bottom: none; }

.qt-table tr:hover td { background: var(--blue-light); }

.qt-table .actions { display: flex; gap: 6px; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-dark);
  background: white;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,117,182,0.15);
}

.form-control:disabled { background: var(--gray-light); cursor: not-allowed; }

select.form-control { cursor: pointer; }

.form-hint {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
}

.form-row {
  display: grid;
  gap: 16px;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Checkbox styling */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--blue-dark);
}

/* ── ALERTS / FLASH MESSAGES ─────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }
.alert-error   { background: var(--red-light);   color: var(--red);   border-left: 4px solid var(--red); }
.alert-warning { background: var(--orange-light); color: var(--orange);border-left: 4px solid var(--orange); }
.alert-info    { background: var(--blue-light);  color: var(--blue-dark); border-left: 4px solid var(--blue); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: var(--green-light); color: var(--green); }
.badge-danger  { background: var(--red-light);   color: var(--red); }
.badge-warning { background: var(--orange-light); color: var(--orange); }
.badge-info    { background: var(--blue-light);  color: var(--blue-dark); }
.badge-gray    { background: #E9ECEF; color: var(--gray); }

/* ── SEARCH BAR ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.search-bar .form-control { max-width: 360px; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 20px;
  justify-content: flex-end;
}

.pagination a, .pagination span {
  padding: 7px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--border);
  background: white;
  color: var(--blue-dark);
}

.pagination a:hover { background: var(--blue-light); text-decoration: none; }
.pagination .current { background: var(--blue-dark); color: white; border-color: var(--blue-dark); }
.pagination .disabled { color: var(--gray); pointer-events: none; }

/* ── PERMISSION GRID (Roles screen) ─────────────────────── */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.perm-group-card {
  background: var(--gray-light);
  border-radius: var(--radius);
  padding: 16px;
}

.perm-group-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue-dark);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
}

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-dark);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue-dark);
  line-height: 1.2;
}

.login-logo p {
  font-size: 13px;
  color: var(--gray);
  margin-top: 4px;
}

/* ── EMPTY STATES ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--gray-dark); }
.empty-state p  { font-size: 14px; }

/* ── UTILITY ─────────────────────────────────────────────── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--gray); font-size: 13px; }
.text-danger { color: var(--red); }
.text-success{ color: var(--green); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 10px; }
.flex-1 { flex: 1; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .form-row.cols-2,
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
