/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --primary:       #1A3A5C;
  --primary-light: #2563A8;
  --accent:        #F0A500;
  --sidebar-bg:    #0F2744;
  --sidebar-w:     230px;
  --bg:            #F4F6F9;
  --card:          #FFFFFF;
  --border:        rgba(26,58,92,0.12);
  --text:          #1A2B3C;
  --muted:         #5A6B7D;
  --font:          'Sora', sans-serif;
  --mono:          'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); margin: 0; }

/* ── LAYOUT ─────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1.1rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon i { font-size: 18px; color: var(--sidebar-bg); }
.brand-name { font-size: 13px; font-weight: 600; color: #fff; display: block; }
.brand-sub  { font-size: 10px; color: rgba(255,255,255,0.35); }

.sidebar-section { padding: 0.9rem 0.75rem 0.25rem; }
.sidebar-label {
  font-size: 10px; font-weight: 500;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 0.5rem; margin-bottom: 0.35rem;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 2px;
  transition: background 0.15s;
  border-left: 2px solid transparent;
}
.nav-item i { font-size: 18px; color: rgba(255,255,255,0.4); flex-shrink: 0; }
.nav-item span { font-size: 13px; color: rgba(255,255,255,0.6); }
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item:hover i, .nav-item:hover span { color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: rgba(240,165,0,0.15);
  border-left-color: var(--accent);
}
.nav-item.active i, .nav-item.active span { color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.user-avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.user-name  { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.85); display: block; }
.user-role  { font-size: 10px; color: rgba(255,255,255,0.35); }
.logout-btn {
  margin-left: auto;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.logout-btn i { font-size: 16px; color: rgba(255,255,255,0.3); transition: color 0.15s; }
.logout-btn:hover i { color: #e74c3c; }

/* ── TOPBAR ──────────────────────────────────────────── */
.topbar {
  height: 58px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-breadcrumb { font-size: 12px; color: var(--muted); }
.topbar-breadcrumb span { color: var(--primary-light); font-weight: 500; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}
.topbar-icon-btn i { font-size: 16px; color: var(--muted); }
.notif-dot {
  width: 7px; height: 7px;
  background: #e74c3c; border-radius: 50%;
  position: absolute; top: 5px; right: 5px;
}
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.topbar-toggle {
  background: none; border: none; cursor: pointer; padding: 4px;
}
.topbar-toggle i { font-size: 20px; color: var(--text); }

/* ── PAGE INNER ─────────────────────────────────────── */
.page-inner { padding: 1.5rem; flex: 1; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 18px; font-weight: 600; margin: 0 0 3px; }
.page-header p  { font-size: 13px; color: var(--muted); margin: 0; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
}
.stat-card .stat-label {
  font-size: 12px; color: var(--muted);
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.stat-card .stat-val {
  font-size: 26px; font-weight: 600;
  font-family: var(--mono); line-height: 1;
}
.stat-card .stat-sub { font-size: 11px; margin-top: 4px; }
.stat-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon i { font-size: 15px; }
.stat-ok    .stat-val { color: #1e8a5a; }
.stat-ok    .stat-icon { background: rgba(30,138,90,0.1); }
.stat-ok    .stat-icon i { color: #1e8a5a; }
.stat-ok    .stat-sub { color: #1e8a5a; }
.stat-warn  .stat-val { color: #d97706; }
.stat-warn  .stat-icon { background: rgba(217,119,6,0.1); }
.stat-warn  .stat-icon i { color: #d97706; }
.stat-warn  .stat-sub { color: #d97706; }
.stat-danger .stat-val { color: #d84040; }
.stat-danger .stat-icon { background: rgba(216,64,64,0.1); }
.stat-danger .stat-icon i { color: #d84040; }
.stat-danger .stat-sub { color: #d84040; }
.stat-blue  .stat-val { color: var(--primary-light); }
.stat-blue  .stat-icon { background: rgba(37,99,168,0.1); }
.stat-blue  .stat-icon i { color: var(--primary-light); }
.stat-blue  .stat-sub { color: var(--primary-light); }

/* ── CARDS ──────────────────────────────────────────── */
.card-custom {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.card-title {
  font-size: 14px; font-weight: 600;
  margin-bottom: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title a { font-size: 12px; font-weight: 400; color: var(--primary-light); text-decoration: none; }

/* ── TABLE ──────────────────────────────────────────── */
.table-custom { font-size: 13px; margin: 0; }
.table-custom thead th {
  font-size: 11px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: transparent;
}
.table-custom tbody td { padding: 10px 12px; vertical-align: middle; }
.table-custom tbody tr:hover td { background: var(--bg); }
.table-custom tbody tr:last-child td { border-bottom: none; }
.part-no { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── MACHINE CARDS ──────────────────────────────────── */
.machine-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  text-decoration: none; color: inherit;
  display: block;
}
.machine-card:hover { border-color: var(--primary-light); transform: translateY(-2px); color: inherit; }
.machine-card.down  { border-color: rgba(216,64,64,0.35); }
.machine-icon {
  width: 40px; height: 40px;
  background: rgba(37,99,168,0.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.machine-icon i { font-size: 20px; color: var(--primary-light); }
.machine-icon.danger { background: rgba(216,64,64,0.1); }
.machine-icon.danger i { color: #d84040; }
.machine-icon.warn { background: rgba(217,119,6,0.1); }
.machine-icon.warn i { color: #d97706; }
.machine-name { font-size: 14px; font-weight: 600; margin: 10px 0 2px; }
.machine-code { font-size: 11px; font-family: var(--mono); color: var(--muted); }
.machine-loc  { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.machine-meta {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 6px;
}
.machine-meta-item span { font-size: 13px; font-weight: 500; display: block; }
.machine-meta-item small { font-size: 10px; color: var(--muted); }

/* ── STOCK PROGRESS BAR ─────────────────────────────── */
.stock-progress { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; margin-top: 3px; }
.stock-fill { height: 100%; border-radius: 3px; }

/* ── CHECKLIST ITEMS ────────────────────────────────── */
.check-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.check-item input[type=checkbox] { margin-top: 2px; accent-color: var(--primary-light); flex-shrink: 0; }
.check-name  { font-size: 13px; font-weight: 500; }
.check-std   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.check-group-title {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 1rem 0 0.5rem;
}

/* ── INSPECTION QUESTIONS (Exam-style) ────────────────────────────────── */
.inspection-questions { margin-top: 0.75rem; }
.question-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.q-number {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary-light); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 15px;
}
.q-body { flex: 1; }
.q-text { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.q-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.q-findings { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.q-photo a { font-size: 13px; color: var(--primary-light); text-decoration: none; }

@media (max-width: 600px) {
  .question-card { padding: 10px; gap: 10px; }
  .q-number { width: 36px; height: 36px; font-size: 14px; }
  .q-text { font-size: 14px; }
  .q-meta { gap: 6px; }
}

/* Additional layout tweaks for cleaner single-question UI */
.question-card { gap: 16px; align-items: flex-start; }
.q-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; color: var(--muted); }
.question-card .form-control, .question-card .form-select, .question-card textarea { width: 100%; max-width: 100%; }
.question-card input[type="file"] { padding: 6px 8px; }

@media (max-width: 768px) {
  .question-card { flex-direction: column; padding: 14px; }
  .q-number { margin-bottom: 6px; }
  #next-btn, #prev-btn, #submit-btn { min-width: 110px; }
}

/* Photo preview thumbnails inside question card */
.photo-preview { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.photo-preview img.preview-thumb { width:72px; height:72px; object-fit:cover; border-radius:8px; border:1px solid var(--border); }
.photo-preview img.preview-thumb + img.preview-thumb { margin-left: 6px; }

@media (max-width:480px) {
  .photo-preview img.preview-thumb { width:60px; height:60px; }
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn-eng {
  height: 36px; padding: 0 16px;
  border-radius: 8px;
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-eng-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-eng-primary:hover { background: var(--primary-light); color: #fff; }
.btn-eng-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-eng-outline:hover { background: var(--primary); color: #fff; }
.btn-eng-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-eng-danger { background: #d84040; color: #fff; border-color: #d84040; }

/* ── FILTERS ROW ────────────────────────────────────── */
.filter-row {
  display: flex; gap: 10px;
  flex-wrap: wrap; margin-bottom: 1.25rem;
  align-items: center;
}
.filter-row input, .filter-row select {
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--card);
  outline: none;
}
.filter-row input:focus, .filter-row select:focus { border-color: var(--primary-light); }
.filter-row input { min-width: 200px; }

/* ── LOGIN PAGE ─────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; }
.login-left {
  width: 42%;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  padding: 3rem;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; top: -70px; right: -70px;
  width: 260px; height: 260px;
  border: 45px solid rgba(240,165,0,0.10); border-radius: 50%;
}
.login-left::after {
  content: ''; position: absolute; bottom: -90px; left: -50px;
  width: 300px; height: 300px;
  border: 55px solid rgba(37,99,168,0.15); border-radius: 50%;
}
.login-brand { position: relative; z-index: 1; }
.login-logo {
  width: 52px; height: 52px;
  background: var(--accent); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
}
.login-logo i { font-size: 28px; color: var(--sidebar-bg); }
.login-left h1 { font-size: 26px; font-weight: 600; color: #fff; line-height: 1.3; margin-bottom: .5rem; }
.login-left p  { font-size: 13px; color: rgba(255,255,255,0.45); line-height: 1.7; max-width: 280px; }
.login-stats { margin-top: 2.5rem; display: flex; gap: 2rem; position: relative; z-index: 1; }
.login-stat span { font-size: 22px; font-weight: 600; color: var(--accent); display: block; }
.login-stat small { font-size: 10px; color: rgba(255,255,255,0.4); letter-spacing: .5px; }
.login-right {
  flex: 1; display: flex;
  align-items: center; justify-content: center; padding: 2rem;
}
.login-box { width: 100%; max-width: 380px; }
.login-box h2 { font-size: 22px; font-weight: 600; margin-bottom: .25rem; }
.login-box .sub { font-size: 13px; color: var(--muted); margin-bottom: 2rem; }
.form-lbl { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; display: block; margin-bottom: 5px; }
.form-ctrl {
  width: 100%; height: 44px;
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 0 14px;
  font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--card); outline: none;
  transition: border-color .2s;
}
.form-ctrl:focus { border-color: var(--primary-light); }
.btn-login-submit {
  width: 100%; height: 46px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 10px;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s;
}
.btn-login-submit:hover { background: var(--primary-light); }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 991px) {
  .login-left { display: none; }
  .sidebar {
    position: fixed; left: -var(--sidebar-w); top: 0; height: 100%;
    z-index: 200; transform: translateX(-100%); transition: transform .25s;
  }
  .sidebar.open { transform: translateX(0); }
}
.user-menu-wrapper{
    position:relative;
}

.topbar-user{
    border:none;
    background:#fff;
    display:flex;
    align-items:center;
    gap:12px;
    padding:8px 14px;
    border-radius:14px;
    cursor:pointer;
    box-shadow:0 2px 10px rgba(0,0,0,.05);
}

.topbar-user:hover{
    background:#f8fafc;
}

.user-meta{
    display:flex;
    flex-direction:column;
    text-align:left;
}

.user-meta span{
    font-size:14px;
    font-weight:600;
}

.user-meta small{
    font-size:12px;
    color:#64748b;
}

.user-dropdown{
    position:absolute;
    top:60px;
    right:0;
    width:260px;
    background:#fff;
    border-radius:16px;
    border:1px solid #e5e7eb;
    box-shadow:0 10px 30px rgba(0,0,0,.1);
    opacity:0;
    visibility:hidden;
    transform:translateY(10px);
    transition:.25s;
    z-index:999;
}

.user-dropdown.show{
    opacity:1;
    visibility:visible;
    transform:translateY(0);
}

.dropdown-header{
    display:flex;
    align-items:center;
    gap:12px;
    padding:16px;
    border-bottom:1px solid #e5e7eb;
}

.user-avatar.lg{
    width:50px;
    height:50px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#1e3a8a;
    color:#fff;
    font-weight:700;
}

.dropdown-item{
    display:flex;
    align-items:center;
    gap:10px;
    padding:12px 16px;
    text-decoration:none;
    color:#334155;
}

.dropdown-item:hover{
    background:#f8fafc;
}

.dropdown-divider{
    height:1px;
    background:#e5e7eb;
}

.logout-item{
    color:#dc2626;
}

.logout-item:hover{
    background:#fef2f2;
}

