/* ============================================================
   PIZZERIA BONAZÜNS – LIVE VISUAL EDITOR STYLES
   Only active when body has class .admin-edit-mode
   ============================================================ */

/* Push page down below toolbar */
body.admin-edit-mode { padding-top: 58px !important; }

/* ── TOOLBAR ─────────────────────────────────────────────── */
.admin-toolbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 58px;
    background: #111;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    z-index: 999999;
    box-shadow: 0 2px 16px rgba(0,0,0,.5);
    font-family: 'Inter', -apple-system, sans-serif;
}

.toolbar-brand {
    color: #D4AF37;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-right: 6px;
    white-space: nowrap;
}

.toolbar-mode-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.85);
    font-size: .8rem;
    font-weight: 600;
    margin-right: auto;
}

.toolbar-live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    animation: livePulse 2s infinite;
}
@keyframes livePulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); }
    50%      { box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}

.toolbar-hint {
    display: none;
    color: rgba(255,255,255,.35);
    font-size: .75rem;
    padding: 0 14px;
    border-left: 1px solid rgba(255,255,255,.1);
    border-right: 1px solid rgba(255,255,255,.1);
    margin: 0 4px;
}
@media(min-width: 860px){ .toolbar-hint { display: block; } }

.tbtn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tbtn-save {
    background: #8B0000;
    color: #fff;
}
.tbtn-save:hover { background: #6B0000; transform: translateY(-1px); }
.tbtn-save.has-changes {
    background: #16a34a;
    animation: saveGlow 1.8s infinite;
}
@keyframes saveGlow {
    0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); }
    50%      { box-shadow: 0 0 0 7px rgba(22,163,74,0); }
}

.tbtn-hours  { background: rgba(255,255,255,.1); color: #fff; }
.tbtn-hours:hover { background: rgba(255,255,255,.18); }
.tbtn-phone  { background: rgba(255,255,255,.1); color: #fff; }
.tbtn-phone:hover { background: rgba(255,255,255,.18); }

.tbtn-discard { background: transparent; color: rgba(255,255,255,.5); }
.tbtn-discard:hover { background: rgba(255,255,255,.08); color: #fff; }

.tbtn-logout { background: transparent; color: rgba(255,255,255,.35); padding: 8px 10px; }
.tbtn-logout:hover { color: #fca5a5; background: rgba(220,38,38,.15); }

/* ── EDITABLE TEXTS ─────────────────────────────────────── */
body.admin-edit-mode [data-text-key][contenteditable] {
    border-radius: 4px;
    outline: 2px dashed transparent;
    transition: outline .15s, background .15s;
    cursor: text;
    display: block;
}
body.admin-edit-mode [data-text-key][contenteditable]:hover {
    outline-color: rgba(139,0,0,.45);
    background: rgba(139,0,0,.04);
}
body.admin-edit-mode [data-text-key][contenteditable]:focus {
    outline: 2px solid #8B0000;
    background: rgba(255,255,255,.95);
    box-shadow: 0 0 0 5px rgba(139,0,0,.1);
    position: relative;
    z-index: 5;
}

/* edit-hint tooltip on hover */
body.admin-edit-mode [data-text-key][contenteditable]:hover::before {
    content: '✏️ Bearbeiten';
    position: absolute;
    top: -26px;
    left: 0;
    background: #111;
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}
body.admin-edit-mode [data-text-key][contenteditable] { position: relative; }

/* ── PRICE EDITING ──────────────────────────────────────── */
body.admin-edit-mode [data-price-id] {
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s, outline .15s;
    outline: 2px dashed transparent;
}
body.admin-edit-mode [data-price-id]:hover {
    outline-color: rgba(212,175,55,.7);
    background: rgba(212,175,55,.12);
}

.price-popup {
    position: fixed;
    background: #fff;
    border: 2px solid #8B0000;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 99999;
    font-family: 'Inter', sans-serif;
    animation: popIn .15s ease;
}
@keyframes popIn { from { transform: scale(.9); opacity:0; } to { transform: scale(1); opacity:1; } }
.price-popup label { font-size: .78rem; color: #666; font-weight: 700; }
.price-popup .chf { font-weight: 700; color: #8B0000; font-size: .9rem; }
.price-popup input {
    width: 90px;
    padding: 7px 9px;
    border: 1.5px solid #e2e5ea;
    border-radius: 7px;
    font-size: 1rem;
    text-align: right;
    font-family: inherit;
    font-weight: 600;
    outline: none;
}
.price-popup input:focus { border-color: #8B0000; box-shadow: 0 0 0 3px rgba(139,0,0,.1); }
.price-popup-ok {
    padding: 7px 13px;
    background: #8B0000;
    color: #fff;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 700;
    font-family: inherit;
}
.price-popup-ok:hover { background: #6B0000; }
.price-popup-cancel {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

/* ── IMAGE OVERLAYS ─────────────────────────────────────── */
.admin-img-wrap {
    position: relative;
    display: inline-block;
    cursor: grab;
}
.admin-img-wrap:active { cursor: grabbing; }

.admin-img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    border-radius: inherit;
    z-index: 20;
}
.admin-img-wrap:hover .admin-img-overlay { opacity: 1; pointer-events: all; }

.img-overlay-btn {
    padding: 9px 18px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,.7);
    background: rgba(255,255,255,.15);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    transition: background .15s;
}
.img-overlay-btn:hover { background: rgba(255,255,255,.3); }
.img-overlay-btn.danger { border-color: rgba(252,165,165,.7); }
.img-overlay-btn.danger:hover { background: rgba(220,38,38,.3); }

.img-overlay-hint {
    font-size: .72rem;
    color: rgba(255,255,255,.65);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

/* freely dragged image ghost */
.admin-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 999998;
    opacity: .75;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    transform: rotate(2deg) scale(1.03);
    transition: transform .1s;
    max-width: 320px;
    max-height: 240px;
    object-fit: cover;
}

/* drop target highlight */
.admin-img-wrap.drop-target {
    outline: 3px dashed #8B0000;
    outline-offset: 4px;
}
.admin-img-wrap.drop-target .admin-img-overlay {
    opacity: 1;
    background: rgba(139,0,0,.45);
    pointer-events: none;
}

/* hero bg overlay button */
.hero-admin-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    padding: 10px 20px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: 2px solid rgba(255,255,255,.55);
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: .85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(6px);
    transition: background .15s;
}
.hero-admin-btn:hover { background: rgba(0,0,0,.85); }

/* image repositioned indicator */
.img-moved-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #D4AF37;
    color: #000;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    z-index: 30;
    pointer-events: none;
}

/* ── HOURS PANEL ─────────────────────────────────────────── */
.hours-panel {
    position: fixed;
    top: 58px; bottom: 0;
    right: -460px;
    width: 440px;
    background: #fff;
    border-left: 2px solid #e2e5ea;
    box-shadow: -6px 0 24px rgba(0,0,0,.14);
    z-index: 99997;
    transition: right .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}
.hours-panel.open { right: 0; }

.hours-panel-head {
    background: #8B0000;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.hours-panel-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.hours-panel-close {
    background: none; border: none;
    color: rgba(255,255,255,.65);
    cursor: pointer; font-size: 1.2rem; padding: 2px 6px;
    border-radius: 4px;
}
.hours-panel-close:hover { color: #fff; background: rgba(255,255,255,.15); }

.hours-panel-body {
    flex: 1; overflow-y: auto;
    padding: 16px 20px;
}

.hours-day {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.hours-day:last-child { border-bottom: none; }
.hours-day-name {
    font-weight: 700;
    font-size: .88rem;
    color: #8B0000;
    margin-bottom: 8px;
}
.hours-periods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.hours-period-title {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #888;
    margin-bottom: 5px;
}
.hours-pair {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .78rem;
    color: #aaa;
}
.hours-tin {
    flex: 1;
    padding: 7px 8px;
    border: 1.5px solid #e2e5ea;
    border-radius: 7px;
    font-size: .85rem;
    font-family: inherit;
    outline: none;
    color: #333;
    background: #fafafa;
}
.hours-tin:focus { border-color: #8B0000; background: #fff; box-shadow: 0 0 0 3px rgba(139,0,0,.1); }

.hours-closed-note {
    font-size: .73rem;
    color: #bbb;
    margin-top: 4px;
    font-style: italic;
}

.hours-panel-foot {
    padding: 14px 20px;
    border-top: 1px solid #e2e5ea;
    flex-shrink: 0;
}
.hours-save-btn {
    width: 100%;
    padding: 13px;
    background: #8B0000;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s;
}
.hours-save-btn:hover { background: #6B0000; }

/* ── PHONE PANEL ─────────────────────────────────────────── */
.phone-panel {
    position: fixed;
    top: 58px; bottom: 0;
    right: -460px;
    width: 440px;
    background: #fff;
    border-left: 2px solid #e2e5ea;
    box-shadow: -6px 0 24px rgba(0,0,0,.14);
    z-index: 99997;
    transition: right .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}
.phone-panel.open { right: 0; }

.phone-panel-head {
    background: #8B0000;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.phone-panel-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.phone-panel-close {
    background: none; border: none;
    color: rgba(255,255,255,.65);
    cursor: pointer; font-size: 1.2rem; padding: 2px 6px;
    border-radius: 4px;
}
.phone-panel-close:hover { color: #fff; background: rgba(255,255,255,.15); }

.phone-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.phone-panel-body label {
    display: block;
    margin-bottom: 8px;
    color: #8B0000;
    font-size: .85rem;
    font-weight: 700;
}
.phone-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e5ea;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    color: #333;
    background: #fafafa;
}
.phone-input:focus {
    border-color: #8B0000;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(139,0,0,.1);
}
.phone-help {
    margin: 12px 0 18px;
    color: #777;
    font-size: .84rem;
    line-height: 1.55;
}
.phone-preview {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 9px 12px;
    padding: 14px;
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 10px;
    font-size: .86rem;
}
.phone-preview span { color: #888; font-weight: 600; }
.phone-preview strong { color: #222; overflow-wrap: anywhere; }

.phone-panel-foot {
    padding: 14px 20px;
    border-top: 1px solid #e2e5ea;
    flex-shrink: 0;
}
.phone-save-btn {
    width: 100%;
    padding: 13px;
    background: #8B0000;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s;
}
.phone-save-btn:hover { background: #6B0000; }

/* ── TOAST ───────────────────────────────────────────────── */
.ae-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(70px);
    background: #111;
    color: #fff;
    padding: 11px 22px;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(0,0,0,.3);
    z-index: 999999;
    opacity: 0;
    transition: transform .3s ease, opacity .3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    pointer-events: none;
}
.ae-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.ae-toast.green  { background: #16a34a; }
.ae-toast.red    { background: #dc2626; }
.ae-toast.orange { background: #d97706; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media(max-width: 600px) {
    .hours-panel { width: 100%; }
    .phone-panel { width: 100%; }
    .tbtn span { display: none; }
    .tbtn { padding: 8px 10px; }
    .tbtn-save span, .tbtn-logout span { display: inline; }
}
