/**
 * Admin Styles CSS
 *
 * @package PublishPress\Capabilities
 * @since 2.30.0
 */

/* Main wrapper styling */
.pp-capability-menus {
    overflow: initial;
}

.admin-styles #pp-capability-menus-general {
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    background: #fff;
}

/* Form table styling */
.admin-styles .pp-capability-menus-select {
    margin: 0;
    border: none;
    box-shadow: none;
}

.admin-styles .add-new-button-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.admin-styles .custom-style-template-label {
    font-weight: 600;
}

.admin-styles .custom-style-template-select {
    width: 100%;
    max-width: 280px;
}

.admin-styles .pp-capability-menus-select th.menu-column {
    width: 250px;
    padding: 20px 10px;
    font-weight: 600;
}

.admin-styles .pp-capability-menus-select td.menu-column {
    vertical-align: top;
    padding: 20px 10px;
}

.admin-styles .pp-capability-menus-select td.restrict-column {
    vertical-align: middle;
    padding: 20px 10px;
}

.admin-styles .pp-capability-menus-select textarea.large-text,
.admin-styles .pp-capability-menus-select input.regular-text {
    width: 100%;
    max-width: 400px;
}

/* WordPress-style Color Scheme Swatches */
.ppc-admin-color-schemes .color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 10px 0;
}

.ppc-admin-color-schemes .color-option {
    position: relative;
    width: 180px;
    border: 2px solid #dcdcde;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.ppc-admin-color-schemes .color-option:hover {
    border-color: #8c8f94;
}

.ppc-admin-color-schemes .color-option.selected {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1, 0 0 0 4px rgba(34, 113, 177, 0.1);
}

.ppc-admin-color-schemes .color-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ppc-admin-color-schemes .color-option label,
.color-row .color-label label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1d2327;
    cursor: pointer;
    position: relative;
    padding-right: 24px;
}

.custom-scheme-edit-icon {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #8c8f94;
    cursor: pointer;
    transition: color 0.2s ease;
}

.custom-scheme-edit-icon:hover {
    color: #2271b1;
}

.custom-scheme-edit-icon .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.color-palette {
    display: flex;
    height: 24px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #dcdcde;
}

.color-palette-shade {
    flex: 1;
    height: 100%;
}

/* Custom Scheme Editor */
.custom-scheme-editor {
    margin-top: 20px;
    padding: 20px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.custom-scheme-editor h4 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1d2327;
    font-size: 14px;
    font-weight: 600;
}

.custom-scheme-editor h4 .dashicons {
    color: #2271b1;
}

.custom-scheme-colors {
    width: 100%;
    border-collapse: collapse;
}

.custom-scheme-colors td {
    padding: 10px 0;
    vertical-align: top;
}

.custom-scheme-colors td:first-child {
    width: 200px;
}

.custom-scheme-colors strong {
    display: block;
    margin-bottom: 5px;
    color: #1d2327;
}

.custom-scheme-color {
    width: 100px !important;
}

.custom-scheme-preview-area {
    margin-top: 20px;
    padding: 15px;
    background: var(--ppc-custom-background, #f0f0f1);
    border-radius: 4px;
    border: 1px solid #dcdcde;
    transition: all 0.3s ease;
}

.custom-scheme-preview-area > div:first-child {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.custom-scheme-preview-area > div:first-child > div {
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

/* Image upload styling */
.pp-capabilities-image-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pp-capabilities-image-url {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

/* Color picker */
.pp-capabilities-color-picker {
    width: 100px;
}

.wp-picker-container .wp-color-result.button .wp-color-result-text {
   border-left: none !important;
}

.wp-picker-container {
    position: relative !important;
    display: inline-block !important;
}

.wp-picker-container.wp-picker-active .wp-picker-holder,
.wp-picker-container.wp-picker-active .wp-picker-holder .iris-picker {
    display: block !important;
}

.wp-picker-container .wp-picker-holder {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 10000 !important;
    margin-top: 5px !important;
}

.wp-picker-container * {
    pointer-events: auto;
}

/* Checkbox styling */
.admin-styles .pp-capability-menus-select fieldset {
    margin: 0;
    padding: 0;
    border: none;
}

.admin-styles .pp-capability-menus-select fieldset label {
    margin-bottom: 8px;
    line-height: 1.4;
}

.admin-styles .pp-capability-menus-select fieldset input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 1px;
    vertical-align: top;
}

/* Helper text */
.cme-subtext {
    color: #646970;
    font-size: 12px;
    margin-top: 5px;
    font-style: normal;
    line-height: 1.4;
}

/* Loading indicator */
.publishpress-caps-manage img.loading {
    vertical-align: middle;
    margin-left: 5px;
}

/* Form submit overlay */
.ppc-form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 9999;
}

.ppc-form-overlay.is-active {
    display: flex;
}

.ppc-form-overlay .spinner {
    float: none;
    margin: 0;
}

.ppc-form-overlay-text {
    font-weight: 600;
    color: #1d2327;
}

.ppc-admin-color-schemes .wp-color-result {
    margin: 0 !important;
}

.ppc-admin-color-schemes .wp-picker-input-wrap {
    display: inline-block;
}

#pp-capability-menu-wrapper .pp-capability-menus-select {
    visibility: visible !important;
    display: table !important;
}

.color-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: 2px solid #8c8f94;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.color-checkbox.checked {
    border-color: #2271b1;
    background: #2271b1;
}

.color-checkbox .dashicons {
    color: #fff;
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin: 0;
    display: none;
}

.color-checkbox.checked .dashicons {
    display: block;
}

.ppc-admin-color-schemes .color-option label {
    padding-right: 35px;
}

.ppc-custom-scheme .custom-scheme-edit-icon {
    right: 35px;
}

/* Custom Style Form Tabs */
#custom-style-form td.custom-form-td  {
    background: #f6f7f7;
    border-top: 1px solid #c3c4c7;
    border-bottom: 1px solid #c3c4c7;
    padding: 20px 10px !important;
}

#custom-style-form.promo-form .form-promo-blur {
    filter: blur(1.5px);
}

.custom-style-tabs {
    border-radius: 4px;
    overflow: visible !important;
}

.custom-style-tab-content table,
.ppc-scheme-tab-content table {
    width: 100%;
}

.button-link-delete {
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    cursor: pointer !important;
    color: #d63638 !important;
    text-decoration: none !important;
    transition-property: border, background, color !important;
    transition-duration: .05s !important;
    transition-timing-function: ease-in-out !important;
}

.admin-styles .ppc-button-delete {
    border-color: #d63638 !important;
    color: #d63638 !important;
}

.admin-styles .ppc-button-delete:hover,
.admin-styles .ppc-button-delete:focus {
    border-color: #b32d2e;
    color: #b32d2e;
}

.custom-style-tab-content table tbody,
.ppc-scheme-tab-content table tbody {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: flex-start;
    margin-top: 8px;
}

.custom-style-tab-content table tbody tr,
.ppc-scheme-tab-content table tbody tr {
    border: 2px solid #dcdcde;
    padding: 3px;
    background: #fff;
    min-height: 170px;
    min-width: 235px;
    border-radius: 4px;
}

.custom-style-tab-content table tbody tr td,
.ppc-scheme-tab-content table tbody tr td {
    display: block;
    padding: 6px 0;
    width: 100%;
}

.custom-style-tab-content strong,
.ppc-scheme-tab-content strong {
    display: block;
    margin-bottom: 5px;
    color: #1d2327;
    font-weight: 600;
}

.ppc-advanced-rules-wrap {
    padding: 8px 0;
}

.ppc-advanced-rules-help {
    margin: 0 0 12px;
}

.ppc-advanced-rules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.ppc-advanced-rule-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(130px, 160px) minmax(140px, 180px) auto;
    gap: 12px;
    align-items: end;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 10px;
}

.ppc-advanced-rule-selector,
.ppc-advanced-rule-color {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ppc-advanced-rule-selector input {
    width: 100%;
}

.ppc-advanced-variation {
    width: 100%;
}

.ppc-advanced-rule-actions {
    padding-bottom: 6px;
}



/* Tabs Styling */

.tab-content-wrapper {
    background: #fff;
}

/* Custom style form error message */
#custom-style-error.editor-error {
    display: none;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #d63638;
    border-left-width: 4px;
    background: #fff5f5;
    color: #d63638;
    font-weight: 600;
}

/* Editor actions buttons */
.editor-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

/* Responsive css */
@media screen and (max-width: 782px) {
    .admin-styles .pp-capability-menus-select th.menu-column,
    .admin-styles .pp-capability-menus-select td.menu-column,
    .admin-styles .pp-capability-menus-select td.restrict-column {
        display: block;
        width: 100%;
        padding: 10px 0;
    }

    .admin-styles .pp-capability-menus-select th.menu-column {
        padding-bottom: 5px;
    }

    .pp-capabilities-image-upload {
        flex-direction: column;
        align-items: flex-start;
    }

    .pp-capabilities-image-url {
        width: 100%;
        max-width: none;
        margin-bottom: 10px;
    }

    .admin-styles .pp-capability-menus-select textarea.large-text,
    .admin-styles .pp-capability-menus-select input.regular-text {
        width: 100%;
        max-width: none;
    }

    .ppc-admin-color-schemes .color-options {
        gap: 10px;
    }

    .ppc-admin-color-schemes .color-option {
        width: calc(50% - 10px);
        min-width: 140px;
    }

    .custom-scheme-colors td:first-child {
        width: 150px;
    }

    .custom-scheme-preview-area > div:first-child {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-scheme-preview-area > div:first-child > div {
        width: 100%;
    }

    .ppc-advanced-rule-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .ppc-advanced-rule-actions {
        padding-bottom: 0;
    }
}

@media screen and (max-width: 480px) {
    .ppc-admin-color-schemes .color-option {
        width: 100%;
    }
}