/* ==========================================================
   WEBSITE PUBLISHER - ADMIN / INLINE EDITING
   Relies on the CSS variables defined in prr-public.css (:root)
   ========================================================== */

.wp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 12, 14, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
}

.wp-modal-overlay[hidden] {
    display: none;
}

.wp-modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 360px;
    padding: 28px;
}

.wp-modal h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    color: var(--text);
}

.wp-modal-subtitle {
    margin: 0 0 18px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.4;
}

.wp-modal label {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 6px;
}

.wp-modal input[type="password"],
.wp-modal input[type="text"],
.wp-modal input[type="number"],
.wp-modal input[type="file"],
.wp-modal select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color var(--transition);
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

.wp-modal input[type="password"]:focus,
.wp-modal input[type="text"]:focus,
.wp-modal input[type="number"]:focus,
.wp-modal input[type="file"]:focus,
.wp-modal select:focus {
    outline: none;
    border-color: var(--primary);
}

.wp-deploy-modal {
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
}

.wp-import-modal {
    max-width: 760px;
    max-height: 85vh;
    overflow-y: auto;
}

.wp-import-modal label[for="wp-import-csv-file"] {
    display: block;
    margin-bottom: 6px;
}

.wp-import-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

.wp-import-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.wp-import-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.wp-import-row-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.wp-import-row-meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.wp-import-row-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px 14px;
}

.wp-import-row-fields label {
    display: block;
    font-size: 0.8rem;
    color: var(--text);
}

.wp-import-row-fields input {
    margin-top: 4px;
    margin-bottom: 0;
}

.wp-import-row-profile {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--muted);
}

.wp-import-row-profile summary {
    cursor: pointer;
}

.wp-import-row-profile p {
    margin: 6px 0 0;
    white-space: pre-wrap;
}

.wp-modal-error {
    color: #b3261e;
    font-size: 0.85rem;
    margin: -6px 0 14px;
}

.wp-modal-status {
    color: var(--muted);
    font-size: 0.85rem;
    margin: -6px 0 14px;
    line-height: 1.4;
}

.wp-modal-status.wp-status-warning {
    color: #b3261e;
}

.wp-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.wp-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity var(--transition), background var(--transition);
}

.wp-btn-primary {
    background: var(--primary);
    color: #fff;
}

.wp-btn-primary:hover {
    background: var(--primary-dark);
}

.wp-btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.wp-btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.wp-btn-ghost:hover {
    background: var(--background);
}

.wp-edit-badge {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9999;
    background: var(--primary-dark);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    font-size: 0.85rem;
}

.wp-edit-badge[hidden] {
    display: none;
}

.wp-edit-badge button {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background var(--transition);
}

.wp-edit-badge button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================
   INLINE EDITING
   ========================================================== */

.wp-editable {
    position: relative;
}

.wp-edit-pencil,
.wp-delete-btn {
    position: absolute;
    bottom: 10px;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: rgba(20, 12, 14, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity var(--transition), transform var(--transition), background var(--transition), border-color var(--transition);
    z-index: 20;
}

.wp-edit-pencil {
    right: 10px;
}

/* Display-order badge (faculty cards) — unlike the pencil/trash buttons,
   this stays visible for the whole time edit mode is on (not just on
   hover), so the admin can see every card's current position at a
   glance before deciding what to change it to. Hidden entirely for
   ordinary site visitors. */
.faculty-card-order {
    display: none;
}

body.wp-edit-mode .faculty-card-order {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    left: 10px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(20, 12, 14, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 20;
}

/* Several public card styles (why-card, course-card, vmv-card,
   contact-card, highlights, map-placeholder, ...) style their own
   decorative icon with a bare "i" descendant selector at 2.5-4rem. The
   pencil/delete badges are appended as direct children of those same
   card elements, so their icons get swept up by those rules too unless
   explicitly reset here — this always wins because a directly-targeted
   rule (even one with equal specificity) placed later in the cascade
   beats an inherited value, and admin.css loads after prr-public.css. */
.wp-edit-pencil i,
.wp-delete-btn i {
    font-size: 0.75rem;
    color: inherit;
    margin: 0;
}

body.wp-edit-mode .wp-editable:hover > .wp-edit-pencil,
body.wp-edit-mode .wp-editable:focus-within > .wp-edit-pencil {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.wp-edit-pencil:hover {
    background: var(--primary);
    border-color: var(--primary);
}

[data-field].wp-editing-field {
    outline: 2px dashed var(--secondary);
    outline-offset: 4px;
    border-radius: 4px;
    background: rgba(182, 139, 45, 0.08);
}

/* .timeline-item span (subtitle) is display:inline-block with no set
   width, so it shrink-wraps to a single line of its bold red public
   styling — fine for display, cramped for typing. Widen it to the full
   card and tone the font down while it's actually being edited. */
.timeline-item span[data-field].wp-editing-field {
    display: block;
    width: 100%;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
}

.wp-link-editor {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--background);
}

.wp-link-editor label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--muted);
    flex: 1 1 160px;
}

.wp-link-editor input {
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.wp-image-editor {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--background);
    font-size: 0.78rem;
    color: var(--muted);
}

.wp-image-editor input {
    font-size: 0.85rem;
}

.wp-save-bar {
    position: relative;
    z-index: 21;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.wp-save-status {
    margin-right: auto;
    font-size: 0.82rem;
    color: var(--muted);
}

.wp-save-bar .wp-btn {
    padding: 7px 16px;
    font-size: 0.85rem;
}

.wp-delete-btn {
    right: 46px;
}

/* Photo cards have no pencil button (nothing to inline-edit on a bare
   photo), so the trash button doesn't need to leave room for one. */
.photo-card > .wp-delete-btn {
    right: 10px;
}

body.wp-edit-mode .wp-editable:hover > .wp-delete-btn,
body.wp-edit-mode .wp-editable:focus-within > .wp-delete-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.wp-delete-btn:hover {
    background: #b3261e;
    border-color: #b3261e;
}

.wp-add-item {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: border-color var(--transition), color var(--transition);
}

body.wp-edit-mode .wp-add-item {
    display: flex;
}

.wp-add-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.wp-bulk-import-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

body.wp-edit-mode .wp-bulk-import-btn {
    display: inline-flex;
}

.wp-bulk-import-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.wp-add-form {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-top: 14px;
}

.wp-add-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--muted);
}

.wp-add-form input,
.wp-add-form textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.wp-submission-success {
    background: #e6f4ea;
    border: 1px solid #34a853;
    color: #1e7e34;
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    font-weight: 600;
}

.wp-submission-error {
    background: #fce8e6;
    border: 1px solid #b3261e;
    color: #b3261e;
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    font-weight: 600;
}

