/* This css file by default accept all built in context that could be use for customization of admin panel styles because he attached via wagtail_hooks.py file in global_admin_css() function. */

/* To customize the colors used in the admin user interface or define new one - set the desired variables within the :root selector. 
Color variables are reused across both the light and dark themes of the admin interface. 
To change the colors of a specific theme, use: .w-theme-light for the light theme, .w-theme-dark for the dark theme.*/
:root {
  /* Redefine main wagtail colors for admin view according projects primary colors */
  --w-color-primary: #B71E24;
  --w-color-primary-200: #2f2f2f;
  --w-color-secondary: #2f2f2f;
  --w-color-secondary-400: #B71E24;

  /* Define additional variables to adapt styles of custom Settings modal window to changes of Admin themes.*/
  --color-settings-button-icon-wrapper: #ffffff;
  --color-settings-button-icon-wrapper-hover: transparent;
  --color-dashboard-cards-wrapper: #f3f3f5;
  --color-dashboard-cards-fill: #ffffff;
}

.w-theme-light {
  --color-settings-button-icon-wrapper: #ffffff;
  --color-settings-button-icon-wrapper-hover: transparent;
  --color-dashboard-cards-wrapper: #f3f3f5;
  --color-dashboard-cards-fill: #ffffff;
}

.w-theme-dark {
  --color-settings-button-icon-wrapper: #262626;
  --color-settings-button-icon-wrapper-hover: rgba(246, 246, 248, 0.097);
  --color-dashboard-cards-wrapper: #1D1D1D;
  --color-dashboard-cards-fill: #222222;
}

/* Styles for "System default" theme based on user's preference */
@media (prefers-color-scheme: light) {
  .w-theme-system {
    --color-settings-button-icon-wrapper: #ffffff;
    --color-settings-button-icon-wrapper-hover: transparent;
    --color-dashboard-cards-wrapper: #f3f3f5;
    --color-dashboard-cards-fill: #ffffff;
  }
}

@media (prefers-color-scheme: dark) {
  .w-theme-system {
    --color-settings-button-icon-wrapper: #262626;
    --color-settings-button-icon-wrapper-hover: rgba(246, 246, 248, 0.097);
    --color-dashboard-cards-wrapper: #1D1D1D;
    --color-dashboard-cards-fill: #222222;
  }
}

/* Prevent any "blip" of the hidden element onto screen as Alpine loads for components that 
attached for custom block-forms templates in <script type="module" src="{% static 'js/bundle.min.js' %}"></script>. */
[x-cloak] { display: none !important; }

/* Reposition of Wagtail admin userbar icon (displayed in the bottom-right corner of the webpage for CMS manager). */
.w-userbar.w-userbar--bottom-right.w-theme-system.w-density-default {
  bottom: 63px;
}


/* Required styles to customize admin Home (welcome) page. */
/* Next three styles clean up admin Home page from fields we deny for this page. */
.custom_admin_home .w-panel-upgrade {
  display: none;
}

.custom_admin_home #recent-edits-section {
  display: none;
}

.custom_admin_home .w-summary {
  display: none;
}

/* Next styles required for Dashboard cards located on admin Home page. */
.dashboard {
  margin-top: 32px;
  padding: 32px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 0.1rem;
  row-gap: 0.1rem;
  overflow: hidden;
}

@media (max-width: 639px) {
  .dashboard {
    grid-template-columns: repeat(1, 1fr);
  }
}

.dashboard-card {
  position: relative;
  padding: 24px;
  height: 100%;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  background-color: var(--color-dashboard-cards-fill);
  cursor: pointer;
}

.dashboard-card:hover {
  border: 1px solid var(--w-color-primary);
}

/* Styles for dynamic markup of the edges and shadows of the cards when the number of cards odd or even. */
.dashboard-card:nth-child(even) {
  box-shadow: 7px 0px 12px 2px rgba(127, 127, 127, 0.2); /* regular right shadow */
}
.dashboard-card:nth-child(odd) {
  box-shadow: -7px 0px 12px 2px rgba(127, 127, 127, 0.2); /* regular left shadow */
}

.dashboard-card:first-child {
 border-top-left-radius: 8px;
 box-shadow: -7px -3px 12px 2px rgba(127, 127, 127, 0.2); /* left-top shadow */
}
.dashboard-card:nth-child(2) {
 border-top-right-radius: 8px;
 box-shadow: 7px -3px 12px 2px rgba(127, 127, 127, 0.2); /* right-top shadow */
}
.dashboard-card:nth-last-child(2) {
 border-bottom-left-radius: 8px; 
 box-shadow: -7px 3px 12px 2px rgba(127, 127, 127, 0.2); /* left-bottom shadow */
}
.dashboard-card:last-child {
 border-bottom-right-radius: 8px;
 box-shadow: 7px 3px 12px 2px rgba(127, 127, 127, 0.2); /* right-bottom shadow */
}

.dashboard_cards_short_odd_list:nth-child(2) {
  border-bottom-left-radius: 0; 
}
.dashboard_cards_short_odd_list:nth-last-child(2) {
  border-bottom-left-radius: 0; 
  box-shadow: 7px -3px 12px 2px rgba(127, 127, 127, 0.2); /* right-top shadow */
}
.dashboard_cards_short_odd_list:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 0;
  box-shadow: -7px 3px 12px 2px rgba(127, 127, 127, 0.2); /* left-bottom shadow */
}

.dashboard_cards_long_odd_list:nth-last-child(2) {
  border-bottom-left-radius: 0; 
  box-shadow: 7px 0px 12px 2px rgba(127, 127, 127, 0.2); /* regular right shadow */ 
}
.dashboard_cards_long_odd_list:last-child {
  border-bottom-left-radius: 0; 
  box-shadow: -7px 3px 12px 2px rgba(127, 127, 127, 0.2); /* left-bottom shadow */
}

/* Styles for dynamic markup of the edges and shadows of the cards on small screens. */
@media (max-width: 639px) {
  .dashboard-card:nth-child(even),
  .dashboard-card:nth-child(odd) {
    box-shadow: 7px 0px 12px 2px rgba(127, 127, 127, 0.2); /* regular right shadow */
  }
  .dashboard-card:first-child {
    border-top-right-radius: 8px;
    box-shadow: 7px -3px 12px 2px rgba(127, 127, 127, 0.2); /* right-top shadow */
   }
  .dashboard-card:nth-child(2) {
    border-top-right-radius: 0;
   }
   .dashboard-card:nth-last-child(2) {
    border-bottom-left-radius: 0;
   }
   .dashboard-card:last-child {
    border-bottom-left-radius: 8px;
    box-shadow: 7px 3px 12px 2px rgba(127, 127, 127, 0.2); /* right-bottom shadow */
   }
}

.dashboard-card__icon-wrapper {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.dashboard-card__icon {
  width: 30px;
  height: 30px;
  color: var(--w-color-primary);
}

.dashboard-card__link {
  outline: none;
  text-decoration: none;
}

.dashboard_card__touch-target {
  position: absolute;
  inset: 0;
}

.dashboard-card__title {
  color: var(--w-color-primary);
}

.dashboard-card__data-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
  justify-content: space-between;
  color: var(--w-color-text-meta);
}

/* Next styles required for Dashboard alerts lacated on admin Home page. */
.dashboard-alert_section {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dashboard-alert_container {
  padding: 16px;
  border-left: 4px solid rgb(250 204 21);
  background-color: rgb(254 252 232);
}

.dashboard-alert_wrapper {
  display: flex;
  align-items: center;
}

.dashboard-alert_icon-wrapper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.dashboard-alert_icon {
  
  width: 1.25rem;
  height: 1.25rem;
  color: rgb(250 204 21);
}

.dashboard-alert_data-wrapper {
  margin-left: 0.75rem;
  font-size: 1rem;
}

.dashboard-alert_text {
  margin-bottom: 2px;
  /* font-size: 0.875rem; */
  line-height: 1.25rem;
  color: rgb(161 98 7);
}

.dashboard-alert_link {
  font-weight: 500;
  color: rgb(161 98 7);
  text-underline-offset: 1px;
}

.dashboard-alert_link:hover {
  color: rgb(202 138 4);
}

/* Required styles to customize admin Sidebar logo. */
.sidebar_logo-icon {
  transition: transform 150ms ease-in-out;
}

.sidebar_logo-icon:hover {
  transform: scale(1.05);
}

/* Required style for filerobot widget field to make it width adaptive to limited space when useing filerobot image within components (e.g., Split Container or Alternating Content Section. */
.w-field--filerobot_widget {
  max-width: 95%;
}

/* Styles to enhance the working area of the page editor form. */
.w-form-width {
  max-width: 1280px;
}

.w-field__wrapper {
  max-width: 1280px;
}

/* Styles for OpeningHours settings admin view*/
.opening_hours > .w-field-row {
  width: fit-content;
}
#panel-help-section:not(:last-child) {
  margin-bottom: 0;
}
.custom_help_panel {
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 20px;
  padding-right: 20px;
  background-color: var(--w-color-info-50);
  font-size: 1rem;
  line-height: 1.5rem;
}
fieldset:has(.custom_help_panel) {
  padding-bottom: 0;
}
.custom-panel-help-content-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
}
.custom-icon-help {
  fill: var(--w-color-info-100);
  height: 16px;
  width: 16px;
}
.custom-panel-help-content {
  font-size: 14px;
}

/* Styles for Headline component admin view*/
.headline_container {
  display: flex;
  flex-direction: row;
  column-gap: 1rem;
}

.headline_container > [data-contentpath="size"] {
  flex-shrink: 0;
  width: 100%;
  max-width: 100px;
}

.headline_container > [data-contentpath="headline_text"] {
  flex-grow: 1;
}

.headline_container .w-field__comment-button {
  display: none;
}

/* Styles for AlternatingContentBlock component admin view*/
.alternating_content {
  display: grid;
  grid-template-rows: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .alternating_content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

.alternating_content .w-field__comment-button {
  display: none;
}

/* 
Styles for custom StructBlock form admin view.
Required to add custom Settings button.
*/
.custom-struct-block {
  position: relative;
}

.custom-struct-block .help {
  margin-bottom: 24px;
}

.custom-struct-block .settings-button-icon-placeholder {
  position: absolute;
  top: -35px;
  right: 130px;
  width: 48px;
  height: 32px;
  display: flex;
  justify-content: end;
  align-items: center;
  background-color: var(--color-settings-button-icon-wrapper);
}

.settings-button-icon-wrapper {
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--color-settings-button-icon-wrapper);
  color: var(--w-color-icon-secondary);
  border-radius: 9999px;
  cursor: pointer;
}

.settings-button-icon-wrapper:hover {
  background-color: var(--color-settings-button-icon-wrapper-hover);
  color: var(--w-color-icon-secondary-hover);
}

.settings-button-icon {
  background-color: transparent;
  fill: transparent;
}

.settings-button-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(1px);
}

.settings-button-modal-window {
  position: relative;
  height: auto;
  max-height: 679px;
  width: 60%;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem; 
  overflow-y: auto;
  /* Color selected among Wagtail's built in Custom user interface colors */
  background-color: var(--w-color-surface-page);
  z-index: 999;
}

.settings-button-modal-header {
  position: relative;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-weight: 700;
  font-size: medium;
  /* Color selected among Wagtail's built in Custom user interface colors */
  color: var(--w-color-text-label-menus-default);
  background-color: var(--w-color-surface-menus);
}

.settings-button-modal-footer {
  width: 100%;
  height: 100%;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-button-modal-notification {
  /* Color selected among Wagtail's built in Custom user interface colors */
  color: var(--w-color-text-label);
  font-weight: 700;
}

.settings-button-modal-cross {
  position: absolute;
  top: 0;
  bottom: 0px;
  right: 0;
  /* Color selected among Wagtail's built in Custom user interface colors */
  background-color: var(--w-color-surface-menus);
  transition: background-color 0.15s;
}

.settings-button-modal-cross:hover {
  /* Color selected among Wagtail's built in Custom user interface colors */
  background-color: var(--w-color-surface-tooltip);
}

.settings-button-modal-close {
  height: 40px;
  color: white;
  /* Color selected among Wagtail's built in Custom user interface colors */
  background-color: var(--w-color-surface-button-default);
  transition: background-color 0.15s;
}

.settings-button-modal-close:hover {
  /* Color selected among Wagtail's built in Custom user interface colors */
  background-color: var(--w-color-surface-button-hover);
}

.settings-button-modal-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.settings-button-modal-field > [data-field] {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 0.5rem;
}

.settings-button-modal-field .w-field__label {
  grid-column: span 4 / span 4;
}

.settings-button-modal-field .w-field__wrapper {
  grid-column: span 8 / span 8;
}

.settings-button-modal-field .help {
  margin: 0;
}

.settings-button-modal-field select {
  width: 100%;
}

.settings-button-modal-field .w-field__comment-button {
  display: none;
}

.split_container {
  display: grid;
  grid-template-rows: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .split_container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}
