#unadorned-announcement-bar-settings {
  max-width: 800px;

  h1 {
    padding-block: 8px;
  }

  .components-base-control:has(textarea) {
    flex-basis: 400px;
  }

  .components-notice {

    &,
    &__content {
      margin: 0;
    }
  }

  .components-notice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-block-end: 16px;
  }

  .components-panel {
    margin-block-end: 8px;
  }
}

.dlift-app {
  max-width: 1200px;
  padding: 20px;
  height: calc(100vh - 32px); // Account for WP admin bar
  overflow-y: auto;
  position: relative;

  .dlift-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #ddd;

    h1 {
      margin: 0;
      padding: 0;
      font-size: 23px;
      font-weight: 400;
      line-height: 1.3;
    }

    .dlift-header-actions {
      display: flex;
      gap: 8px;
    }
  }

  .dlift-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    justify-content: center;

    .components-spinner {
      margin: 0;
    }
  }

  .dlift-error {
    padding: 20px;
    border-left: 4px solid #cc1818;
    background-color: #f8dcdc;
    margin-bottom: 20px;

    h2 {
      color: #cc1818;
      margin-top: 0;
    }
  }

  .dlift-debug {
    background: #f0f0f1;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;

    h3 {
      margin-top: 0;
    }

    pre {
      background: #fff;
      padding: 10px;
      overflow: auto;
      max-height: 300px;
      margin: 0;
    }
  }

  .dlift-rules-list {
    h3 {
      margin-top: 0;
    }

    ul {
      margin: 0;
      padding: 0;
      list-style: none;

      li {
        background: #fff;
        padding: 15px;
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;

        &:last-child {
          margin-bottom: 0;
        }
      }
    }
  }

  .components-panel {
    border: 1px solid #ddd;
    background: #fff;
  }
}

// WordPress Admin Table Styles
.wp-list-table {
  .column-cb {
    width: 2.2em;
    padding: 8px 10px;
  }

  .check-column {
    width: 2.2em;
    padding: 8px 10px;
  }

  .column-title {
    width: 30%;
  }

  .row-actions {
    color: #666;
    visibility: hidden;
    font-size: 13px;

    span {
      padding: 0 4px;

      &:first-child {
        padding-left: 0;
      }

      &.trash a {
        color: #b32d2e;
      }
    }
  }

  tr:hover .row-actions {
    visibility: visible;
  }

  .components-toggle-control {
    margin: 0;

    .components-base-control__field {
      margin: 0;
    }

    .components-form-toggle {
      margin-right: 0;
    }
  }

  .column-actions {
    width: 160px;
    text-align: right;
  }

  .toggle-status {
    margin: 0;
  }
}

// Table Navigation
.tablenav {
  height: auto;
  margin: 6px 0 4px;
  padding-top: 5px;
  padding-bottom: 5px;
  clear: both;

  &.top {
    margin-top: 16px;
  }

  .alignleft {
    float: left;
  }

  .tablenav-pages {
    float: right;
    margin: 0 0 9px;

    .components-search-control {
      width: 280px;

      input[type="search"] {
        margin: 0;
        padding: 0 8px;
        min-height: 30px;
        line-height: normal;
        font-size: 14px;
      }
    }
  }

  .actions {
    padding: 0 8px 0 0;

    .components-select-control {
      min-width: 120px;
      max-width: 200px;
      display: inline-block;
      margin-right: 8px;

      select {
        height: 30px;
        margin: 0;
      }
    }

    .button {
      margin-right: 8px;
    }
  }
}

// Header Area
.wp-heading-inline {
  display: inline-block;
  margin: 0;
  padding: 9px 0 4px 0;
  font-size: 23px;
  font-weight: 400;
  line-height: 1.3;
}

.page-title-action {
  margin-left: 4px;
  padding: 4px 8px;
  position: relative;
  top: -3px;
  text-decoration: none;
  border: 1px solid #2271b1;
  border-radius: 2px;
  background: #f6f7f7;
  text-shadow: none;
  font-weight: 600;
  font-size: 13px;
  line-height: normal;
  color: #2271b1;
  cursor: pointer;
  outline: 2px solid transparent;

  &:hover {
    background: #f0f0f1;
    border-color: #0a4b78;
    color: #0a4b78;
  }
}

// Notice
.notice {
  background: #fff;
  border: 1px solid #c3c4c7;
  border-left-width: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  margin: 5px 15px 2px;
  padding: 1px 12px;

  p {
    margin: 0.5em 0;
    padding: 2px;
  }

  &.notice-error {
    border-left-color: #d63638;
  }
}

// Buttons
.button {
  &.action {
    vertical-align: middlifte;
  }
}

.dlift-rule-editor-modal {
  min-width: 500px !important;

  .components-modal__content {
    padding: 24px;
    margin-top: 0;

    .components-modal__header {
      margin: -24px -24px 24px;
    }
  }

  .dlift-rule-editor {
    .components-base-control {
      width: 100%;
      margin-bottom: 24px;

      &:last-child {
        margin-bottom: 0;
      }

      .components-base-control__label {
        display: block;
        margin-bottom: 8px;
      }

      .components-text-control__input,
      .components-select-control__input {
        width: 100%;
        max-width: none;
      }

      input[type="number"] {
        width: 100%;
        max-width: none;
      }
    }
  }

  .dlift-rule-editor-actions {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  .notice {
    margin: -8px 0 16px;
  }
}

.dlift-modal-overlay {
  background-color: rgba(0, 0, 0, 0.7);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 160000;
}

.dlift-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  min-width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 160001;
  border-radius: 2px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);

  .components-modal__header {
    height: 60px;
    border-bottom: 1px solid #ddd;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .components-button {
      padding: 8px;
    }
  }

  .components-base-control {
    margin-bottom: 24px;

    &:last-child {
      margin-bottom: 0;
    }

    .components-base-control__label {
      display: block;
      margin-bottom: 8px;
    }

    .components-text-control__input,
    .components-select-control__input {
      width: 100%;
    }
  }
}

.dlift-modal {
  .components-modal__content {
    margin-top: 0;
    padding: 0;
  }

  .components-modal__header {
    margin: 0;
    padding: 16px;
    border-bottom: 1px solid #ddd;
  }

  .dlift-rule-editor {
    padding: 24px;

    .components-base-control {
      margin-bottom: 24px;

      &:last-child {
        margin-bottom: 0;
      }

      .components-base-control__label {
        display: block;
        margin-bottom: 8px;
      }

      .components-text-control__input,
      .components-select-control__input {
        width: 100%;
      }
    }

    .dlift-rule-editor-actions {
      margin-top: 32px;
      padding-top: 16px;
      border-top: 1px solid #ddd;
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }
  }
}

// Ensure modal overlay is above WP admin menu
.components-modal__screen-overlay {
  z-index: 160000;
}

// Rule Form Styles
.dlift-rule-form {
  height: calc(100vh - 100px); // Account for header and padding
  overflow-y: auto;
  position: relative;

  .components-panel {
    background: #fff;
    border: 1px solid #e2e4e7;
    margin-bottom: 20px;
    position: relative;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .components-panel__body {
    padding: 16px;

    .components-base-control {
      margin-bottom: 24px;

      &:last-child {
        margin-bottom: 0;
      }

      .components-base-control__label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
      }

      .components-base-control__help {
        margin-top: 4px;
        color: #757575;
        font-style: italic;
      }

      .components-text-control__input,
      .components-select-control__input {
        width: 100%;
        max-width: none;
      }

      input[type="number"] {
        width: 100%;
        max-width: none;
      }
    }
  }

  .dlift-date-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;

    .dlift-date-control {
      label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
      }

      .components-datetime__date {
        border: 1px solid #757575;
        border-radius: 2px;
      }
    }
  }
}

// Table Styles
.wp-list-table {
  .column-actions {
    width: 160px;
    text-align: right;
  }

  .toggle-status {
    margin: 0;
  }

  .components-toggle-control {
    margin: 0;

    .components-base-control__field {
      margin: 0;
    }

    .components-form-toggle {
      margin-right: 0;
    }
  }
}

.dlift-message-styles {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #ddd;

  h3 {
    margin: 0 0 16px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
  }

  .components-range-control {
    margin-bottom: 16px;
  }

  .dlift-color-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 24px;

    .dlift-color-control {
      label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
      }

      .components-color-picker {
        margin-bottom: 16px;
      }
    }
  }
}

.dlift-message-preview {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #ddd;

  h3 {
    margin: 0 0 16px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
  }

  .dlift-preview-box {
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 16px;
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.4;
  }
}

// Fix scrolling in tab panels
.chakra-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;

  .chakra-tabs__tablist {
    flex-shrink: 0;
  }

  .chakra-tabs__tab-panels {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .chakra-tabs__tab-panel {
    height: 100%;
    overflow-y: auto;
  }
}

// Fix table scrolling
.wp-list-table-wrapper {
  overflow-x: auto;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}