/* ============================================
   La Cabaña — Inline Editor Styles
   Only active when ?edit=true
   ============================================ */

/* ==================
   Admin Toolbar
   ================== */
.ie-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1a0c0e 0%, #2d1519 100%);
    border-bottom: 2px solid #d41132;
    padding: 0 1.5rem;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Work Sans', sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.ie-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ie-toolbar-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #d41132;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: ie-pulse 2s infinite;
}

@keyframes ie-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.ie-toolbar-page {
    color: #c9929b;
    font-size: 0.8rem;
    font-weight: 500;
}

.ie-toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ie-toolbar-status {
    font-size: 0.75rem;
    color: #c9929b;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.3s;
}

.ie-toolbar-status.saving {
    color: #fbbf24;
}

.ie-toolbar-status.saved {
    color: #34d399;
}

.ie-toolbar-status.error {
    color: #f87171;
}

.ie-toolbar-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
}

.ie-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ie-toolbar-btn.exit {
    background: rgba(212, 17, 50, 0.3);
    border-color: #d41132;
}

.ie-toolbar-btn.exit:hover {
    background: #d41132;
}

/* Push page content down when toolbar is active */
body.ie-active {
    padding-top: 48px !important;
}

body.ie-active>div:first-child>header,
body.ie-active header.sticky {
    top: 48px !important;
}

/* ==================
   Editable Elements
   ================== */
.ie-editable {
    position: relative;
    cursor: text;
    transition: outline 0.15s ease, box-shadow 0.15s ease;
    outline: 2px dashed transparent;
    outline-offset: 4px;
    border-radius: 4px;
}

.ie-editable:hover {
    outline-color: rgba(212, 17, 50, 0.5);
}

.ie-editable:focus {
    outline-color: #d41132 !important;
    outline-style: solid !important;
    box-shadow: 0 0 0 4px rgba(212, 17, 50, 0.15);
}

.ie-editable::after {
    content: '✏️';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.7rem;
    background: #d41132;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
}

.ie-editable:hover::after {
    opacity: 1;
}

/* ==================
   Image Editables
   ================== */
.ie-image-editable {
    position: relative;
    cursor: pointer;
    transition: outline 0.15s ease;
    outline: 2px dashed transparent;
    outline-offset: 4px;
}

.ie-image-editable:hover {
    outline-color: rgba(212, 17, 50, 0.5);
}

.ie-image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 12, 14, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.25s;
    z-index: 5;
    border-radius: inherit;
    pointer-events: none;
}

.ie-image-editable:hover .ie-image-overlay {
    opacity: 1;
    pointer-events: auto;
}

.ie-image-overlay .material-symbols-outlined {
    font-size: 2rem;
    color: white;
}

.ie-image-overlay span:not(.material-symbols-outlined) {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.ie-image-overlay-btn {
    background: #d41132;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.ie-image-overlay-btn:hover {
    background: #b00e29;
}

/* ==================
   Image Upload Modal
   ================== */
.ie-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.ie-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ie-modal {
    background: #1a0c0e;
    border: 1px solid #482329;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.25s;
}

.ie-modal-overlay.active .ie-modal {
    transform: scale(1);
}

.ie-modal h3 {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.ie-modal p {
    color: #c9929b;
    font-size: 0.85rem;
    margin: 0 0 1.5rem;
}

.ie-modal-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: #2d1519;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid #482329;
}

.ie-modal-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ie-modal-dropzone {
    border: 2px dashed #482329;
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    color: #c9929b;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
    position: relative;
}

.ie-modal-dropzone:hover,
.ie-modal-dropzone.dragover {
    border-color: #d41132;
    background: rgba(212, 17, 50, 0.05);
    color: white;
}

.ie-modal-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.ie-modal-url {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ie-modal-url input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: #2d1519;
    border: 1px solid #482329;
    border-radius: 0.375rem;
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.ie-modal-url input:focus {
    border-color: #d41132;
}

.ie-modal-url input::placeholder {
    color: #67323b;
}

.ie-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.ie-modal-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.ie-modal-btn.cancel {
    background: #2d1519;
    color: #c9929b;
    border: 1px solid #482329;
}

.ie-modal-btn.cancel:hover {
    background: #33191e;
    color: white;
}

.ie-modal-btn.primary {
    background: #d41132;
    color: white;
}

.ie-modal-btn.primary:hover {
    background: #b00e29;
}

/* ==================
   Toast Notification
   ================== */
.ie-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10001;
    background: #1a0c0e;
    border: 1px solid #482329;
    border-radius: 0.5rem;
    padding: 0.7rem 1.2rem;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.ie-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.ie-toast.success {
    border-color: #34d399;
}

.ie-toast.error {
    border-color: #f87171;
}

/* ==================
   Carta Edit Buttons
   ================== */
.ie-carta-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.ie-carta-btn {
    background: rgba(212, 17, 50, 0.15);
    border: 1px solid rgba(212, 17, 50, 0.3);
    color: #d41132;
    padding: 0.25rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ie-carta-btn:hover {
    background: #d41132;
    color: white;
}

.ie-carta-btn.add {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.ie-carta-btn.add:hover {
    background: #34d399;
    color: #1a0c0e;
}

.ie-carta-btn.delete {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: #f87171;
}

.ie-carta-btn.delete:hover {
    background: #f87171;
    color: white;
}

/* ==================
   Section Action Bar (for Carta)
   ================== */
.ie-section-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(212, 17, 50, 0.08);
    border: 1px dashed rgba(212, 17, 50, 0.25);
    border-radius: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Hide editor elements when not in edit mode */
body:not(.ie-active) .ie-toolbar,
body:not(.ie-active) .ie-editable::after,
body:not(.ie-active) .ie-image-overlay,
body:not(.ie-active) .ie-carta-actions,
body:not(.ie-active) .ie-section-bar {
    display: none !important;
}