/*
 * Basic table theming
 * This styles regular tables within brand
 */



/*
 * Some tables are defined as entities within the page templates
 * so let's tidy these up first
 */

/* Remove the excessive borders defined by portalbasictheme.css */
body.cyclinguk .entitylist,
body.cyclinguk .grid-actions,
body.cyclinguk .crmEntityFormView,
body.cyclinguk .crmEntityFormView .tab-title {
  border: none;
}

body.cyclinguk .crmEntityFormView {
  /* padding: 10px; */
  background-color: inherit;
}

/* Remove unwanted padding around entities */
body.cyclinguk .crmEntityFormView .cell {
  padding: 0;
}

body.cyclinguk .crmEntityFormView label {
  background-color: inherit;
}


/*
 * Entity List Filters at the top of tables
 */

.entitylist-filter .card-body {
  max-width: 850px;
  margin-left: auto;
  margin-right: auto;
  background-color: #ebeef0;
  padding: 15px;
}

.entitylist-filter .card-body ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 60px;
}

.entitylist-filter .card-body ul li label {
  font-size: 18px;
  color: #365269;
}

/* A rubbish target class but the Apply button is stuck at the far right of this container */
.entitylist-filter .card-body .float-end {
  float: inherit !important;
  display: flex;
  justify-content: center;
}



/*
 * Search box... some more dodgy CSS targeting!
 */

.view-toolbar .float-end {
  float: inherit !important;
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  justify-content: center;
}

button[aria-label="Search Results"] {
  border: 1px solid #fc5c1f;
  background-color: #fc5c1f;
  color: #ffffff;
}


/*
 * And now to tidy up the default table theming and make it more
 * on Cycling UK brand
 */

/* Format the table header */
thead {
  background-color: #365269;
  color: #ffffff;
}

body.cyclinguk #mainContent thead a {
  color: #ffffff;
  text-decoration: none;
}

/* Vertically align cell content to the middle and remove borders */
th,
td {
  vertical-align: middle;
  border: none;
} 

/* Replacement background colour for table striping */
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: #ebeef0;
}

/* Remove the action button from the end of each row */
/* 
 * TEMPORARILY DISABLED
th[aria-label="Actions"],
td[aria-label*="action"] {
  display: none;
}
*/

#mainContent .dropdown.action .btn {
  padding: 0;
  width: 28px;
  height: 28px;
  background-color: #fc5c1f;
  border: 1px solid #fc5c1f;
  color: #ffffff;
  border-radius: 4px;
}

#mainContent .dropdown.action .btn:hover,
#mainContent .dropdown.action .btn.show{
  background-color: #101920;
  border: 1px solid #101920;
  color: #ffffff;
}

#mainContent ul.dropdown-menu.show a {
  text-decoration: none;
}

#mainContent ul.dropdown-menu.show a:hover {
  text-decoration: none !important;
  background-color: #101920;
  color: #ffffff;
}

/* Highlight status labels */
td[data-value="CANCELLED"] {
  color: #365269 !important;
  font-weight: bold;
}

td[data-value="ATTENDED"] {
  font-weight: bold;
  color: #4ccb5a !important;
}

td[data-value="NO SHOW"] {
  font-weight: bold;
  color: #d7263d !important;
}

td[data-value="UNCONFIRMED"] {
  font-weight: bold;
  color: #fc5c1f !important;
}



/*
 * Responsive layout tweaks
 */

@media screen and (min-width: 768px) and (max-width: 1199px) {
  table {
    font-size: 14px;
  }
}

/* This is a default placeholder for smaller devices if needed */
@media screen and (max-width: 767px) {
  table {
    font-size: 14px;
  }
}



/*
 * Display table content as cards on smaller devices
 * Using "table.table" hopefully targets the actual data tables that are
 * encapsulated within an entity which is constructed out of two or more
 * tables
 */

@media screen and (max-width: 767px) {

  table.table {
    font-size: 16px;
  }

  table.table tbody {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    min-width: 300px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Hide the table header row as it doesn't make sense in a card presentation */
  table.table thead {
    display: none;
  }

  table.table tr {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #ebeef0 !important;
    border: 1px solid #ebeef0;
    border-radius: 10px;
    padding: .5rem 0;
  }

  table.table td {
    border: 0px;
    padding: .05rem .75rem !important;
    box-shadow: inherit;
    background-color: initial;
  }

  table.table td::before {
    font-weight: bold;
    color: #365269;
  }

  table.table td > a {
    font-size: larger !important;
    text-decoration: underline;
  }

  table.table td > a:hover,
  table.table td > a:focus {
    background-color: #101920;
    color: #ffffff !important;
    text-decoration: underline;
  }

  /* Add pseudo labels given there's no table header on mobile display */
  td[data-attribute="cuk_eventtype"]::before         {content: "Event type: ";}
  td[data-attribute="cuk_location"]::before          {content: "Location: ";}
  td[data-attribute="cuk_organisation"]::before      {content: "Organisation: ";}
  td[data-attribute="cuk_eventdate"]::before         {content: "Date: ";}
  td[data-attribute="cuk_eventtime"]::before         {content: "Time: ";}
  td[data-attribute="cuk_eventstarttime"]::before    {content: "Time: ";}
  /*
  td[data-attribute="cuk_remainingcapcity"]::before  {content: "Remaining capacity: ";}
  */

  /* Hide the Remaining Capacity field if it is empty */
    td[data-attribute="cuk_remainingcapcity"]:empty {
    display: none;
  }
}


/*
 * Submit your data return > Add participants
 * More bespoke layout work
 */

.bbr-table-form table[data-name="DP/Event/Participants/Add_section_3"].section {
  margin: 0;
}

 


/* Testing new "bbr-table-form" class for layouts */
.bbr-table-form fieldset:has(table) {
  background-color: #ebeef0;
  padding: 20px;
  border-radius: 10px;
}

.bbr-table-form fieldset:has(table) table {
  font-size: 16px;
}

.bbr-table-form fieldset:has(table) tr > td {
  padding: 0 0 10px 0 !important;
}

.bbr-table-form fieldset:has(table) label {
  font-size: 18px;
  margin: 0 0 5px 0;
}

.bbr-table-form fieldset:has(table) h3 {
  font-size: 22px;
  margin: 0 0 5px 0;
}

.bbr-table-form fieldset:has(table) table .control:has(textarea) {
  display: flex;
  margin-bottom: 20px;
}

.bbr-table-form fieldset:has(table) .checkbox-cell label {
  color: #101920;
  font-size: 16px;
}