/*Main CSS file for the APP */

body {
    font-size: .875rem;
  }
  
  .feather {
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
  }
  
  /*
   * Sidebar
   */
  
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000; /* Above the navbar */
    padding: 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, .1);
    background-color: #f8f9fa;
    width: 60px; /* Default to collapsed */
    overflow: hidden;
  }

  .sidebar.transition-enabled {
    transition: width 0.3s ease;
  }

  .sidebar.expanded {
    width: 250px;
  }

  .sidebar-header {
    padding: 1rem;
    background-color: #343a40;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    height: 60px;
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    cursor: pointer;
    user-select: none;
    width: 100%;
  }

  .sidebar-brand:hover {
    opacity: 0.8;
  }

  .sidebar-brand .logo-img {
    width: auto;
    height: 2em;
    vertical-align: middle;
    margin-right: 8px;
    flex-shrink: 0;
  }

  .sidebar .sidebar-brand .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .sidebar.expanded .sidebar-brand .logo-text {
    opacity: 1;
    width: auto;
  }

  .sidebar .sidebar-brand .logo-img {
    margin-right: 0;
  }

  .sidebar.expanded .sidebar-brand .logo-img {
    margin-right: 8px;
  }
  
  .sidebar-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 60px; /* Height of sidebar header */
    height: calc(100vh - 60px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
  }
  
  .sidebar .nav-link {
    font-weight: 500;
    color: #333;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
  }

  .sidebar .nav-link .feather {
    margin-right: 0;
    color: #999;
    min-width: 16px;
    flex-shrink: 0;
  }

  .sidebar.expanded .nav-link .feather {
    margin-right: 8px;
  }

  .sidebar .nav-text {
    transition: opacity 0.3s ease;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .sidebar.expanded .nav-text {
    opacity: 1;
    width: auto;
  }

  .sidebar .nav-link {
    justify-content: center;
    padding: 0.75rem 0.5rem;
    text-align: center;
  }

  .sidebar.expanded .nav-link {
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    text-align: left;
  }
  
  .sidebar .nav-link.active {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
  }
  
  .sidebar .nav-link:hover .feather,
  .sidebar .nav-link.active .feather {
    color: inherit;
  }

  .sidebar .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
  
  .sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
  }

  /* Main content area */
  .main-content {
    margin-left: 60px; /* Default to collapsed */
    min-height: 100vh;
    font-size: .875rem; /* Normalize body text to 14px across pages */
  }

  .main-content.transition-enabled {
    transition: margin-left 0.3s ease;
  }

  .main-content.sidebar-expanded {
    margin-left: 250px;
  }

  /* Content spacing */
  .container-fluid {
    padding-left: 50px !important;
    padding-right: 50px !important;
    min-width: 0; /* Prevent overflow */
  }

  @media (max-width: 768px) {
    .container-fluid {
      padding-left: 20px !important;
      padding-right: 20px !important;
    }
  }

  @media (max-width: 767.98px) {
    .sidebar {
      width: 60px;
    }
    
    .main-content {
      margin-left: 60px;
    }

    .sidebar .logo-text,
    .sidebar .nav-text {
      opacity: 0;
      width: 0;
      overflow: hidden;
    }

    .sidebar .nav-link {
      justify-content: center;
      padding: 0.75rem 0.5rem;
    }
  }
  
  /*
   * Navbar
   */
  
  .navbar {
    z-index: 999; /* Behind the sidebar */
    height: 60px;
    min-height: 60px;
  }

  .navbar-brand {
    padding-top: .75rem;
    padding-bottom: .75rem;
    font-size: 1rem;
    height: 60px;
    display: flex;
    align-items: center;
  }
  
  .navbar .form-control {
    padding: .75rem 1rem;
    border-width: 0;
    border-radius: 0;
  }
  
  .form-control-dark {
    color: #fff;
    background-color: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .1);
  }
  
  .form-control-dark:focus {
    border-color: transparent;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
  }
  
  /*
   * Utilities
   */
  
  .border-top { border-top: 1px solid #e5e5e5; }
  .border-bottom { border-bottom: 1px solid #e5e5e5; }
  
  .logo-img {
    width: auto; /* Adjust this value as needed */
    height: 2em; /* Use em or another unit to ensure consistent sizing with text */
    vertical-align: middle; /* Aligns the image vertically with text */
    margin-right: 2px; /* Adjust margin between image and text */
}

.modal-lg {
  max-width: 90% !important;
}
#csvPreviewTable {
  width: 100%;
}

#pdfViewer {
  width: 100%;
  height: 500px;
  border: 1px solid #ccc;
  overflow: auto;
}

.loading {
  display: none;
  font-size: 18px;
}

.modal-full-width {
  width: calc(100% - 300px); /* Adjust width to account for larger right margin */
  max-width: none;
  height: auto;
  max-height: 88vh; /* prevent viewport overflow */
  margin-top: 40px; /* more breathing room from top */
  margin-bottom: auto;
  margin-left: 200px;
  margin-right: 200px; /* Larger right margin */
}

.modal-full-width .modal-content {
  height: auto;
  max-height: calc(88vh - 40px); /* sync with modal container */
  border: none;
  border-radius: 10px; /* Rounded corners for the modal */
  overflow-y: auto; /* Allow scrolling if content overflows */
  margin: auto;
}

.modal-full-width .modal-body {
  overflow-y: auto;
  padding: 20px; /* Add padding inside the modal content */
}

.modal-body.d-flex {
  display: flex;
  justify-content: space-between;
  height: 80vh; /* Adjust as needed */
}

#pdfViewer {
  flex: 2;
  height: 100%;
  border: 1px solid #ccc;
  overflow: auto;
}

#extractedData {
  flex: 1;
  margin-left: 20px;
}

#extractedData .form-group {
  margin-bottom: 15px;
}

.progress {
  height: 25px;
  background-color: #f3f3f3;
}

.progress-bar {
  transition: width 0.4s ease;
}

#bulkProgressContainer {
  padding: 10px; /* Adds padding around the progress container */
}

#bulkProgressBar {
  height: 16px; /* Adjust height for a slightly narrower bar */
  font-size: 12px; /* Adjust font size to fit the narrower bar */
}

#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  z-index: 1051;
  cursor: wait;
}

/* --- END VIEW BTN ACTIVE --- */

.flex-col {
  display: flex;
  flex-direction: column;
}

/* Brand Add button */
.btn-add {
  background: linear-gradient(135deg, #0B9BDD 0%, #45b2e4 100%);
  color: #FFFFFF !important;
  border: none;
  border-radius: 8px;
  min-width: 140px;
  height: 36px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}
.btn-add:hover {
  filter: brightness(0.95);
  color: #FFFFFF !important;
}
.btn-add:focus {
  box-shadow: 0 0 0 0.2rem rgba(11, 155, 221, 0.35);
}

/* Icon sizing within add buttons */
.btn-add [data-feather] {
  width: 16px;
  height: 16px;
}

/* --- Branded Sidebar --- */
:root {
  --brand-primary: #0B9BDD;
  --brand-accent: #B2C0C7;
  --brand-dark: #343A40;
  --brand-light: #FFFFFF;
}

.sidebar {
  background-color: var(--brand-dark);
  box-shadow: 2px 0 5px rgba(0,0,0,.15);
}

.sidebar-header {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-primary) 100%);
  color: var(--brand-light);
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.85);
}
.sidebar .nav-link .feather {
  color: rgba(255,255,255,0.7);
}

.sidebar .nav-link:hover {
  background-color: rgba(11, 155, 221, 0.12);
  color: var(--brand-light);
}

.sidebar .nav-link.active {
  position: relative;
  background-color: rgba(11, 155, 221, 0.2);
  color: var(--brand-light);
}
.sidebar .nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--brand-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar .nav-link + .nav-link {
  border-top: 1px solid rgba(178, 192, 199, 0.08);
}

.sidebar.expanded .nav-link .feather {
  color: rgba(255,255,255,0.9);
}

.navbar {
  background-color: var(--brand-dark);
  border-bottom: 2px solid var(--brand-primary);
}

/* Sign out button in top navbar */
.navbar .signout-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  color: white !important;
}
.navbar .signout-link:hover {
  color: #ffffff !important;
  text-decoration: none;
}
.navbar .signout-link [data-feather] {
  width: 16px;
  height: 16px;
  color: currentColor;
}

/* Clickable table rows (meters list) */
.table .meter-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.table .meter-row:hover {
  background-color: rgba(11, 155, 221, 0.08);
}

/* Relations modal sections */
.rel-section {
  border: 1px solid rgba(178, 192, 199, 0.5);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  min-height: 220px;
}

.rel-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.rel-card {
  border: 1px solid rgba(178, 192, 199, 0.6);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}
.rel-card:hover {
  background-color: rgba(11, 155, 221, 0.06);
  border-color: rgba(11, 155, 221, 0.45);
}
.rel-card .rel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rel-card .rel-header .rel-row {
  flex: 1 1 auto;
  gap: 12px;
}
.rel-card .rel-header .rel-row .rel-kv .label { color: #6c757d; font-size: .8rem; }
.rel-card .rel-header .rel-row .rel-kv .value { font-weight: 700; }
.rel-card .rel-header .rel-row .id-col { align-items: center; justify-content: center; text-align: center; min-width: 60px; }
.rel-card .rel-header .rel-row .id-col .label { display: block; margin-bottom: 2px; }
.rel-card .rel-header .rel-row .id-col .value { font-size: 1rem; font-weight: 800; }
.rel-card .rel-chevron {
  display: inline-block;
  font-size: 20px;
  color: #6c757d;
  transition: transform 0.2s ease;
}
.rel-card.open .rel-chevron {
  transform: rotate(90deg);
}
.rel-card .rel-details {
  display: none;
  margin-top: 8px;
  border-top: 1px dashed rgba(178, 192, 199, 0.6);
  padding-top: 8px;
}
.rel-card.open .rel-details {
  display: block;
}
.rel-row { display: flex; gap: 12px; flex-wrap: nowrap; }
.rel-row .rel-kv { flex: 1 1 140px; }

/* Force two-column layout for invoice cards */
#rel-invoices-cards {
  grid-template-columns: 1fr;
}
.rel-quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 8px;
  padding: 4px 8px;
}
.rel-card.mini {
  padding: 10px 12px;
}
.rel-card.mini .rel-kv { align-items: center; }
.rel-card.mini { text-align: center; display: flex; align-items: center; justify-content: center; min-height: 58px; }
.rel-quick-stats { margin-top: 8px; }
.rel-card.mini .value { font-size: 1.1rem; }
@media (max-width: 992px) {
  .rel-quick-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px) {
  .rel-quick-stats { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .rel-row { flex-wrap: wrap; }
  #rel-invoices-cards { grid-template-columns: 1fr; }
}
.rel-card h6 {
  margin: 0 0 6px 0;
  font-size: .9rem;
}
.rel-kv { display: flex; flex-direction: column; align-items: flex-start; }
.rel-kv span.label { color: #6c757d; font-size: .8rem; margin-bottom: 2px; }
.rel-kv span.value { font-weight: 700; font-size: 1.05rem; color: #343a40; }

.rel-empty {
  display: none;
  height: 140px;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  text-align: center;
}

.rel-meter-title {
  font-size: 1.25rem; /* larger title */
  font-weight: 700;
  margin-bottom: 8px;
}

/* Brand accent on section titles */
.rel-section h6, .rel-meter-title {
  border-left: 3px solid var(--brand-primary);
  padding-left: 8px;
}

/* Remove left accent from card headers; keep only section title */
.rel-card h6 {
  border-left: 0 !important;
  padding-left: 0 !important;
}

/* Compact meter section with inline info */
.rel-section.rel-meter { 
  min-height: 110px; 
  background: rgba(11, 155, 221, 0.08);
  border: 1px solid var(--brand-primary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}
.rel-meter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  text-align: center;
  padding: 0 25px;
  margin-bottom: 25px;
}
.rel-meter-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}
@media (max-width: 768px) {
  .rel-meter-grid { grid-template-columns: 1fr; }
  .rel-meter-stats { grid-template-columns: 1fr; }
}