/* ========== Select2 Full Width ========== */
.select2-container {
  width: 100% !important;
}

/* ========== Dashboard Cards ========== */
.card-dashboard {
  width: 100%;
  height: 100%;
  margin-bottom: 16px;
}
.card-dashboard .card-body {
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card-dashboard .card-title {
  font-size: 14px;
  color: #003B70;
  font-weight: 600;
  margin-bottom: 4px;
}
.card-dashboard h2 {
  font-size: 24px;
  font-weight: 700;
  color: #002060;
}

/* Responsive Dashboard Cards */
@media (max-width: 767.98px) {
  .card-dashboard h2 { font-size: 20px; }
  .card-dashboard .card-title { font-size: 12px; }
}

/* ========== Filter Section ========== */
.filter-section {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
#filterSection .col-md-3 {
  padding-left: 10px;
  padding-right: 10px;
}

/* ========== Show Filters Button ========== */
#toggleFilterBtn, .btn-show-filter {
  background-color: #F58220;
  color: white;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  transition: background-color 0.3s ease;
  display: inline-block;
  margin-bottom: 20px;
}
#toggleFilterBtn:hover, .btn-show-filter:hover {
  background-color: #e3701b;
}

/* Apply Filters Button */
#applyFilters {
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 4px;
}

/* ========== Data Table Styles ========== */
.table-responsive {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 500px;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  box-shadow: 0 2px 4px rgba(132, 94, 94, 0.05);
}

/* Base DataTable configuration: keep fixed layout for alignment */
/* CHANGED: consolidated and enforced fixed table layout (removed conflicting auto layout) */
table.dataTable {
  width: 100% !important;
  table-layout: fixed; /* CHANGED: keep fixed layout for alignment */
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.4;
}

/* Make header and body cells wrap similarly to keep alignment */
table.dataTable thead th,
table.dataTable tbody td {
  white-space: normal !important;       /* allow wrapping in both header & body */
  word-wrap: break-word;
  overflow-wrap: break-word;
  vertical-align: middle;
  text-align: center;
  padding: 8px 12px;
  font-size: 14px;
}

/* Custom Table Header Styling */
table.dataTable thead th {
  background-color: #002060 !important; /* GS1 Blue */
  color: white !important;
  font-weight: bold !important;
  text-align: center;
  vertical-align: middle;
  padding: 12px 8px;
  border-bottom: 2px solid #F58220; /* Orange underline */
}

.dataTables_wrapper .dataTables_scroll {
  overflow-x: auto;
}

/* Responsive table font size */
@media (max-width: 768px) {
  table.dataTable thead th,
  table.dataTable tbody td {
    font-size: 12px;
    padding: 6px 8px;
  }
}

/* Column Width Control for Supplier Table */
#supplierTable th:nth-child(4),
#supplierTable td:nth-child(4) {
  max-width: 200px;
}
#supplierTable th:nth-child(6),
#supplierTable td:nth-child(6) {
  max-width: 220px;
}
#supplierTable th,
#supplierTable td {
  padding: 8px 12px;
}

/* ========== Table Titles ========== */
.table-title {
  font-size: 18px;
  font-weight: 700;
  color: #003B70;
  border-left: 5px solid #F58220;
  padding: 8px 12px;
  background-color: #f0f4f8;
  margin: 20px 0 10px 0;
  display: inline-block;
}

/* ========== Table Headers ========== */
.custom-header th,
.table thead th,
#supplierTable thead th,
#summaryTable thead th,
#eventTable thead th {
  background-color: #002060 !important;
  color: #ffffff !important;
  font-weight: bold !important;
  text-align: center !important;
  vertical-align: middle !important;
  padding: 12px !important;
  font-size: 14px !important;
  border-bottom: 2px solid #F58220 !important;
}

/* ========== DataTables Buttons ========== */
.dataTables_wrapper .dt-buttons {
  float: right;
  margin-bottom: 10px;
}
.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
}

/* ========== Export Button ========== */
.btn-export {
  background-color: #F58220 !important;
  color: #ffffff !important;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  padding: 6px 16px;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.btn-export:hover {
  background-color: #e3701b !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* ========== Modal Styling ========== */
.modal-header {
  background-color: #002060;
  color: white;
}
.modal-body {
  max-height: 400px;
  overflow-y: auto;
}
#columnToggleModal .form-check,
#summaryColumnToggleModal .form-check {
  margin-bottom: 10px;
}
.form-check-label {
  font-weight: normal;
}

/* Fix white gap and width mismatch in DataTable header when scrollX is true */
.dataTables_wrapper .dataTables_scrollHead {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.dataTables_wrapper .dataTables_scrollHeadInner {
  width: 100% !important;
}

.dataTables_scrollHeadInner table {
  width: 100% !important;
  margin: 0 !important;
}

/* scroll body behaviour */
.dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 400px !important;
}

.card-dashboard .card-title {
  white-space: nowrap;
}
#eventTable {
  width: 100% !important;
}

/* Navigation submenu styling unchanged */
.az-menu-sub.reports-submenu .nav-item {
  padding-left: 0;
  margin-left: 0;
}
.az-menu-sub.reports-submenu > .nav-item > .nav-link {
  padding-left: 16px;
}
.az-menu-sub.reports-submenu .az-menu-sub {
  margin-left: 16px;
}
.reports-submenu > li {
  padding-left: 0 !important;
  margin-left: 0 !important;
}
.reports-submenu > li > a {
  padding-left: 20px !important;
  display: block;
  font-weight: 500;
}
.reports-submenu .dgft-submenu {
  margin-left: 20px;
}

body {
  margin: 20px;
}

#filtersContainer {
  margin-bottom: 20px;
}

/* Allow text wrap inside specific table cells (kept) */
#supplierTable tbody td, #summaryTable tbody td {
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  vertical-align: middle;
}
#supplierTable thead th, #summaryTable thead th {
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Fix alignment & background for scrollX headers (keep header style consistent) */
.dataTables_scrollHead table.dataTable thead th {
  background-color: #002060 !important;
  color: white !important;
  border-bottom: 2px solid orange;
  white-space: normal !important;
}

/* Hide duplicate header in scroll body (DataTables clones headers) */
.dataTables_scrollBody table.dataTable thead {
  visibility: collapse;
}

/* Ensure fixed table layout for all tables at the end (final enforcement) */
/* CHANGED: final enforcement to avoid accidental overrides elsewhere */
table.dataTable, .table {
  table-layout: fixed !important;
  width: 100% !important;
}

/* Force wrapping for headers and cells */
table.dataTable th, 
table.dataTable td {
  white-space: normal !important;
  word-wrap: break-word;
  word-break: break-word;
}

/* Fixed table layout so columns align */
table.dataTable {
  table-layout: fixed;
}

/* Optional: set a reasonable min-width so short data doesn't look cramped */
table.dataTable th, 
table.dataTable td {
  min-width: 100px; 
}}

/* Final small fix for DataTables scroll head/body margin */
.dataTables_scrollHeadInner table,
.dataTables_scrollBody table {
  margin: 0 !important;
}

/* ===== Pending Approval DataTable Styling ===== */
#productTable {
  width: 100% !important;
  border-collapse: collapse !important;
}

#productTable th,
#productTable td {
  white-space: nowrap;
  vertical-align: middle !important;
}

/* ===== DataTables Wrapper Scroll ===== */
.dataTables_wrapper {
  width: 100% !important;
  overflow-x: auto !important;
}

/* ===== Select2 Full Width ===== */
.select2-container {
  width: 100% !important;
}

/* ===== Pagination Spacing ===== */
.dataTables_wrapper .dataTables_paginate {
  margin-top: 10px;
}

/* Force the table to allow horizontal scroll */
.dataTables_wrapper {
  overflow-x: auto;
}

/* Remove fixed layout so columns can breathe */
#productTable {
  table-layout: auto !important;
  width: 100% !important;
  white-space: nowrap; /* Keep header text on one line */
}

/* Keep thead from wrapping */
#productTable th {
  white-space: nowrap;
}
.password-wrapper { position: relative; }
  /* make room for the icon inside the input */
.password-wrapper .form-control { padding-right: 2.75rem; }
  /* center the eye icon vertically & remove boxy look */
.password-toggle {
  position: absolute;
  top: 50%;
  right: .75rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}
.password-toggle:focus { outline: none; }
.password-toggle i { font-size: 1rem; opacity: .65; }
.password-toggle:hover i { opacity: .9; }

.az-header-menu .az-menu-sub { display: none; }
.az-header-menu .nav-item.show > .az-menu-sub { display: block; }

 
/* This tells the table to respect the widths calculated by DataTables JS */
.dataTables_scrollHeadInner,
.dataTables_scrollHeadInner table {
    width: 100% !important;
}

/* Allow dynamic column widths for dispatchTable and secondaryTable */
#dispatchTable.dataTable,
#dispatchTable {
  table-layout: auto !important;
}

#dispatchTable.dataTable th,
#dispatchTable.dataTable td {
  white-space: normal !important;
  word-break: break-word;
}

/*
 ===============================================
 FINAL OVERRIDE FOR SPECIFIC GLN COLUMNS
 (Add this to the very bottom of your CSS file)
 ===============================================
*/

/* Target the 5th and 15th table data cells */
#dispatchTable td:nth-child(5),
#dispatchTable td:nth-child(15) {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
}


.main-table tbody tr:not(:last-child) {
        border-bottom: 2px solid #6c757d;
    }
    .nested-table {
        width: 100%;
        border: none;
    }
    .nested-table td {
        border: none;
        padding: 4px 8px;
        vertical-align: top;
    }
    .nutrient-table {
        margin-top: 8px;
        width: 100%;
    }
    .nutrient-table td {
        padding: 4px;
    }

    /* Heading font sizes */
    .text-center h1 {
        font-size: 1.0rem;
    }
    .card-header h6 {
        font-size: 0.9rem;
    }

        #productInfoTable {
            table-layout: fixed; /* This forces the table to obey the widths we set */
        }

        #productInfoTable thead th {
            font-size: 12px; 
            vertical-align: middle; 
            white-space: nowrap; 
        }

        .filter-card { border: 1px solid #e3e7ed; box-shadow: 0 1px 3px rgba(0,0,0,.03); }
        .attribute-cell { padding: 0 !important; }
        .attribute-table { width: 100%; border-collapse: collapse; }
        .attribute-table > tbody > tr > td { border: 0; padding: 8px; vertical-align: top; }
        .attribute-table .gtin-category-row td { padding-bottom: 5px; }
        .attribute-table .gtin-value { font-weight: bold; }
        .attribute-table .category-value { float: right; background-color: #007bff; color: white; padding: 2px 8px; border-radius: 4px; font-size: 0.8em; }
        .nested-info-table { width: 100%; border: 1px solid #dee2e6; margin-top: 5px; }
        .nested-info-table th, .nested-info-table td { padding: 6px; border: 1px solid #dee2e6; font-size: 0.9em; }
        .nested-info-table th { background-color: #f8f9fa; font-weight: bold; }
        .main-table-row { border-bottom: 2px solid #6c757d; }


    .az-content {
        flex-grow: 1;
    }

    body { background-color: #f4f5f8; }
    .az-content-body { display: block !important; }
    .reports-page-wrapper { display: flex; flex-direction: column; width: 100%; }
    .page-title-section { margin-bottom: 20px; }
    .page-title-section h2 { font-weight: 700; color: #1c273c; }
    .page-title-section p { color: #6a7989; font-size: 1rem; }
    .reports-container { background-color: #fff; border: 1px solid #dee2e6; border-radius: 5px; padding: 0; }
    .nav-tabs { padding: 10px 20px 0 20px; border-bottom: 1px solid #dee2e6; }
    .nav-tabs .nav-link { border: none; border-bottom: 3px solid transparent; color: #6a7989; font-weight: 500; padding: 1rem; }
    .nav-tabs .nav-link.active, .nav-tabs .nav-link:hover { border-bottom-color: #5b47fb; color: #1c273c; }
    .list-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; }
    .list-header h5 { font-weight: 600; margin: 0; }
    .list-header h5 span { font-size: 14px; background-color: #e3f2fd; color: #0d6efd; padding: 3px 8px; border-radius: 50px; margin-left: 8px; }
    .list-header .search-box { width: 100%; max-width: 300px; }
    .table thead th { font-weight: 600; font-size: 12px; text-transform: uppercase; color: #6a7989; background-color: #fff; border-top: none; padding: 1rem 1.5rem; }
    .table tbody td { padding: 1rem 1.5rem; vertical-align: middle; }
    .table .report-name { font-weight: 600; color: #1c273c; }
    .table .action-link { font-weight: 600; color: #5b47fb; text-decoration: none; }
  
    /* Style for download notifications */
    .download-toast {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background-color: #002060;
        color: white;
        padding: 15px 20px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1060;
        display: none;
        align-items: center;
        gap: 15px;
        font-size: 1rem;
    }
    .download-toast .spinner {
        border: 3px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        border-top: 3px solid #fff;
        width: 24px;
        height: 24px;
        animation: spin 1s linear infinite;
    }
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    .download-toast.success {
        background-color: #17a00e;
    }
    .download-toast.error {
        background-color: #d43f3a;
    }
    .download-toast a {
        color: #fff;
        font-weight: bold;
        text-decoration: underline;
    }

        
        body { background-color: #f8f9fa; }
        .container { max-width: 960px; }
        .date-header {
            font-size: 1.25rem;
            font-weight: 600;
            color: #002060;
            padding-bottom: 0.5rem;
            border-bottom: 2px solid #dee2e6;
            margin-top: 2rem;
            margin-bottom: 1rem;
        }
        .download-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1.5rem;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.07);
            margin-bottom: 1rem;
            transition: box-shadow 0.2s ease-in-out;
        }
        .download-card:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }
        .download-info { flex-grow: 1; }
        .download-info h5 {
            font-weight: 600;
            margin-bottom: 0.25rem;
            color: #343a40;
        }
        .download-info p {
            font-size: 0.9rem;
            color: #6c757d;
            margin-bottom: 0;
        }
        .download-status .badge {
            font-size: 0.8rem;
            padding: 0.4em 0.7em;
        }
        .btn-download {
            font-weight: 600;
            padding: 0.5rem 1rem;
        }

      
        /* Styles for the download notification toast from your file */
        .download-toast {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background-color: #002060;
            color: white;
            padding: 15px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 1060;
            display: none;
            align-items: center;
            gap: 15px;
            font-size: 1rem;
        }
        .download-toast .spinner {
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top: 3px solid #fff;
            width: 24px;
            height: 24px;
            animation: spin 1s linear infinite;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .download-toast.success { background-color: #17a00e; }
        .download-toast.error { background-color: #d43f3a; }
        .download-toast a {
            color: #fff;
            font-weight: bold;
            text-decoration: underline;
        }
    

        /* Ensure the table takes up the full width */
        #reportTable {
            width: 100%;
        }

        /* Set a specific width and left-align the first column (Report Name) */
        #reportTable th:first-child,
        #reportTable td:first-child {
            width: 75%;
            text-align: left;
        }

        /* Set a specific width and right-align the second column (Action) */
        #reportTable th:nth-child(2),
        #reportTable td:nth-child(2) {
            width: 25%;
            text-align: right;
            padding-right: 20px;
        }
    

        .loading-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(255, 255, 255, 0.8);
            z-index: 100;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            transition: opacity 0.3s;
        }
        .loading-overlay .spinner-icon {
            font-size: 50px;
            color: #5b47fb;
        }
        .loading-overlay .loading-text {
            margin-top: 15px;
            font-size: 1.2em;
            color: #333;
            font-weight: 500;
        }
        #detailsTable {
            table-layout: fixed;
            width: 100% !important;
        }
        #detailsTable th, #detailsTable td {
            white-space: nowrap;
        }


        .filter-card { border: 1px solid #e3e7ed; box-shadow: 0 1px 3px rgba(0,0,0,.03); }
        #productInfoTable { border-collapse: separate; border-spacing: 0 1rem; width: 100% !important; }
        #productInfoTable thead { display: none; }
        #productInfoTable td { padding: 0 !important; border: none; }
        .product-block { display: flex; border: 1px solid #dee2e6; background-color: #fff; padding: 10px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
        .company-info { width: 20%; padding-right: 15px; border-right: 1px solid #e3e7ed; font-size: 0.85rem; color: #6c757d; }
        .company-info h6 { font-weight: 600; margin-bottom: 2px; color: #002060; }
        .main-content { width: 70%; padding: 0 15px; }
        .details-table { width: 100%; border-collapse: collapse; }
        .details-table th, .details-table td { border: 1px solid #dee2e6; padding: 4px 8px; vertical-align: top; }
        .details-table th { background-color: #f8f9fa; font-weight: bold; text-align: left; }
        .details-table .sub-label { font-size: 0.75rem; color: #6c757d; font-weight: bold; width: 80px; }
        .details-table .value-cell { word-wrap: break-word; }
        .scores { width: 10%; text-align: center; border-left: 1px solid #e3e7ed; padding-left: 10px; display: flex; flex-direction: column; justify-content: center; gap: 15px; }
        .score-box { font-size: 0.8rem; }
        .score-box b { font-size: 1.2rem; display: block; color: green; }
        #imageModalBody { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
        .image-container { text-align: center; width: 150px; }
        .image-container h5 { font-size: 1rem; margin: 5px 0; font-weight: 600; }
        .image-quality { font-size: 0.8rem; color: #6c757d; margin-top: 5px; }
  
        




