@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* Force Plus Jakarta Sans across the entire portal for a clean, cohesive, premium look */
body, h1, h2, h3, h4, h5, h6, p, label, input, button, select, textarea, span, td, th, div, a {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

:root {
  box-sizing: border-box;
  --primary: #B41F24;
  --primary-hover: #90191d;
  --primary-light: rgba(180, 31, 36, 0.08);
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-overlay: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: inherit;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  width: 100%;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font: inherit;
}

input, textarea, select, button {
  min-width: 0;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 18px;
}

.card {
  border-radius: 12px;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

button, .btn, .primary-btn, .btn-page {
  border-radius: 8px;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover, .btn:hover, .primary-btn:hover, .btn-page:hover {
  transform: translateY(-1px);
}

@media (max-width: 1024px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  th, td {
    padding: 12px !important;
    font-size: 13px !important;
  }

  .card {
    border-radius: 10px;
  }
}

@media (max-width: 768px) {
  body {
    display: block !important;
    padding-top: 0 !important;
    margin: 0 !important;
  }

  .container {
    width: auto !important;
    max-width: 100% !important;
    margin: 20px 12px !important;
    padding: 20px !important;
    box-sizing: border-box !important;
  }

  .header, .topbar, .header-links, .back-link, .pagination, .pagination-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .header, .topbar {
    justify-content: space-between !important;
    padding: 14px 16px !important;
  }

  .header > div, .topbar > div {
    width: 100% !important;
    min-width: 0 !important;
  }

  .navbar {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 12px 16px !important;
    position: fixed !important;
    background: white !important;
    border-bottom: 5px solid #B41F24 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  }

  .navbar-brand {
    font-weight: 600 !important;
    color: #B41F24 !important;
    font-size: 14px !important;
  }

  .brand-box {
    flex-direction: column !important;
    align-items: center !important;
  }

  .brand-box .divider {
    display: none !important;
  }

  .table-responsive table {
    width: 100% !important;
    table-layout: auto !important;
    min-width: 800px !important; /* Prevent squeezing columns on small viewports */
  }

  .table-responsive th, .table-responsive td {
    word-break: normal !important;
    white-space: nowrap !important; /* Keep status, ID, dates inline */
    padding: 10px 8px !important;
  }

  /* Wrap text for issue/description details while preserving column width */
  .table-responsive td:nth-child(2),
  .table-responsive td:nth-child(3),
  .table-responsive td.wrap-cell {
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 250px !important;
  }

  /* Stretched button overrides */
  .btn, .primary-btn, button {
    width: 100% !important;
    display: block !important;
  }

  /* Keep action and pagination buttons inline/compact */
  .table-responsive button,
  .table-responsive .btn,
  .table-responsive td .btn,
  .table-card button,
  .table-card .btn,
  .table-card td .btn,
  .search-box button,
  .pagination-actions .btn-page,
  .pagination-actions button {
    width: auto !important;
    display: inline-block !important;
    margin: 2px 0 !important;
  }

  /* Collapse admin sidebar on mobile/tablet */
  .sidebar {
    position: relative !important;
    width: 100% !important;
    top: 0 !important;
    bottom: auto !important;
    box-shadow: none !important;
    background: #1a1a1a !important;
    padding: 10px 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-around !important;
  }

  .sidebar a {
    padding: 10px 15px !important;
    font-size: 13px !important;
    border-left: none !important;
    border-bottom: 3px solid transparent !important;
  }

  .sidebar a.active,
  .sidebar a:hover {
    border-left-color: transparent !important;
    border-bottom-color: #B41F24 !important;
  }

  .main {
    margin-left: 0 !important;
    padding: 20px 12px !important;
  }
}

@media (max-width: 640px) {
  body {
    display: block !important;
    padding-top: 0 !important;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .search-box {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .search-box button {
    width: 100% !important;
    display: block !important;
  }

  .card, .login-card, .modal-content, .modal-box {
    width: 100% !important;
    margin: 14px auto !important;
    box-shadow: none !important;
    border-radius: 10px !important;
  }

  .navbar {
    padding: 10px 14px !important;
  }

  .navbar-brand {
    font-size: 13px !important;
  }

  .brand img, .brand-box img {
    max-height: 40px !important;
  }

  .brand-box {
    gap: 10px !important;
  }

  .footer, .footer-link, .pagination-info {
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .header, .topbar, .pagination, .pagination-actions {
    gap: 8px !important;
  }

  .header a, .topbar a, .back-link a, .header-links a {
    width: 100% !important;
  }

  .brand-box {
    gap: 8px !important;
  }

  .table-responsive {
    overflow-x: auto !important;
  }
}

@media (max-width: 420px) {
  html, body { max-width: 100%; overflow-x: hidden !important; }

  .topbar, .header {
    position: relative !important;
    height: auto !important;
    padding: 10px !important;
  }

  .main {
    margin-left: 0 !important;
    padding-top: 8px !important;
  }

  .logo-wrap { padding: 6px 8px !important; gap: 8px !important; display: flex; align-items: center; }
  .logo-slot.metals, .logo-slot.infra { width: auto !important; max-width: 48% !important; }
  .brand img { max-height: 36px !important; }

  .header > div, .topbar > div { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .header a, .topbar a, .footer-link { white-space: normal !important; }

}

/* Premium Centered Corporate Login Styles */
.login-premium-bg {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f8fafc; /* Clean light background */
  position: relative;
  padding: 30px;
  box-sizing: border-box;
}

.login-premium-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
  width: 100%;
  max-width: 460px;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #b41f24; /* Lloyds Red Accent top border */
  padding: 40px 36px;
  box-sizing: border-box;
  z-index: 10;
  position: relative;
}

.login-premium-logo-box {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.login-premium-logo-box .logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  max-width: 100%;
  box-sizing: border-box;
}

.login-premium-logo-box img {
  max-height: 36px;
  max-width: 46%;
  height: auto;
  object-fit: contain;
}

.login-premium-logo-box .logo-divider {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
}

.login-premium-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
}

.login-premium-slogan {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 24px;
  letter-spacing: 0.3px;
  font-style: italic;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 16px;
}

.login-input-group {
  position: relative;
  margin-bottom: 20px;
}

.login-input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrapper i {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 15px;
  transition: color 0.2s ease;
}

.login-premium-input {
  width: 100%;
  padding: 11px 16px 11px 40px; /* offset left padding for icon */
  font-size: 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
  background-color: #f8fafc;
  color: #1e293b;
}

.login-premium-input:focus {
  outline: none;
  border-color: #b41f24; /* Lloyds Red focused border */
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(180, 31, 36, 0.1);
}

.login-premium-input:focus + i {
  color: #b41f24;
}

.login-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 13px;
}

.login-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  cursor: pointer;
  font-weight: 500;
}

.login-checkbox-label input {
  margin: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #b41f24;
}

.login-forgot-link {
  color: #b41f24;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.login-forgot-link:hover {
  color: #8c1619;
}

.login-premium-btn {
  width: 100%;
  padding: 13px;
  background-color: #1e293b;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-premium-btn:hover {
  background-color: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.login-premium-info {
  margin-top: 24px;
  padding: 12px 14px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .login-premium-card {
    padding: 30px 20px;
  }
  .login-premium-logo-box .logo-container {
    padding: 6px 10px;
    gap: 8px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .login-premium-logo-box img {
    max-width: 45%;
    height: auto;
    max-height: 28px;
    object-fit: contain;
  }
}

/* Sidebar Drawer Layout & Analytics */
.sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-drawer.open {
  visibility: visible;
}

.sidebar-drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-drawer.open .sidebar-drawer-overlay {
  opacity: 1;
}

.sidebar-drawer-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  height: 100%;
  background: #ffffff;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
}

.sidebar-drawer.open .sidebar-drawer-content {
  transform: translateX(0);
}

.sidebar-drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.sidebar-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.sidebar-close-btn:hover {
  color: #334155;
}

.sidebar-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.sidebar-info-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 20px;
}

.info-avatar {
  font-size: 40px;
  color: #b41f24;
  display: flex;
  align-items: center;
}

.info-name {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}

.info-role {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.sidebar-menu-section {
  margin-bottom: 24px;
}

.sidebar-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.sidebar-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #334155;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  transition: all 0.2s ease;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.sidebar-menu-link:hover {
  background: #f1f5f9;
  color: #b41f24;
}

.sidebar-switcher-container {
  display: flex;
  flex-direction: column;
}

.sidebar-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-select-wrapper .select-icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  font-size: 13px;
}

.sidebar-select {
  width: 100%;
  padding: 10px 12px 10px 32px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.sidebar-select:focus {
  border-color: #b41f24;
}

.sidebar-analytics-list {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 16px;
}

.sidebar-stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  color: #334155;
  font-weight: 600;
}

.sidebar-stat-item:not(:last-child) {
  border-bottom: 1px solid #f1f5f9;
}

.stat-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.stat-dot.open { background-color: #3b82f6; }
.stat-dot.reopened { background-color: #f59e0b; }
.stat-dot.assigned { background-color: #a855f7; }
.stat-dot.inprogress { background-color: #14b8a6; }
.stat-dot.closed { background-color: #10b981; }
.stat-dot.unassigned { background-color: #ef4444; }

.stat-item-value {
  background: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.sidebar-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
  background: #fca5a5;
}

.clickable-stat {
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.clickable-stat:hover {
  background-color: #f1f5f9 !important;
  transform: translateX(4px);
}

.clickable-stat.active-stat {
  background-color: #e2e8f0 !important;
  border-left: 3.5px solid var(--primary) !important;
  font-weight: 700 !important;
}

.sidebar-menu-link.active {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
}

/* ================= ACCESSIBLE HAMBURGER BUTTON ================= */
.hamburger-btn {
  background: none !important;
  border: none !important;
  font-size: 22px !important;
  color: white !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px !important; /* 44px min touch target size */
  margin-right: 8px !important;
  transition: opacity 0.2s, background-color 0.2s !important;
  border-radius: 50% !important;
}

.hamburger-btn:hover {
  opacity: 0.85;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* ================= RESPONSIVE CONSOLE/PORTAL TITLES ================= */
.brand > span, .brand span {
  transition: all 0.2s ease;
}

@media (max-width: 640px) {
  .brand > span, .brand span {
    font-size: 14px !important;
  }
}

@media (max-width: 520px) {
  .brand > span, .brand span {
    display: none !important; /* Hide on small mobile to fit dual logos cleanly */
  }
}

/* ================= DATE FILTER FORM MOBILE WRAP ================= */
@media (max-width: 480px) {
  .date-filter-form {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  .date-filter-form span {
    text-align: center !important;
    font-weight: 600 !important;
  }
  .date-filter-form input[type="date"] {
    width: 100% !important;
  }
  .date-filter-form button {
    width: 100% !important;
  }
  .date-filter-form a {
    text-align: center !important;
    margin-top: 4px !important;
  }
}

/* ================= DOWNLOAD REPORT FORM MOBILE WRAP ================= */
@media (max-width: 640px) {
  #downloadForm {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  #downloadForm .form-group {
    width: 100% !important;
    flex: none !important;
  }

  #downloadForm button[type="submit"] {
    width: 100% !important;
    margin-top: 8px !important;
    justify-content: center !important;
  }
}

/* ================= CUSTOM SEARCHABLE SELECT DROPDOWN ================= */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  user-select: none;
}

.custom-select-trigger:hover {
  border-color: #94a3b8;
}

.custom-select-container.open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(180, 31, 36, 0.15);
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  margin-top: 4px;
  z-index: 1050; /* ensure it displays above modal overlay */
  display: none;
  overflow: hidden;
}

.custom-select-container.open .custom-select-dropdown {
  display: block;
}

.custom-select-search-wrap {
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.custom-select-search-wrap i {
  color: #94a3b8;
  font-size: 12px;
  margin-right: 8px;
}

.custom-select-search {
  width: 100%;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-size: 12px !important;
  color: #1e293b !important;
  padding: 2px 0 !important;
  box-shadow: none !important;
}

.custom-select-options {
  max-height: 200px;
  overflow-y: auto;
}

.custom-select-option {
  padding: 8px 12px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.custom-select-option:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.custom-select-option.selected {
  background: #fef2f2;
  color: var(--primary);
  font-weight: 600;
}

.custom-select-option.no-results {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  cursor: default;
}

/* Responsive HOD Assign Action layout */
.hod-action {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center !important;
  width: 100% !important;
  min-width: 200px !important;
}

.hod-action .custom-select-container {
  flex: 1 1 130px !important;
  min-width: 120px !important;
  max-width: 220px !important;
}

.hod-action .assign-btn {
  flex: 0 0 auto !important;
}

/* Ensure table scroll container has enough height to not clip absolute dropdown options */
.table-responsive {
  min-height: 320px !important;
}
