:root {
  --dynamicpages-primary-color: #68bcf3;
}

body.template-dynamic-view.can_edit {
  &:not(.preview-mode):not(:has(.modal.show .dynamic-row)) {
    /* Apply only out of the modal */
    & > main > .dynamic-row,
    #dynamic_pages_content > .dynamic-row {
      background-color: #f5f5f5;
      padding: 1rem;
      margin: 1rem 0;
      border-radius: 5px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      &:hover {
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        background-color: #e5e5e5;
      }
      &.state-private {
        .content {
          opacity: 0.3;
        }
      }
    }
  }
  .admin-bar-container {
    z-index: 1050;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;

    * {
      pointer-events: auto;
    }
  }

  #adminBarToggle {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 6px 20px;
    background-color: #2d3748;
    border: 1px solid #2d3748;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    position: relative;
    z-index: 1051;

    svg {
      transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    &:hover {
      background-color: #1a202c;
      transform: translateY(-2px);
    }
  }

  .admin-bar-container.expanded #adminBarToggle {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    background-color: #2d3748;
    color: white;
    border: 1px solid #2d3748;
    transform: translateY(0);

    svg {
      transform: none; /* No rotation for X icon */
    }

    &:hover {
      background-color: #1a202c;
      transform: translateY(-2px);
    }
  }

  .rows-mangement {
    background-color: #f5f5f5;
    padding: 1.5rem 2rem;
    margin: 0 !important;
    border-radius: 16px 16px 0 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1), 0 -8px 10px -6px rgba(0, 0, 0, 0.1);
    width: auto;
    max-width: 95%;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    background-color: rgba(245, 245, 245, 0.95);
  }
  .edit-options {
    display: flex;
    opacity: 1;
    transition:
      opacity 0.3s ease,
      visibility 0.3s;
  }

  &.preview-mode .edit-options {
    display: none !important;
    position: absolute;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    height: 0;
    overflow: hidden;
  }
  /* Plone icons css*/
  .plone-icon {
    height: 1em;
    width: auto;
  }

  .icon-inline {
    vertical-align: middle;
    bottom: -0.125em;
    position: relative;
  }

  .icon-x15 {
    height: 1.5em;
    width: auto;
  }

  .icon-x2 {
    height: 2em;
    width: auto;
  }

  .icon-x3 {
    height: 3em;
    width: auto;
  }

  .icon-x4 {
    height: 4em;
    width: auto;
  }

  .icon-x5 {
    height: 5em;
    width: auto;
  }

  /* Style for the reorder handle */
  .drag-handle {
    cursor: grab;
    color: #aaa;
    margin-right: 10px;
  }

  .drag-handle:hover {
    color: #333;
  }

  /* classes of sortable.js to reorder rows */
  .sortable-ghost {
    opacity: 0 !important;
    background-color: #c8ebfb !important;
    border: 2px dashed var(--dynamicpages-primary-color);
  }

  .sortable-chosen,
  .sortable-drag {
    opacity: 1 !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  }

  .add-row-plus-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    margin: 0 !important;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;

    &::before {
      content: "";
      position: absolute;
      top: 50%;
      left: 10%;
      right: 10%;
      height: 1px;
      background: linear-gradient(
        to right,
        transparent,
        var(--dynamicpages-primary-color),
        transparent
      );
      z-index: -1;
      opacity: 0.2;
      transition: all 0.3s ease;
    }

    &:hover {
      &::before {
        opacity: 0.5;
        left: 5%;
        right: 5%;
      }
    }

    .add-row-plus-btn {
      width: 28px;
      height: 28px;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: white;
      border: 1px solid var(--dynamicpages-primary-color);
      color: var(--dynamicpages-primary-color);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

      svg {
        width: 14px;
        height: 14px;
        transition: transform 0.2s ease;
      }

      &:hover {
        background-color: var(--dynamicpages-primary-color);
        color: white;
        transform: scale(1.1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

        svg {
          transform: rotate(90.01deg);
        }
      }

      &:active {
        transform: scale(0.95);
      }
    }
  }

  /* Remove Bootstrap's default configuration not to break centering */
  .add-row-plus-btn.btn {
    line-height: 1;
  }
}

.no-underline {
  text-decoration: none;
}

.offcanvas-body {
  .available-view {
    &:hover {
      background-color: var(--dynamicpages-primary-color) !important;
      a {
        color: white !important;
      }
    }
  }
}

.dynamic-row .dropdown-menu {
  z-index: 1030; /* Ensure dropdown is above other elements */
}
