/*!
 * Helderkruin Panels Manager — frontend styles
 *
 * Section 1: Action-panel card visuals (duplicated from the Elementor
 *            widget pack so this plugin works standalone with identical
 *            card rendering)
 * Section 2: Manager UI chrome — toolbar, card overlays, modal, form,
 *            icon picker, info-row repeater
 */

/* =========================================================================
   SECTION 1 — ACTION PANEL CARD VISUALS
   ========================================================================= */
.hkw-action-panels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}
.hkw-action-panels * { box-sizing: border-box; }

.hkw-action-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 36px 32px;
    border-radius: 24px;
    background: #FFFFFF;
    overflow: hidden;
    isolation: isolate;
    color: #15204D;
    min-height: 100%;
    box-shadow: 0 18px 40px -12px rgba(21, 32, 77, 0.12);
    transition: transform 0.28s ease-out, box-shadow 0.28s ease-out;
}
.hkw-action-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 26px 50px -14px rgba(21, 32, 77, 0.18);
}

.hkw-action-panel--featured {
    background: #E71615;
    color: #FFFFFF;
}
.hkw-action-panel--featured::before {
    content: "";
    position: absolute;
    top: -110px;
    right: -110px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 0;
}
.hkw-action-panel--featured > * { position: relative; z-index: 1; }

.hkw-action-panel__header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.hkw-action-panel__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #EEF2F8;
    color: #15204D;
    font-size: 18px;
    flex-shrink: 0;
}
.hkw-action-panel--featured .hkw-action-panel__icon {
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
}

.hkw-action-panel__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: #15204D;
    color: #FFFFFF;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.hkw-action-panel__title {
    margin: 0 0 14px 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    letter-spacing: 1.2px;
    line-height: 1.15;
    text-transform: uppercase;
    color: inherit;
    font-weight: 400;
}

.hkw-action-panel__desc {
    margin: 0 0 22px 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: #55627E;
}
.hkw-action-panel__desc p { margin: 0 0 10px 0; }
.hkw-action-panel__desc p:last-child { margin-bottom: 0; }
.hkw-action-panel__desc strong,
.hkw-action-panel__desc b {
    font-weight: 700;
    color: inherit;
}
.hkw-action-panel--featured .hkw-action-panel__desc {
    color: rgba(255, 255, 255, 0.92);
}

.hkw-action-panel__info-list {
    margin: 0 0 18px 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hkw-action-panel__info-item-wrap { display: block; }

.hkw-action-panel__info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 10px;
    border-radius: 14px;
    background: #F6F8FC;
    color: inherit;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    transition: background 0.18s ease, transform 0.18s ease;
}
a.hkw-action-panel__info-item:hover {
    background: #EDF1F9;
    transform: translateX(2px);
}
.hkw-action-panel--featured .hkw-action-panel__info-item {
    background: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
}
.hkw-action-panel--featured a.hkw-action-panel__info-item:hover {
    background: rgba(255, 255, 255, 0.22);
}

.hkw-action-panel__info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #FFFFFF;
    color: #E71615;
    flex-shrink: 0;
    font-size: 14px;
    box-shadow: 0 2px 6px -1px rgba(21, 32, 77, 0.1);
}
.hkw-action-panel__info-label {
    flex: 1;
    color: inherit;
    word-break: break-word;
}
.hkw-action-panel__spacer {
    flex: 1;
    min-height: 8px;
}

.hkw-action-panel__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 999px;
    background: #E71615;
    color: #FFFFFF;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    align-self: stretch;
    text-align: center;
}
.hkw-action-panel__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px -8px rgba(231, 22, 21, 0.5);
}
.hkw-action-panel--featured .hkw-action-panel__btn {
    background: #FFFFFF;
    color: #15204D;
}
.hkw-action-panel--featured .hkw-action-panel__btn:hover {
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.3);
}

.hkw-action-panel__footer {
    margin: 14px 0 0 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    font-style: italic;
    text-align: center;
    color: #55627E;
}
.hkw-action-panel--featured .hkw-action-panel__footer {
    color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 1024px) {
    .hkw-action-panels { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 640px) {
    .hkw-action-panels { grid-template-columns: 1fr !important; gap: 18px; }
    .hkw-action-panel { padding: 30px 24px; }
    .hkw-action-panel--featured::before { top: -80px; right: -80px; width: 220px; height: 220px; }
}

/* =========================================================================
   SECTION 2 — MANAGER CHROME
   All manager-only UI — only rendered when the current user is in the
   authorised users list.
   ========================================================================= */
.hkapm-wrapper {
    width: 100%;
    font-family: 'Montserrat', sans-serif;
    color: #15204D;
}

/* ---- Toolbar ---- */
.hkapm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: #15204D;
    color: #FFFFFF;
    border-radius: 16px;
    flex-wrap: wrap;
}
.hkapm-toolbar__title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.hkapm-toolbar__title i { font-size: 18px; opacity: 0.85; }
.hkapm-toolbar__actions {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---- Buttons ---- */
.hkapm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 1;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.hkapm-btn--small { padding: 8px 14px; font-size: 12px; }
.hkapm-btn--primary {
    background: #E71615;
    color: #FFFFFF;
}
.hkapm-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -8px rgba(231, 22, 21, 0.6);
}
.hkapm-btn--ghost {
    background: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
}
.hkapm-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.22);
}
.hkapm-wrapper .hkapm-modal .hkapm-btn--ghost {
    background: #EEF2F8;
    color: #15204D;
}
.hkapm-wrapper .hkapm-modal .hkapm-btn--ghost:hover {
    background: #DFE5EE;
}

/* ---- Empty state ---- */
.hkapm-empty {
    padding: 60px 20px;
    text-align: center;
    background: #F6F8FC;
    border-radius: 16px;
    border: 2px dashed #CED6E2;
    color: #55627E;
}
.hkapm-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.hkapm-empty p {
    margin: 0;
    font-size: 14px;
}

/* ---- Card controls overlay ---- */
.hkapm-wrapper--manage .hkw-action-panel {
    outline: 2px dashed transparent;
    outline-offset: 4px;
    transition: outline-color 0.2s ease, transform 0.28s ease-out, box-shadow 0.28s ease-out;
}
.hkapm-wrapper--manage .hkw-action-panel:hover {
    outline-color: rgba(21, 32, 77, 0.25);
}

.hkapm-card-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 999px;
    box-shadow: 0 6px 18px -6px rgba(21, 32, 77, 0.25);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.hkw-action-panel:hover .hkapm-card-controls,
.hkapm-card-controls:focus-within {
    opacity: 1;
    transform: translateY(0);
}

.hkapm-ctrl {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: #F6F8FC;
    color: #15204D;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.hkapm-ctrl:hover {
    background: #15204D;
    color: #FFFFFF;
    transform: scale(1.05);
}
.hkapm-ctrl--delete:hover {
    background: #E71615;
    color: #FFFFFF;
}

/* Draft state */
.hkapm-is-draft {
    opacity: 0.58;
    filter: saturate(0.75);
}
.hkapm-is-draft:hover {
    opacity: 0.85;
    filter: saturate(1);
}

.hkapm-draft-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    margin-bottom: 14px;
    background: #FFF3CD;
    color: #856404;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    align-self: flex-start;
}
.hkw-action-panel--featured .hkapm-draft-flag {
    background: rgba(255, 255, 255, 0.92);
}

/* =========================================================================
   MODAL
   ========================================================================= */
.hkapm-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Montserrat', sans-serif;
}
.hkapm-modal[hidden] { display: none; }

.hkapm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(21, 32, 77, 0.55);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

body.hkapm-modal-open { overflow: hidden; }

.hkapm-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 40px);
    background: #FFFFFF;
    border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: hkapm-modal-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes hkapm-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.hkapm-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #15204D;
    color: #FFFFFF;
}
.hkapm-modal__header h2 {
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 1px;
    font-weight: 400;
}
.hkapm-modal__close {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    color: #FFFFFF;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.15s;
}
.hkapm-modal__close:hover { background: rgba(255, 255, 255, 0.22); }

/* ---- Form body ---- */
.hkapm-form {
    overflow-y: auto;
    padding: 24px 28px 16px;
    flex: 1;
}
.hkapm-field {
    margin-bottom: 18px;
    border: none;
    padding: 0;
    min-width: 0;
}
.hkapm-field > legend,
.hkapm-field > label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #15204D;
}
.hkapm-field--group {
    padding: 16px 18px;
    border: 1px solid #E5E9F0;
    border-radius: 14px;
    background: #FAFBFD;
}
.hkapm-field--group > legend {
    padding: 0 8px;
    background: #FAFBFD;
    border-radius: 6px;
}
.hkapm-field--row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 560px) {
    .hkapm-field--row { grid-template-columns: 1fr; }
}

.hkapm-form input[type=text],
.hkapm-form input[type=url],
.hkapm-form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #DEE4EE;
    border-radius: 10px;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 14px;
    color: #15204D;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}
.hkapm-form input[type=text]:focus,
.hkapm-form input[type=url]:focus,
.hkapm-form textarea:focus {
    outline: none;
    border-color: #E71615;
    box-shadow: 0 0 0 3px rgba(231, 22, 21, 0.12);
}
.hkapm-form textarea {
    resize: vertical;
    min-height: 80px;
}

.hkapm-hint {
    margin: 6px 0 0 0;
    font-size: 12px;
    color: #7A8799;
    font-style: italic;
}

/* Radios */
.hkapm-radios {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.hkapm-radio {
    flex: 1;
    min-width: 160px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid #DEE4EE;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.hkapm-radio:has(input:checked) {
    border-color: #E71615;
    background: #FEF3F2;
}
.hkapm-radio input[type=radio] {
    margin: 0;
    accent-color: #E71615;
}

/* =========================================================================
   ICON PICKER
   ========================================================================= */
.hkapm-icon-picker {
    position: relative;
}
.hkapm-icon-picker__preview {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #DEE4EE;
    border-radius: 10px;
    background: #FFFFFF;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: #15204D;
    text-align: left;
    transition: border-color 0.15s;
}
.hkapm-icon-picker__preview:hover { border-color: #AEBBCF; }
.hkapm-icon-picker__preview.is-open {
    border-color: #E71615;
    box-shadow: 0 0 0 3px rgba(231, 22, 21, 0.12);
}
.hkapm-icon-picker__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #F0F3F9;
    color: #15204D;
    font-size: 14px;
    flex-shrink: 0;
}
.hkapm-icon-picker__label {
    flex: 1;
    color: #55627E;
}
.hkapm-icon-picker__chevron {
    font-size: 11px;
    color: #9AA6B8;
    margin-left: auto;
}

.hkapm-icon-picker__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 100;
    background: #FFFFFF;
    border: 1px solid #DEE4EE;
    border-radius: 14px;
    box-shadow: 0 20px 50px -15px rgba(21, 32, 77, 0.3);
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
}

.hkapm-icon-picker__search {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 8px;
    background: #FFFFFF;
    border: 1.5px solid #DEE4EE;
    border-radius: 8px;
    z-index: 1;
}
.hkapm-icon-picker__search i { color: #9AA6B8; font-size: 12px; }
.hkapm-icon-picker__search input {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    flex: 1;
    padding: 4px 0;
    background: transparent;
    color: #15204D;
}

.hkapm-icon-picker__none {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #F6F8FC;
    color: #55627E;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    margin-bottom: 10px;
    text-align: left;
}
.hkapm-icon-picker__none:hover { background: #EDF1F9; }

.hkapm-icon-picker__heading {
    grid-column: 1 / -1;
    padding: 10px 4px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #9AA6B8;
}
.hkapm-icon-picker__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
@media (max-width: 480px) {
    .hkapm-icon-picker__grid { grid-template-columns: repeat(4, 1fr); }
}

.hkapm-icon-picker__tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: #FFFFFF;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 9px;
    color: #55627E;
    text-align: center;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.hkapm-icon-picker__tile i {
    font-size: 18px;
    color: #15204D;
}
.hkapm-icon-picker__tile:hover {
    background: #FEF3F2;
    border-color: #FCC;
    transform: translateY(-1px);
}
.hkapm-icon-picker__tile:hover i { color: #E71615; }
.hkapm-icon-picker__tile span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
}

.hkapm-icon-picker__custom {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #EEF2F8;
}
.hkapm-icon-picker__custom label {
    display: block;
    font-size: 11px;
    color: #7A8799;
    margin-bottom: 6px;
}
.hkapm-icon-picker__custom input {
    width: calc(100% - 50px);
    padding: 6px 10px;
    border: 1px solid #DEE4EE;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    color: #15204D;
    margin-right: 6px;
    box-sizing: border-box;
}

/* =========================================================================
   INFO ROWS REPEATER
   ========================================================================= */
.hkapm-info-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}
.hkapm-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: #F6F8FC;
    border-radius: 12px;
}
.hkapm-info-row__icon {
    width: 140px;
    flex-shrink: 0;
}
.hkapm-info-row__icon .hkapm-icon-picker__preview {
    padding: 8px 10px;
    font-size: 12px;
}
.hkapm-info-row__icon .hkapm-icon-picker__icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
}
.hkapm-info-row__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.hkapm-info-row__body input { font-size: 13px !important; padding: 8px 12px !important; }
.hkapm-info-row__remove {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #9AA6B8;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.hkapm-info-row__remove:hover {
    background: #FEE;
    color: #E71615;
}

@media (max-width: 520px) {
    .hkapm-info-row { flex-wrap: wrap; }
    .hkapm-info-row__icon { width: 100%; }
}

/* =========================================================================
   MODAL FOOTER
   ========================================================================= */
.hkapm-modal__footer {
    padding: 14px 24px 20px;
    border-top: 1px solid #EEF2F8;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.hkapm-form-message {
    font-size: 12px;
    min-height: 18px;
    flex: 1;
}
.hkapm-form-message--error   { color: #E71615; font-weight: 600; }
.hkapm-form-message--success { color: #1A7F37; font-weight: 600; }
.hkapm-form-message--info    { color: #55627E; }

.hkapm-form-buttons {
    display: flex;
    gap: 10px;
}
