/**
 * @file
 * Global responsive table styles for all tables on the website.
 */




th , td{
 text-align: start !important;    
}


/* Make all table containers horizontally scrollable */
.views-element-container,
.view-content,
.form-wrapper,
.details-wrapper,
.field--type-entity-reference,
[id*="table-wrapper"],
[class*="table-wrapper"],
.tabledrag-toggle-weight-wrapper + table,
.responsive-enabled,
form > table,
.region-content table,
.block-system-main-block table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Generic table wrapper class - add this to any container */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  display: block;
}

/* Ensure tables don't break layout */
table {
  min-width: 100%;
}

/* Drupal admin and form tables */
.field-multiple-table,
.draggable-table,
.sticky-header,
#edit-accounts,
.views-table,
.admin-list table {
  overflow-x: auto;
  display: block;
  width: 100%;
}

/* Specific wrapper for tables that need scrolling */
.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin-bottom: 1em;
}

/* For tables inside forms */
form .form-item table,
form .fieldset-wrapper table {
  display: block;
  overflow-x: auto;
}

/* Global form responsiveness */
@media screen and (max-width: 992px) {
  /* Stack form items on medium screens */
  .layout-region-node-main .form-item,
  .node-form .form-item {
    max-width: 100%;
  }
}

/* Responsive behavior */
@media screen and (max-width: 768px) {
  /* Tables scroll horizontally */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Preserve table layout while allowing scroll */
  table thead,
  table tbody,
  table tfoot {
    display: table;
    width: 100%;
  }

  /* Form layout adjustments */
  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions .button,
  .form-actions input[type="submit"] {
    flex: 1 1 100%;
    margin-bottom: 10px;
  }

  /* Details/Accordion sections */
  details.form-wrapper {
    padding: 10px;
  }

  details summary {
    padding: 10px;
  }

  /* Input fields full width */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  select,
  textarea {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  /* Autocomplete fields */
  .form-autocomplete {
    max-width: 100%;
  }

  /* Modal dialogs */
  .ui-dialog {
    max-width: 95vw !important;
    left: 2.5vw !important;
  }

  .ui-dialog .ui-dialog-content {
    padding: 15px !important;
  }
}

@media screen and (max-width: 480px) {
  /* Even smaller screens */
  .ui-dialog {
    width: 100% !important;
    max-width: 100vw !important;
    left: 0 !important;
    margin: 0 !important;
  }

  /* Buttons full width */
  .button,
  input[type="submit"],
  input[type="button"] {
    width: 100%;
    padding: 12px 15px;
    box-sizing: border-box;
  }

  /* Reduce padding on small screens */
  .region-content {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Print styles */
@media print {
  /* Hide non-essential elements */
  .form-actions,
  .pager,
  nav,
  .tabs,
  .action-links {
    display: none !important;
  }

  /* Reset table styles for print */
  table {
    display: table !important;
    overflow: visible !important;
    font-size: 10pt;
  }

  table th,
  table td {
    padding: 5px;
    border: 1px solid #000;
  }
}
