/* =============================================
   SKY Precision Engineering – App Styles
   Theme: White + Blue (#1A3FA0) + Red (#B50000)
   Borders: thin red lines
============================================= */

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

:root {
  --blue:      #1A3FA0;
  --blue-dark: #122d78;
  --blue-light:#e8eef8;
  --red:       #B50000;
  --red-light: #fdf0f0;
  --white:     #ffffff;
  --gray-50:   #fafafa;
  --gray-100:  #f4f4f5;
  --gray-200:  #e4e4e7;
  --gray-500:  #71717a;
  --gray-700:  #3f3f46;
  --gray-900:  #18181b;
  --sidebar-w: 230px;
  --topbar-h:  56px;
  --radius:    6px;
  --shadow:    0 1px 4px rgba(0,0,0,0.10);
  --border:    1px solid var(--red);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 60%, #0b1f55 100%);
}
.login-box {
  background: var(--white);
  border: var(--border);
  border-radius: 10px;
  padding: 40px 44px;
  width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  text-align: center;
}
.login-box img { width: 200px; margin-bottom: 24px; }
.login-box h2 { font-size: 16px; color: var(--red); margin-bottom: 28px; font-weight: 600; letter-spacing: .5px; }
.login-box .form-group { margin-bottom: 16px; text-align: left; }
.login-box label { font-size: 12px; font-weight: 600; color: var(--gray-700); display: block; margin-bottom: 5px; }
.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border: var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.login-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-light); }
.btn-login {
  width: 100%;
  padding: 11px;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s;
}
.btn-login:hover { background: var(--blue-dark); }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 12px; padding: 8px; background: var(--red-light); border: var(--border); border-radius: 4px; }

/* ---- TOPBAR ---- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--blue);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 2px solid var(--red);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-logo img { height: 36px; border-radius: 4px; background: white; padding: 2px 6px; }
.topbar-title { color: var(--white); font-size: 15px; font-weight: 600; letter-spacing: .3px; display: none; }
@media(min-width:768px){ .topbar-title { display: block; } }
.menu-toggle { background: none; border: none; color: white; font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.menu-toggle:hover { background: rgba(255,255,255,0.15); }
.topbar-icon {
  color: var(--white); font-size: 18px; padding: 6px 10px;
  border-radius: 50%; position: relative; cursor: pointer;
  transition: background .15s;
}
.topbar-icon:hover, .topbar-icon.active { background: rgba(255,255,255,0.15); }
.badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: white; font-size: 9px;
  border-radius: 50%; width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.topbar-user { display: flex; align-items: center; gap: 7px; color: white; font-size: 13px; }
.topbar-user .fa-user-circle { font-size: 22px; }
.user-role-badge {
  background: var(--red); color: white; font-size: 10px;
  padding: 2px 7px; border-radius: 10px; font-weight: 600;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0;
  width: var(--sidebar-w); height: calc(100vh - var(--topbar-h));
  background: var(--white);
  border-right: var(--border);
  overflow-y: auto;
  z-index: 90;
  transition: transform .25s ease;
}
.sidebar.hidden { transform: translateX(-100%); }
.sidebar-nav { padding: 12px 0 24px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; color: var(--gray-500);
  padding: 12px 18px 4px; letter-spacing: 1px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; font-size: 13.5px; color: var(--gray-700);
  border-left: 3px solid transparent;
  transition: all .15s;
  position: relative;
}
.nav-item:hover { background: var(--blue-light); color: var(--blue); border-left-color: var(--blue); }
.nav-item.active { background: var(--blue-light); color: var(--blue); border-left-color: var(--red); font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-badge {
  margin-left: auto; background: var(--red); color: white;
  font-size: 10px; border-radius: 10px; padding: 1px 6px; font-weight: 700;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px;
  transition: margin-left .25s;
}
.main-content.full { margin-left: 0; }

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: var(--border);
}
.page-header h1 { font-size: 20px; color: var(--blue); font-weight: 700; }
.page-header .page-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--blue);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ---- STAT CARDS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); border: var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--blue-light); color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-card .stat-icon.red { background: var(--red-light); color: var(--red); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--blue); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; cursor: pointer; border: none;
  transition: all .15s;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #8a0000; }
.btn-outline { background: white; color: var(--blue); border: var(--border); }
.btn-outline:hover { background: var(--blue-light); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: var(--blue); color: white;
  padding: 10px 12px; text-align: left; font-weight: 600; font-size: 12px;
  border-bottom: 2px solid var(--red);
}
tbody tr { border-bottom: 1px solid var(--red); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--blue-light); }
tbody td { padding: 9px 12px; color: var(--gray-700); }

/* ---- FORMS ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.form-control {
  padding: 8px 11px; border: var(--border); border-radius: var(--radius);
  font-size: 13.5px; color: var(--gray-900); outline: none;
  background: var(--white); transition: border-color .15s;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-light); }
select.form-control { cursor: pointer; }

/* ---- BADGES / STATUS ---- */
.status-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.status-pending    { background: #fff3cd; color: #856404; }
.status-active,
.status-inprogress { background: #d1fae5; color: #065f46; }
.status-completed  { background: #dbeafe; color: #1e40af; }
.status-hold       { background: #fde8e8; color: #9b1c1c; }
.status-available  { background: #d1fae5; color: #065f46; }
.status-busy       { background: #fef3c7; color: #92400e; }
.status-maintenance{ background: #fde8e8; color: #9b1c1c; }

/* ---- ALERT ---- */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; border: var(--border); }
.alert-success { background: #d1fae5; border-color: #065f46; color: #065f46; }
.alert-error   { background: var(--red-light); color: var(--red); }
.alert-info    { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }

/* ---- PROCESS CHIPS ---- */
.process-list { display: flex; flex-wrap: wrap; gap: 6px; }
.process-chip {
  background: var(--blue-light); color: var(--blue); border: 1px solid var(--blue);
  border-radius: 14px; padding: 4px 12px; font-size: 12px; font-weight: 600;
}

/* ---- TABS ---- */
.tab-bar { display: flex; gap: 0; border-bottom: var(--border); margin-bottom: 18px; }
.tab-btn {
  padding: 9px 20px; font-size: 13.5px; font-weight: 600;
  color: var(--gray-500); border: none; background: none; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
  transition: all .15s;
}
.tab-btn:hover { color: var(--blue); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--red); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- FOOTER ---- */
.app-footer {
  margin-left: var(--sidebar-w);
  padding: 10px 24px;
  border-top: var(--border);
  font-size: 12px; color: var(--gray-500); background: var(--white);
  text-align: center;
}

/* ---- FIELD LABEL ---- */
.field-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--gray-500); letter-spacing: .5px; margin-bottom: 2px;
}

/* ---- MOBILE OVERLAY ---- */
.sidebar-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 85;
}
@media(max-width:700px) {
  .sidebar-overlay.active { display: block; }
}

/* ---- RESPONSIVE ---- */
@media(max-width:700px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 14px; }
  .app-footer { margin-left: 0; }
}

/* ---- COMING SOON ---- */
.coming-soon-box {
  text-align: center; padding: 60px 20px;
}
.coming-soon-box .cs-icon { font-size: 52px; color: var(--blue-light); margin-bottom: 14px; }
.coming-soon-box h2 { color: var(--blue); margin-bottom: 8px; }
.coming-soon-box p { color: var(--gray-500); font-size: 14px; }

/* ---- TOPBAR USER LINK ---- */
a.topbar-user {
  display: flex; align-items: center; gap: 7px;
  color: white; font-size: 13px;
  padding: 4px 8px; border-radius: var(--radius);
  transition: background .15s; cursor: pointer;
}
a.topbar-user:hover { background: rgba(255,255,255,0.15); }

/* ---- PRINT STYLES ---- */
@media print {
  .sidebar, .topbar, .app-footer, .btn, form, .tab-bar { display: none !important; }
  .main-content { margin: 0 !important; padding: 10px !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  body { background: white !important; font-size: 12px; }
  thead th { background: #333 !important; color: white !important; }
}

/* ---- PROGRESS TRACKER ---- */
.progress-bar-wrap { background: #f0f0f0; border-radius: 10px; height: 10px; overflow: hidden; }
.progress-bar-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--blue), #3b6fd4);
  transition: width 0.4s ease;
}
.progress-bar-fill.done { background: linear-gradient(90deg, #065f46, #0a9060); }

/* ---- TOOLTIP ---- */
[data-tip] { position: relative; cursor: pointer; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
  background: #333; color: white; padding: 4px 8px; border-radius: 4px;
  font-size: 11px; white-space: nowrap; z-index: 200; pointer-events: none;
}

/* ---- INPUT SEARCH ---- */
.search-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.search-bar input {
  padding: 7px 12px; border: var(--border); border-radius: var(--radius);
  font-size: 13px; outline: none; width: 260px;
}
.search-bar input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-light); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--gray-500);
}
.empty-state i { font-size: 40px; color: var(--gray-200); margin-bottom: 12px; display: block; }
.empty-state h3 { color: var(--gray-700); margin-bottom: 6px; font-size: 15px; }
.empty-state p  { font-size: 13px; }

