@font-face {
  font-family: 'Roboto Condensed';
  src: url('../fonts/RobotoCondensed-VariableFont_wght.ttf') format('truetype-variations'),
       url('../fonts/RobotoCondensed-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Roboto Condensed';
  src: url('../fonts/RobotoCondensed-Italic-VariableFont_wght.ttf') format('truetype-variations'),
       url('../fonts/RobotoCondensed-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
    font-family: 'Michroma';
    src: url('../fonts/Michroma-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-right {
  display: flex;
  gap: 10px;
}

.logo-text {
  font-family: 'Michroma', sans-serif;
  font-size: 0.8em;
  font-weight: bold;
  color: var(--text-color);
  text-transform: uppercase;
  margin: 0;
  opacity: 0.7;
}

*, *::before, *::after { 
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fff; --fg: #111;
  --panel-bg: #f4f4f4; --border: #ccc;
  --accent: #00BBBB;
  --btn-bg: var(--accent); --btn-fg: #fff;
  --input-bg: #fff; --input-fg: var(--fg);
}

.dark-mode {
  --bg: #1e1e1e; --fg: #eee;
  --panel-bg: #2a2a2a; --border: #555;
  --accent: #3399ff; --btn-fg: #000;
  --input-bg: #2a2a2a; --input-fg: #fff;
}

#startBox {
  position: relative;
  z-index: 1;
}

#startOverlay .initials-gradient-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  opacity: 1;
}

#startOverlay .light-mode .initials-gradient-bg {
  background: linear-gradient(135deg, #fff 0%, #f5e9db 100%);
}

#startOverlay .dark-mode .initials-gradient-bg {
  background: linear-gradient(135deg, #061539 0%, #000 100%);
}

:root {
  --main-bg-img: url('../assets/bg-light.jpg');
}
.dark-mode {
  --main-bg-img: url('../assets/bg-dark.jpg');
}

body {
  background: var(--main-bg-img) center center/cover no-repeat, var(--bg);
}

html {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--fg);
  transition: background .3s, color .3s;
  overflow-x: hidden;
  padding-bottom: 0em;
}

.top-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.bottom-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding: 0;
  margin: 0;
  width: 100%;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .3em 0.8em;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

#logo { 
  max-height: 1.8rem;
  width: auto;
}

header > div { 
  display: flex;
  gap: .4em;
}

#locationFinderBtn, #printAllTasksBtn, #printByCategoryBtn, #clearJobsBtn, #themeToggle {
  font-size: .75rem;
  white-space: nowrap;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  border-radius: 0;
  padding: .4em 0.8em;
  cursor: pointer;
  transition: opacity .2s;
}

header button { flex: 1; }

button {
  font: inherit;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  border-radius: 0;
  padding: .4em 0.8em;
  cursor: pointer;
  transition: opacity .2s;
}

#jobsTable td.no-print button {
  margin-right: .4em;
}

#jobsTable td.no-print button:last-child {
  margin-right: 0;
}

button:disabled { opacity: .5; cursor: default; }
.btn-assigned { background: #FFA500; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: .3em;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--input-fg);
}

input[type="checkbox"] {
  width: auto;
  margin-right: 0.5em;
  vertical-align: middle;
}

.checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.4em;
}

.checkbox-item label {
  display: flex;
  align-items: center;
  cursor: pointer;
  width: 100%;
}

.checkbox-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 1em 0;
  border: 1px solid var(--border);
  padding: 0.8em;
  background-color: var(--bg);
}

main { 
  padding: .3em;
  padding-bottom: 0;
  width: 100%;
}

#jobForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: .4em;
  margin-bottom: 0;
  width: 100%;
}

#reqDisplay {
  grid-column: 1 / -1;
  font-weight: bold;
  color: var(--accent);
  padding: .3em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  display: flex;
  justify-content: space-between;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
  padding: .5em;
  margin: 0;
}

legend {
  padding: 0 .4em;
  font-weight: bold;
  color: var(--accent);
  font-size: 0.9em;
}

.table-wrapper {
  flex: 1;
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: block;
}

#jobsTable {
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  font-size: .9em;
}

#jobsTable colgroup col {
  margin: 0;
  padding: 0;
}

#jobsTable thead {
  background: var(--panel-bg);
  width: 100%;
}

#jobsTable thead th {
  position: sticky;
  top: 0;
  background: var(--panel-bg);
  padding: .3em .5em;
  text-align: left;
  z-index: 2;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#jobsTable thead th:last-child {
  border-right: none;
}

#jobsTable thead th input {
  width: 100%;
  padding: .2em;
  margin-top: .2em;
  border: 1px solid var(--border);
  border-radius: 0;
}

#jobsTable tbody {
  width: 100%;
}

#jobsTable tbody td {
  padding: .3em .5em;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#jobsTable tbody td:first-child {
  border-left: none;
}

#jobsTable tbody td:last-child {
  border-right: none;
}

.job-counter {
  padding: 0.5em;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.9em;
  color: var(--fg);
  position: sticky; 
  bottom: 0;
  width: 100%;
  z-index: 3; 
}

@supports (-webkit-appearance:none) {
  .bottom-panel {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  .table-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  #jobsTable {
    width: 100%;
  }
  
  html, body, .bottom-panel, .table-wrapper, #jobsTable {
    overflow-x: clip;
  }
}

@-moz-document url-prefix() {
  .bottom-panel {
    width: 100%;
  }
  
  .table-wrapper {
    width: 100%;
  }
  
  #jobsTable {
    width: 100%;
  }

  #jobsTable {
    width: -moz-available;
    table-layout: fixed;
  }
}

@media not all and (min-resolution:.001dpcm) {
  @supports (-webkit-appearance:none) and (stroke-color:transparent) {
    .bottom-panel {
      width: 100%;
    }
    
    .table-wrapper {
      width: 100%;
      margin-right: -10px;
    }
    
    #jobsTable {
      width: 100%;
    }
  }
}

@supports (-ms-ime-align:auto) {
  .bottom-panel {
    width: 100%;
  }
  
  .table-wrapper {
    width: 100%;
  }
  
  #jobsTable {
    width: 100%;
    margin-right: -3px;
  }
}

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .table-wrapper {
    width: 100%;
  }
  
  #jobsTable {
    width: 100%;
    margin-right: -5px;
  }
}

@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
  .table-wrapper {
    width: 100%;
  }
  
  #jobsTable {
    width: 100%;
  }
}

#startOverlay, .modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#startBox, .modal-box {
  z-index: 2100 !important;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.8em;
  width: 300px;
  max-width: 90%;
}

.modal-box h2 { 
  margin-top: 0;
  margin-bottom: 0.5em;
  color: var(--accent);
}

.modal-box label {
  display: block;
  margin: .4em 0;
}

.modal-buttons {
  margin-top: 0.8em;
  display: flex;
  gap: .4em;
  justify-content: flex-end;
}

.button-group {
  display: flex;
  gap: 0.5em;
  justify-content: center;
  margin-top: 0.8em;
}

.button-group button {
  min-width: 100px;
}

.alert-modal {
  text-align: center;
  margin-bottom: 1em;
}

.alert-modal-buttons {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin-top: 1em;
}

.alert-modal-buttons button {
  min-width: 80px;
}

.modal-tabs {
  display: flex;
  margin-bottom: 1em;
  border-bottom: 1px solid var(--border);
}

.modal-tab {
  padding: 0.5em 1em;
  margin-right: 0.5em;
  background: transparent;
  border: 1px solid var(--border);
  border-bottom: none;
  cursor: pointer;
  color: var(--fg);
}

.modal-tab.active {
  background: var(--accent);
  color: var(--btn-fg);
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
}

.timeline {
  margin: 1em 0;
  border-left: 2px solid var(--accent);
  padding-left: 1em;
}

.timeline-event {
  position: relative;
  margin-bottom: 1em;
  padding-bottom: 0.5em;
  border-bottom: 1px dotted var(--border);
}

.timeline-event:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.timeline-event::before {
  content: '';
  position: absolute;
  top: 0.4em;
  left: -1.35em;
  width: 0.7em;
  height: 0.7em;
  background: var(--accent);
  border-radius: 50%;
}

.timeline-date {
  font-size: 0.8em;
  opacity: 0.7;
  margin-bottom: 0.2em;
}

.timeline-action {
  font-weight: bold;
}

.timeline-details {
  font-size: 0.9em;
  margin-top: 0.2em;
}

.location-finder-modal {
  width: 450px;
  max-width: 90%;
}

.search-results {
  max-height: 350px;
  overflow-y: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
}

.search-status {
  font-size: 0.85em;
  margin: 4px 0;
  color: var(--accent);
}

.location-item {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}

.location-item:last-child {
  border-bottom: none;
}

.location-item:hover {
  background-color: var(--panel-bg);
}

.location-room {
  font-weight: bold;
}

.location-dept {
  font-size: 0.85em;
  margin-top: 2px;
  opacity: 0.8;
}

.no-results {
  padding: 15px;
  text-align: center;
  color: var(--fg);
  opacity: 0.7;
}

.location-details {
  padding: 8px;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.details-table th {
  text-align: left;
  padding: 4px;
  vertical-align: top;
  color: var(--accent);
  width: 35%;
}

.details-table td {
  padding: 4px;
  vertical-align: top;
}

.details-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

#printArea { display: none; }
.no-print { }
.print-only { display: none; }

@media print {
  @page { size: A4 portrait; margin: .5cm; }
  
  html, body {
    display: block;
    margin: 0;
    padding: 0;
    font-size: .85em;
    color: #000;
    background: #fff;
    padding-bottom: 0;
    height: auto;
  }
  
  .top-panel, .bottom-panel, .modal-overlay { display: none !important; }
  
  header, #jobForm, .modal-box, #clearJobsBtn, #themeToggle,
  .modal-buttons, thead th input { display: none !important; }
  
  #printArea {
    display: block;
    padding: 0;
    margin: 0;
    height: auto;
  }
  
  .job-print {
    page-break-inside: avoid;
    page-break-after: auto;
    break-inside: avoid;
    margin-bottom: 0.5cm;
    border: 1px solid #888;
    padding: .5cm;
    font-size: 12px;
  }
  
  .job-print:last-child {
    margin-bottom: 0;
    page-break-after: avoid !important;
    break-after: avoid !important;

  }
  
  .job-counter {
    display: none !important;
  }

  .prt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .prt-logo { max-height: 1.5cm; width: auto; }
  
  .prt-reqid { 
    font-size: 1.1em;
  }
  
  .prt-task-number {
    font-size: 0.8em;
    margin-top: 0.2em;
    color: #555;
  }

  .prt-reporter {
    margin-bottom: 0.2cm;
    padding-bottom: 0.2cm;
    border-bottom: 1px dotted #ccc;
  }

  .prt-row {
    display: flex;
    justify-content: space-between;
    margin-top: .3cm;
  }
  
  .prt-col-left, .prt-col-right { width: 48%; }
  .prt-desc { margin: .3cm 0; }
  
  .prt-footer {
    display: flex;
    justify-content: space-between;
  }
  
  .prt-footer-left, .prt-footer-right { width: 48%; }

  .prt-history {
    margin-top: 0.5cm;
    padding-top: 0.3cm;
    border-top: 1px dashed #888;
    font-size: 0.85em;
  }

  .prt-history-title {
    font-weight: bold;
    margin-bottom: 0.2cm;
  }

  .prt-history-item {
    margin-bottom: 0.2cm;
  }

  .prt-history-date {
    color: #555;
  }

  .prt-history-action {
    font-weight: bold;
  }

  .prt-history-details {
    margin-top: 0.1cm;
    color: #555;
  }

  .category-section {
    page-break-before: auto;
    page-break-after: auto;
    break-before: auto;
    break-after: auto;
  }

  .category-section:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .forced-page-break {
    page-break-before: always !important;
    break-before: page !important;
    display: block;
    height: 0;
    margin: 0;
    border: none;
  }

  .category-header {
    margin-top: 0.5cm;
    margin-bottom: 0.5cm;
    padding: 0.2cm;
    background: #f0f0f0;
    border: 1px solid #888;
  }

  .category-header h2 {
    margin: 0;
    font-size: 16px;
    text-align: center;
  }

  .category-header:first-child {
    page-break-before: avoid;
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--panel-bg);
  border: 1px solid var(--border);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  opacity: 0.8;
}

::-webkit-scrollbar-corner {
  background: var(--panel-bg);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--panel-bg);
}

.modal-box ::-webkit-scrollbar-track {
  background: var(--bg);
}

.modal-box ::-webkit-scrollbar-corner {
  background: var(--bg);
}

.table-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  right: -20px;
  bottom: 0;
  width: 20px;
  background-color: var(--bg);
  z-index: 1;
}

.status-indicator {
  padding: 3px 8px;
  border-radius: 0;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 0.9em;
}

.completed-status {
  background-color: #2bd92b;
  color: var(--btn-fg);
}

.cancelled-status {
  background-color: #dc3545;
  color: var(--btn-fg);
}

@media screen and (max-width: 2000px) {
  #jobsTable {
    width: calc(100% + 1px);
  }
}

@media screen and (max-width: 1600px) {
  #jobsTable {
    width: calc(100% + 2px);
  }
}

@media screen and (max-width: 1200px) {
  #jobsTable {
    width: calc(100% + 3px);
  }
}

@media screen and (max-width: 992px) {
  #jobsTable {
    width: calc(100% + 4px);
  }
}

@media screen and (max-width: 768px) {
  #jobsTable {
    width: calc(100% + 5px);
  }
}
