/* ==========================================================================
   Editing mode — styles for editable fields, edit bar, password modal
   ========================================================================== */

/* Editable fields (active only when body has .editing) */
body.editing .editable {
    outline: 2px dashed rgba(242, 227, 7, 0.5);
    outline-offset: 3px;
    border-radius: 4px;
    cursor: text;
    transition: outline-color 0.15s ease, background 0.15s ease;
    min-height: 1em;
}

body.editing .editable:hover {
    outline-color: var(--gold);
    background: rgba(242, 227, 7, 0.08);
}

body.editing .editable:focus {
    outline: 2px solid var(--gold);
    background: rgba(242, 227, 7, 0.12);
}

/* fields sitting on yellow surfaces need a dark outline instead */
body.editing .btn-primary .editable {
    outline-color: rgba(10, 10, 10, 0.6);
}

body.editing .editable:empty::before {
    content: "Click to edit…";
    color: rgba(185, 185, 173, 0.6);
    font-style: italic;
}

/* Field that has unsaved changes */
body.editing .editable.dirty {
    outline-color: #d97706;
}

/* ---------- Edit controls (only visible in editing mode) ---------- */
.edit-ctrl {
    display: none !important;
}

body.editing .edit-ctrl {
    display: inline-flex !important;
}

/* Floating action button + expandable menu */
body.editing .fab-wrapper.edit-ctrl {
    position: fixed;
    right: 1.4rem;
    bottom: 5.6rem;
    z-index: 210;
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}

.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 200px;
}

.fab-menu[hidden] {
    display: none;
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #111111;
    color: var(--text, #f4f4f0);
    border: 1.5px solid var(--gold);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    transition: background 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.fab-menu-item:hover {
    background: rgba(242, 227, 7, 0.12);
    transform: translateX(-3px);
}

.fab-menu-icon {
    font-size: 1rem;
    width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}

body.editing .fab {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--gold);
    color: #0a0a0a;
    border: none;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(242, 227, 7, 0.35);
    transition: transform 0.15s ease, background 0.15s ease;
}

body.editing .fab:hover {
    transform: scale(1.05);
    background: var(--gold-light);
}

body.editing .fab.is-open {
    background: #111111;
    color: var(--gold);
    border: 1.5px solid var(--gold);
}

.fab-icon-close {
    display: none;
}

body.editing .fab.is-open .fab-icon-open {
    display: none;
}

body.editing .fab.is-open .fab-icon-close {
    display: block;
}

/* Section manager panel */
body.editing .section-panel.edit-ctrl {
    position: fixed;
    right: 1.4rem;
    bottom: 12rem;
    z-index: 205;
    display: flex !important;
    flex-direction: column;
    width: min(300px, 88vw);
    max-height: 50vh;
    background: #111111;
    border: 1.5px solid var(--gold);
    border-radius: 12px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

body.editing .section-panel.edit-ctrl[hidden] {
    display: none !important;
}

.section-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(242, 227, 7, 0.2);
}

.section-panel-header h4 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    font-size: 0.9rem;
    margin: 0;
}

.section-panel-close {
    background: none;
    border: none;
    color: var(--text, #f4f4f0);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}

.section-panel-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    overflow-y: auto;
    flex: 1;
}

.section-panel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    color: var(--text, #f4f4f0);
}

.section-panel-item.is-hidden {
    opacity: 0.55;
}

.section-panel-item em {
    font-style: normal;
    color: var(--gold);
    font-size: 0.78rem;
}

.section-panel-add {
    margin: 0.6rem 1rem 0.9rem;
    width: calc(100% - 2rem);
}

/* Save button highlights when there are unsaved changes */
#save-now.has-changes {
    animation: save-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(242, 227, 7, 0.35);
}

#save-now:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    animation: none;
    box-shadow: none;
}

@keyframes save-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(242, 227, 7, 0.25); }
    50%      { box-shadow: 0 0 0 6px rgba(242, 227, 7, 0.45); }
}

/* Brief highlight when FAB routes to an image slot */
body.editing .img-highlight {
    outline: 3px solid var(--gold) !important;
    outline-offset: 4px;
}

/* "× Remove section" pill in each section's top-right corner */
body.editing .section-remove.edit-ctrl {
    position: absolute;
    top: 1.4rem;
    right: 0;
    z-index: 5;
    align-items: center;
    gap: 0.3rem;
    background: rgba(10, 10, 10, 0.85);
    color: #ff6b5c;
    border: 1.5px solid rgba(255, 107, 92, 0.5);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

body.editing .section-remove.edit-ctrl:hover {
    border-color: #ff6b5c;
    background: rgba(255, 107, 92, 0.12);
}

/* Small round × on cards */
body.editing .card-remove.edit-ctrl {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    z-index: 5;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, 0.85);
    color: #ff6b5c;
    border: 1.5px solid rgba(255, 107, 92, 0.5);
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

body.editing .card-remove.edit-ctrl:hover {
    border-color: #ff6b5c;
    background: rgba(255, 107, 92, 0.15);
}

/* "Change photo" pill over images */
body.editing .img-change {
    position: absolute;
    left: 50%;
    bottom: 0.6rem;
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex !important;
    align-items: center;
    background: rgba(10, 10, 10, 0.85);
    color: var(--gold-light);
    border: 1.5px solid var(--gold);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease;
}

body.editing .img-change:hover {
    background: rgba(242, 227, 7, 0.18);
    color: var(--gold-light);
}

/* Dashed "+ Add" tiles inside grids */
body.editing .add-tile.edit-ctrl {
    align-items: center;
    justify-content: center;
    min-height: 160px;
    background: transparent;
    border: 2px dashed rgba(242, 227, 7, 0.45);
    border-radius: 10px;
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

body.editing .add-tile.edit-ctrl:hover {
    border-color: var(--gold);
    background: rgba(242, 227, 7, 0.06);
}

/* Placeholder bar where a hidden built-in section lives */
body.editing .hidden-placeholder.edit-ctrl {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: min(1140px, 92%);
    margin: 1rem auto;
    padding: 1rem 1.4rem;
    background: rgba(242, 227, 7, 0.05);
    border: 2px dashed rgba(242, 227, 7, 0.4);
    border-radius: 10px;
    color: var(--text, #f4f4f0);
    font-size: 0.92rem;
}

/* Empty image slots in custom sections */
body.editing .custom-image-empty.edit-ctrl {
    display: flex !important;
    align-items: center;
    justify-content: center;
    max-width: 760px;
    margin: 0 auto 2rem;
    padding: 2.2rem;
    border: 2px dashed rgba(242, 227, 7, 0.4);
    border-radius: 10px;
}

body.editing .card-image-empty.edit-ctrl {
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(242, 227, 7, 0.4);
    background: transparent;
}

body.editing .card-image-empty .img-change {
    position: static;
    transform: none;
}

/* ---------- Edit bar ---------- */
.edit-bar {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #111111;
    color: var(--text);
    border: 1.5px solid var(--gold);
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.edit-bar[hidden] {
    display: none;
}

.edit-bar-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold-light);
}

.save-status {
    font-size: 0.85rem;
    color: #b9b9ad;
}

.save-status[data-state="saving"] {
    color: var(--gold-light);
}

.save-status[data-state="saved"] {
    color: #6fcf7c;
}

.save-status[data-state="error"],
.save-status[data-state="dirty"] {
    color: #e8865c;
}

/* ---------- Password modal ---------- */
.password-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.password-modal[hidden] {
    display: none;
}

.password-box {
    background: #111111;
    border: 1.5px solid var(--gold);
    border-radius: var(--radius);
    padding: 2rem;
    width: min(400px, 92%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.password-box h3 {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold);
    margin-bottom: 1.2rem;
    text-align: center;
}

.password-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1.4rem;
    padding: 1.1rem 1rem;
    background: rgba(242, 227, 7, 0.14);
    border: 2px solid var(--gold);
    border-radius: 10px;
    text-align: center;
}

.password-info-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #d9d3bd;
}

.password-info-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    letter-spacing: 0.12em;
    color: var(--gold);
    line-height: 1.2;
    user-select: all;
}

.password-field-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #b9b9ad;
}

.password-box input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: #0a0a0a;
    color: var(--text);
    border: 2px solid rgba(242, 227, 7, 0.3);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.password-box input:focus {
    outline: none;
    border-color: var(--gold);
}

.password-error {
    color: #ff6b5c;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.password-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.2rem;
}
