/* Category and subcategory pages. Keep the existing admin theme. */
.pc-taxonomy {
    --pc-purple: #9567be;
    --pc-ink: #293347;
    --pc-muted: #657187;
    --pc-line: #e7e9ef;
    color: var(--pc-ink);
    font-size: 15px;
    line-height: 1.6;
}

.pc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.pc-tabs > a {
    padding: 10px 18px;
    border: 1px solid var(--pc-line);
    border-radius: 8px;
    background: #fff;
    color: var(--pc-muted);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.pc-tabs > a.is-active {
    border-color: #dfcfee;
    background: #f1e9f8;
    color: #8053a7;
}

.pc-panel {
    min-width: 0;
    border: 1px solid var(--pc-line);
    border-radius: 12px;
    background: #fff;
}

.pc-panel-heading {
    padding: 24px;
    border-bottom: 1px solid var(--pc-line);
}

.pc-panel-heading h2 {
    margin: 0;
    color: var(--pc-ink);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.5;
}

.pc-panel-heading p {
    margin: 5px 0 0;
    color: var(--pc-muted);
    font-size: 14px;
}

.pc-list-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* Search and list */
.pc-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--pc-line);
}

.pc-filter-search {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}

.pc-filter-search > i {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--pc-muted);
}

.pc-taxonomy .pc-filter-search > .form-control {
    padding-left: 40px;
}

.pc-filter-select {
    flex: 0 1 180px;
    min-width: 130px;
}

.pc-filter-reset,
.pc-back-link,
.pc-child-link {
    color: #8255a8;
    text-decoration: none;
}

.pc-filter-reset {
    padding: 8px;
}

.pc-record {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--pc-line);
}

.pc-record:last-child {
    border-bottom: 0;
}

.pc-record-main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 16px;
}

.pc-thumb {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border: 1px solid #e9def2;
    border-radius: 9px;
    background: #f6f1fc;
    color: #a587bf;
    font-size: 25px;
    text-decoration: none;
}

.pc-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    object-fit: cover;
}

.pc-record-info {
    flex: 1;
    min-width: 0;
}

.pc-record-name {
    display: block;
    color: #374158;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.pc-record-name:hover {
    color: var(--pc-purple);
}

.pc-record-info > p {
    display: -webkit-box;
    overflow: hidden;
    margin: 4px 0 0;
    color: var(--pc-muted);
    font-size: 14px;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pc-child-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: 14px;
}

.pc-status {
    display: inline-flex;
    align-items: center;
    flex: none;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.pc-status::before {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.pc-status--active {
    background: #edf8f1;
    color: #377954;
}

.pc-status--inactive {
    background: #f0f1f5;
    color: #677185;
}

.pc-record-actions {
    display: flex;
    align-items: center;
    flex: none;
    gap: 8px;
}

.pc-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #e6dcee;
    border-radius: 7px;
    background: #fcfaff;
    color: #8255a8;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.pc-action-button:hover {
    background: #f2eaf9;
    color: #74469a;
}

.pc-action-button--danger {
    border-color: #f0dce2;
    background: #fffafb;
    color: #b34963;
}

.pc-action-button--danger:hover {
    background: #fff0f3;
    color: #a93953;
}

.pc-action-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pc-list-note {
    margin: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--pc-line);
    color: var(--pc-muted);
    font-size: 13px;
}

.pc-empty {
    padding: 48px 24px;
    text-align: center;
}

.pc-empty > i {
    display: block;
    margin-bottom: 12px;
    color: #a78abb;
    font-size: 36px;
}

.pc-empty h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.pc-empty p {
    color: var(--pc-muted);
}

.pc-pagination {
    padding: 20px 24px;
    border-top: 1px solid var(--pc-line);
}

.pc-pagination .pagination {
    flex-wrap: wrap;
    margin: 0;
}

/* Separate Add / Edit page */
.pc-form-page {
    max-width: 800px;
}

.pc-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.pc-taxonomy-form {
    display: grid;
    gap: 24px;
    padding: 24px;
}

.pc-field {
    min-width: 0;
}

.pc-taxonomy .form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #3c485f;
    font-size: 15px;
    font-weight: 500;
}

.pc-taxonomy .form-control,
.pc-taxonomy .form-select {
    min-height: 46px;
    padding: 11px 14px;
    border: 1px solid #dce0e9;
    border-radius: 8px;
    background-color: #fff;
    color: #344057;
    font-size: 15px;
    box-shadow: none;
}

.pc-taxonomy .form-select {
    padding-right: 36px;
}

.pc-taxonomy textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.pc-taxonomy .form-control:focus,
.pc-taxonomy .form-select:focus {
    border-color: #ac88cd;
    box-shadow: 0 0 0 3px #9d6cc913;
}

.pc-taxonomy .form-control.is-invalid,
.pc-taxonomy .form-select.is-invalid {
    border-color: #d3596e;
}

.pc-taxonomy .invalid-feedback,
.pc-upload-error {
    margin-top: 7px;
    color: #b93f58;
    font-size: 13px;
}

.pc-required {
    color: #c34860;
}

.pc-optional {
    margin-left: auto;
    color: var(--pc-muted);
    font-size: 13px;
    font-weight: 400;
}

.pc-help {
    display: block;
    margin-top: 8px;
    color: var(--pc-muted);
    font-size: 13px;
    line-height: 1.7;
}

.pc-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pc-taxonomy .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    white-space: normal;
}

.pc-taxonomy .btn-primary {
    border-color: #9d6cc9;
    background: #9d6cc9;
}

.pc-taxonomy .btn-primary:hover {
    border-color: #8d5bb9;
    background: #8d5bb9;
}

.pc-taxonomy .btn-light {
    border-color: #e8e5ee;
    background: #f6f5f9;
    color: #566176;
}

.pc-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--pc-line);
}

.pc-parent-notice {
    padding: 18px 24px;
    background: #fff9ef;
    color: #8f6e37;
}

.pc-parent-notice a {
    display: block;
    margin-top: 8px;
    color: #8255a8;
}

/* Optional image upload */
.pc-image-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px dashed #dcd5e5;
    border-radius: 9px;
    background: #fcfaff;
}

.pc-image-preview {
    position: relative;
    display: grid;
    place-items: center;
    flex: none;
    width: 76px;
    height: 76px;
    overflow: hidden;
    border: 1px solid #e9e0f0;
    border-radius: 8px;
    background: #f3edf9;
    color: #ab91c0;
    font-size: 28px;
}

.pc-image-preview img {
    width: 100%;
    height: 100%;
    background: #fff;
    object-fit: contain;
}

.pc-image-controls {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
}

.pc-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.pc-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #ded3e9;
    border-radius: 6px;
    background: #fff;
    color: #8053a7;
    font-size: 14px;
    cursor: pointer;
}

.pc-file-input:focus-visible + label {
    outline: 3px solid #ac88cd66;
    outline-offset: 2px;
}

.pc-image-filename {
    width: 100%;
    max-width: 300px;
    overflow: hidden;
    color: var(--pc-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-image-clear {
    padding: 0;
    border: 0;
    background: none;
    color: #b34963;
    font-size: 13px;
    cursor: pointer;
}

.pc-remove-image-check {
    margin-top: 12px;
}

.pc-remove-image-check label {
    color: var(--pc-muted);
    font-size: 14px;
    cursor: pointer;
}

/* Details page */
.pc-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.pc-detail-panel {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 28px;
    padding: 28px;
}

.pc-detail-panel--plain {
    grid-template-columns: minmax(0, 1fr);
}

.pc-detail-image {
    position: relative;
    display: grid;
    place-items: center;
    align-self: start;
    min-height: 220px;
    overflow: hidden;
    border-radius: 10px;
    background: #f4eef9;
    color: #b69ccb;
    font-size: 64px;
}

.pc-detail-image img {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #fff;
    object-fit: contain;
}

.pc-detail-content h2 {
    font-size: 24px;
    overflow-wrap: anywhere;
}

.pc-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--pc-muted);
    font-size: 13px;
}

.pc-description {
    margin: 18px 0;
    color: var(--pc-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pc-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 24px 0 0;
}

.pc-detail-meta dt {
    margin-bottom: 5px;
    color: var(--pc-muted);
    font-size: 14px;
    font-weight: 400;
}

.pc-detail-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.pc-detail-meta a {
    color: #8255a8;
    text-decoration: none;
}

.pc-record-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    color: var(--pc-muted);
    font-size: 14px;
}

.pc-taxonomy [hidden] {
    display: none !important;
}

.pc-taxonomy a:focus-visible,
.pc-taxonomy button:focus-visible {
    outline: 3px solid #ac88cd70;
    outline-offset: 2px;
}

/* Mobile */
@media (max-width: 767.98px) {
    .pc-record {
        flex-wrap: wrap;
        gap: 14px;
    }

    .pc-record-main {
        flex-basis: 100%;
    }

    .pc-record-actions {
        margin-left: auto;
    }

    .pc-detail-panel {
        grid-template-columns: 1fr;
    }

    .pc-detail-image {
        min-height: 180px;
    }
}

@media (max-width: 575.98px) {
    .pc-panel-heading,
    .pc-taxonomy-form,
    .pc-record,
    .pc-filter-form,
    .pc-detail-panel {
        padding: 18px;
    }

    .pc-tabs > a {
        flex: 1;
        padding: 10px;
        text-align: center;
        font-size: 14px;
    }

    .pc-filter-search {
        flex-basis: 100%;
    }

    .pc-filter-select {
        flex: 1;
        min-width: 0;
    }

    .pc-taxonomy .form-control,
    .pc-taxonomy .form-select {
        font-size: 16px;
    }

    .pc-fields-row,
    .pc-detail-meta {
        grid-template-columns: 1fr;
    }

    .pc-record {
        gap: 12px;
    }

    .pc-record-main {
        gap: 12px;
    }

    .pc-action-button {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .pc-status {
        padding: 5px 8px;
        font-size: 12px;
    }

    .pc-image-upload {
        gap: 12px;
        padding: 12px;
    }

    .pc-image-filename {
        max-width: 170px;
    }

    .pc-list-note,
    .pc-pagination {
        padding: 16px 18px;
    }
}
