/* Custom Branding for Fomra Electricals (Agencies) */

:root {
  --pico-font-family: "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --pico-primary: #129DC3;
  --pico-primary-hover: #1088a9;
  --pico-primary-focus: rgba(18, 157, 195, 0.25);
  --pico-primary-inverse: #FFF;
}

/* --- Responsive View Switching --- */
.desktop-view {
  display: block;
}

.mobile-view {
  display: none;
}

@media (max-width: 767px) {
  .desktop-view {
    display: none;
  }

  .mobile-view {
    display: block;
  }

  /* Responsive Table - Card View */
  .responsive-table thead {
    display: none;
  }

  .responsive-table tr {
    display: block;
    margin-bottom: 1.5rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-card-border-radius);
    padding: 1rem;
    background-color: var(--pico-card-background-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }

  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding: 0.5rem 0;
    text-align: right;
  }

  .responsive-table td:last-child {
    border-bottom: none;
  }

  .responsive-table td::before {
    content: attr(data-label);
    font-weight: bold;
    text-align: left;
    margin-right: 1rem;
  }

  /* Truncate text logic for Details column */
  .truncate-text {
    display: inline-block;
    max-width: 15rem;
    /* Adjust based on typical screen size */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    cursor: pointer;
    color: var(--pico-primary);
    text-decoration: underline;
  }
}

/* --- Mobile Card Styling --- */
.voucher-card {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-card-border-radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  background-color: var(--pico-card-background-color);
}

.voucher-card p {
  margin-bottom: 0.5rem;
}

.voucher-card footer {
  padding-top: 1rem;
}

/* --- Mobile Pagination Styling --- */
#mobile-pagination {
  text-align: center;
  margin-top: 1rem;
}

#mobile-pagination button {
  margin: 0 0.25rem;
}

#mobile-pagination .active {
  background-color: var(--pico-primary);
  color: var(--pico-primary-inverse);
}

/* --- Desktop Table Zebra Striping --- */
#voucher-table-desktop tbody tr:nth-child(even) {
  background-color: var(--pico-muted-background-color);
}

/* --- Scan Page Fixes --- */
#scan-summary-table .item-name {
  word-break: break-word;
  white-space: normal;
  max-width: 180px;
}

.toast {
  max-width: 90vw;
  box-sizing: border-box;
}

/* --- Responsive Navigation --- */
.desktop-nav {
  display: none;
}

.mobile-nav {
  display: block;
}

@media (min-width: 768px) {
  .desktop-nav {
    display: block;
  }

  .mobile-nav {
    display: none;
  }
}

/* Fix for Search Input Overlap with PicoCSS Magnifying Glass Icon globally */
input[type="search"],
input#search,
input[name="search"],
input[placeholder*="Search"] {
  background-image: none !important;
  padding-left: 10px !important;
}

/* =========================================================================
   GLOBAL DATATABLES UI STANDARDIZATION & COMPONENTS 
   ========================================================================= */
.dt-buttons {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  clear: both;
}

/* Compact DataTables Buttons */
.dt-buttons .dt-button {
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
  height: 32px !important;
  line-height: normal !important;
  margin-bottom: 5px !important;
}

/* Unified Custom Excel Button styling */
.dt-buttons .custom-excel-btn {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px !important;
  color: #334155 !important;
  font-size: 0.85rem !important;
  padding: 6px 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-weight: 500 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s ease;
  margin-right: 15px !important;
}

.dt-buttons .custom-excel-btn:hover {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
}

/* Layout for Top Controls */
.dt-top-controls {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 2px;
}

.dataTables_filter {
  display: flex !important;
  justify-content: flex-end !important;
  width: 100% !important;
  margin-bottom: 5px !important;
}

div.dataTables_filter input,
div.dataTables_filter input[type="search"] {
  padding: 8px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-width: 1px !important;
  border-style: solid !important;
  border-color: #cbd5e1 !important;
  border-radius: 4px !important;
  font-size: 0.85rem !important;
  height: 38px !important;
  background-color: #fff !important;
  width: 250px !important;
  margin-left: 10px !important;
  box-shadow: none !important;
  outline: none !important;
}

.dataTables_filter label {
  font-size: 0.85rem !important;
  display: inline-flex !important;
  align-items: center !important;
}

.dataTables_info,
.dataTables_paginate {
  font-size: 0.85rem !important;
  margin-top: 10px !important;
}

/* Base Universal Table Font Configuration */
table.dataTable td {
  padding: 5px 10px !important;
  font-size: 0.8rem;
  white-space: nowrap !important;
}

/* Global Table Header overriding matching the specific Image Mockup */
table.dataTable thead th {
  background-color: #006080 !important;
  color: #ffffff !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  padding: 5px 10px !important;
  padding-right: 25px !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-bottom: none !important;
  white-space: nowrap !important;
}

/* Sorting arrows coloring for Global Headers */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_desc:after {
  color: white !important;
  opacity: 0.8 !important;
}

/* Abstracted Inline Standard Header Search box vectors */
table.dataTable thead th .column-search-input {
  width: 100% !important;
  height: 22px !important;
  min-height: 22px !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  font-size: 0.7rem !important;
  line-height: 1 !important;
  font-weight: normal !important;
  border: 1px solid #ccc !important;
  border-radius: 3px !important;
  color: #333 !important;
  background-color: #fff !important;
}

/* Prevent DataTables from Auto-Centering the body table if it falls short of 100% */
.dataTables_wrapper table.dataTable,
.dataTables_wrapper .dataTables_scrollHeadInner,
.dataTables_wrapper .dataTables_scrollHeadInner table.dataTable {
  margin-left: 0 !important;
  min-width: 100% !important;
}

/* =========================================================================
   GLOBAL FILTER FORM UI STYLING 
   ========================================================================= */
.custom-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  background: #fcfcfc;
  padding: 15px 20px;
  border: 1px solid #eaeaea;
  border-radius: 6px;
  margin-top: 1rem;
  margin-bottom: 0rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.filter-group label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: none;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px;
  font-size: 0.85rem;
  height: 38px;
  background: #fff;
  margin-bottom: 0 !important;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-apply {
  background-color: #006080 !important;
  color: #fff !important;
  border: none !important;
  padding: 0 20px !important;
  border-radius: 4px !important;
  height: 38px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto !important;
  margin: 0 !important;
  cursor: pointer;
}

.btn-reset {
  background-color: #fff !important;
  color: #006080 !important;
  border: 1px solid #006080 !important;
  padding: 0 20px !important;
  border-radius: 4px !important;
  height: 38px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: auto !important;
  margin: 0 !important;
  cursor: pointer;
}

/* Mobile Responsive Global Overrides */
@media (max-width: 768px) {
  .custom-filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .dt-buttons {
    flex-direction: column;
    gap: 10px;
    align-items: stretch !important;
  }

  .dataTables_filter {
    float: none;
    width: 100%;
    margin-bottom: 10px !important;
  }

  .dataTables_filter input {
    width: 100% !important;
  }
}

/* Specific MRN Item Highlighting */
.mrn-cell {
  background-color: rgba(46, 125, 50, 0.1) !important;
}