/* 
base.css
Consolidated base styles: layout, navigation, cards, buttons, tables
Dependant on _utilities.css and _theme.css
*/

/* ===== Global Layout ===== */

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  align-items: stretch;
}

/* ===== Sidebar Navigation ===== */

#navbar-placeholder {
  background: var(--sidebar);
  align-self: stretch;
  min-height: 100%;
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100%;
}

.brand {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: .3px;
}

nav {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--sidebar-ink);
  text-decoration: none;
  font-weight: 600;
  opacity: .9;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .06);
}

.nav-item.active {
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}

.dot {
  min-width: 10px;
  min-height: 10px;
  margin: 0px 4px;
  border-radius: 3px;
  background: var(--sidebar-ink);
  opacity: .6;
}

.spacer {
  flex: 1;
}

.settings {
  opacity: .8;
}

/* ===== Main Content Area ===== */

.main {
  padding: 32px 28px 40px;
}

.content {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.content.single-column {
  display: block;
}

.single-column .form-wrapper {
  max-width: 620px;
  margin: 0 auto;
}

article {
  padding: 32px 28px 40px;
  max-width: 80%;
  min-width: 200px;
}

/* ===== Typography ===== */

h1 {
  margin: 0 0 18px;
  font-size: 32px;
  letter-spacing: -.02em;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

/* ===== Top Navigation Bar ===== */

.topbar {
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.topbar .greeting {
  font-size: 20px;
  font-weight: 700;
}

/* ===== Cards ===== */

.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 18px;
}

.card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.card .bd {
  padding: 14px;
}

.card .bd hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.card-spaced {
  margin-bottom: 18px;
}

/* ===== Card Variants ===== */

.card-customer,
.card-job {
  display: inline-block;
}

.card-grid-phase {
  border: rgba(164, 11, 2, .7);
  padding: 5px;
  border-top-width: 5px;
  border-top-style: solid;
  border-bottom-width: 5px;
  border-bottom-style: solid;
  border-radius: 3px;
  border-width: 2px;
}

.card-grid-phase h4 {
  grid-column: 1 / -1;
  margin: 0 0 12px 0;
}

.grid-col {
  display: grid;
  grid-auto-flow: column;
  grid-auto-rows: 40px;
  grid-template-rows: repeat(auto-fill, minmax(10px, 1fr));
  overflow-x: auto;
  align-items: start;
  gap: 8px;
  padding: 20px;
}

/* ===== Job Card Components ===== */

.job-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.job-card:hover {
  transform: translateY(-2px);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.job-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px 0;
}

.job-id {
  font-size: 12px;
  color: var(--muted);
}

.job-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-completed {
  background: #10b981;
  color: white;
}

.status-in-progress {
  background: #3b82f6;
  color: white;
}

.status-not-started {
  background: #6b7280;
  color: white;
}

.status-incomplete {
  background: #ef4444;
  color: white;
}

.job-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}

.job-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.job-summary {
  margin-bottom: 15px;
  font-size: 18px;
  line-height: 1.4;
}

.job-summary div {
  margin-bottom: 6px;
}

.job-summary div span {
  font-weight: 600;
  color: var(--muted);
}

/* ===== Grid Layout ===== */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.group-flex {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.thumbnail {
  height: 100%;
  width: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.thumbnail:hover {
  border-color: var(--primary, #0070c9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

/* ===== Buttons ===== */

button, .btn, .btn-primary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  margin: 2px;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--brand);
  color: #fff;
  transition: background .2s ease;
  font-size: 13px;
}

button.disabled {
    background: var(--muted);
}

button:hover, .btn:hover, .btn-primary:hover {
  background: #153597;
  box-shadow: 0 8px 16px rgba(37, 99, 235, .25);
}

button.secondary, .btn-secondary {
  background: var(--brand-secondary);
  color: var(--inverted-ink);
  border: 1px solid var(--border);
}

button.secondary:hover, .btn-secondary:hover {
  background: var(--muted);
  opacity: 0.8;
}

/* ===== Tables ===== */

table,
.table {
  width: 100%;
  border-collapse: collapse;
}

th,
td,
.table th,
.table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th,
.table th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}

/* ===== Custom Fields ===== */

.material-custom-fields {
  margin-top: 6px;
}

.custom-field-line {
  font-size: inherit;
  color: var(--muted);
}

.custom-field-name {
  font-weight: 600;
  color: var(--ink);
}

/* ===== Status Classes ===== */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status.paid {
  background: rgba(22, 163, 74, .08);
  border-color: rgba(22, 163, 74, .35);
}

.status.due {
  background: rgba(217, 119, 6, .1);
  border-color: rgba(217, 119, 6, .4);
}

.status.overdue {
  background: rgba(220, 38, 38, .08);
  border-color: rgba(220, 38, 38, .35);
}

.status-approved {
  color: #16a34a;
  font-weight: 600;
}

.status-pending {
  color: #d97706;
  font-weight: 600;
}

.status-rejected {
  color: #dc2626;
  font-weight: 600;
}

/* ===== Search & Filters ===== */

.search-bar {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
}

.filter-select {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.filter-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .35);
}

/* ===== Breadcrumb ===== */

.breadcrumb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--background);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 6px;
}

.breadcrumb-pill a {
  color: var(--brand);
  text-decoration: none;
}

.breadcrumb-pill a:hover {
  text-decoration: underline;
}

.breadcrumb-pill .current {
  color: var(--muted);
}

/* ===== Timeline ===== */

.timeline {
  display: grid;
  gap: 10px;
}

.step {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
}

.dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  background: #fff;
  font-size: 13px;
}

.dot.done {
  background: rgba(22, 163, 74, .1);
  border-color: rgba(22, 163, 74, .5);
}

.dot.current {
  background: rgba(37, 99, 235, .1);
  border-color: rgba(37, 99, 235, .6);
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Progress Bar ===== */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--brand);
  transition: width 0.3s;
}

.bar {
  background: #e5e7eb;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  margin-top: 6px;
}

.fill {
  background: var(--brand);
  height: 100%;
}

.track {
  height: 14px;
  background: #edf1f7;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

/* ===== Stats ===== */

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat label {
  font-weight: 600;
  color: var(--muted);
}

.stat .value {
  font-size: 20px;
  font-weight: 600;
}

/* ===== Settings Toggle ===== */

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .4s;
}

input:checked+.slider {
  background-color: var(--brand);
}

input:checked+.slider:before {
  transform: translateX(26px);
}

.info {
  display: grid;
  grid-template-columns: 280px 1fr;
  padding-bottom: 1.5em;
}

.pwdReqMet {
  color: green;
  list-style: '\2714';  /* Changes bullet to checkmark */
}

.pwdReqUnmet {
  color: red;
  list-style-type: circle;
}

/* ===== Prompt Boxes ========== */

#generic-message-box-overlay{
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items : center;
    justify-content: center;
    z-index: 9999;
}

#user-prompt-box{
    position: fixed;  /* Fixed positioning to keep it on screen */
    top: 50%;         /* Aligns box vertically center */
    left: 50%;        /* Aligns box horizontally center */
    transform: translate(-50%, -50%);  /* Shifts the box back by half of its width and height */
    background-color: var(--background-secondary);  
    border: 2px solid #ccc;   
    border-radius: 10px;      /* Rounded corners */
    box-shadow: 10px 8px rgba(160, 160, 160, 0.13);  
    padding: 20px;            
    z-index: 1000; 
    color: var(--ink);
}

#user-prompt-box input{
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

#generic-message-box{
    background: var(--background-secondary);
    border-radius: 8px;
    box-shadow: 10px 8px rgba(160, 160, 160, 0.13);
    fill-opacity: 0.2;
    max-width: 90vh;
    max-height: 80vh;
    overflow-y: auto;
    position: fixed;
    top: 50%;
    left: 50%;
    font-size: 1.1rem;
    color: var(--ink);
    border: 1px solid var(--border);
}

#generic-message-content{
    padding: 24px 32px;
    margin-bottom: 20px;
}
#generic-message-box p {
    padding: 24px 32px;
    margin-bottom: 20px;
}

#generic-message-close{
    position: absolute;
    top: 8px;
    right: 12px;
    background-color: #eee;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

/* ===== Image Modal ===== */

.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.image-modal.hidden {
  display: none;
}

.image-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2001;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.modal-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  border-radius: 4px;
  width: 50px;
  height: 50px;
  font-size: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: bold;
}

.modal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-50%) scale(1.1);
}

.modal-prev-btn {
  left: 20px;
}

.modal-next-btn {
  right: 20px;
}

.modal-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}

/* ===== Responsive Design ===== */

@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    overflow: auto;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 1100px) {
  .brand span {
    display: none;
  }

  .nav-item span {
    display: none;
  }
}

/* ===== Modal Overlay ===== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none !important;
}

/* ===== Modal Card ===== */

.modal-card {
  background: #fff;
  color: #111;
  font-size: 14px;
  border-radius: 12px;
  padding: 28px 32px;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

body.dark .modal-card {
  background: #1e293b;
  color: #f1f5f9;
}

.modal-card h3 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 400;
  color: #111;
}

body.dark .modal-card h3 {
  color: #f1f5f9;
}

.modal-card ul {
  margin: 0 0 20px;
  padding-left: 20px;
  line-height: 1.8;
  color: #333;
}

body.dark .modal-card ul {
  color: #cbd5e1;
}

/* ===== Modal Form Grid ===== */

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.modal-grid label:has(input[type="checkbox"]) {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.modal-grid label:has(input[type="checkbox"]) input {
  margin: 0;
}

.modal-grid .input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--background);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
}

.modal-grid .input:focus {
  outline: none;
  border-color: var(--brand, #0070c9);
  box-shadow: 0 0 0 3px rgba(0, 112, 201, 0.1);
}

/* ===== Modal Actions ===== */

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions .btn {
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.modal-actions .btn:not(.btn-secondary) {
  background: var(--brand, #0070c9);
  color: white;
}

.modal-actions .btn:not(.btn-secondary):hover {
  opacity: 0.9;
}

