/* ============================================================================
   EDITOR.CSS — Inline CMS Niswatul Chaira Portfolio
   ============================================================================ */

/* ============================================================================
   1. CSS VARIABLES
   ============================================================================ */
:root {
    --ed-primary: #1560BD;
    --ed-primary-dark: #0d4a94;
    --ed-primary-light: #3d7fcc;
    --ed-success: #10b981;
    --ed-danger: #ef4444;
    --ed-warning: #f59e0b;
    --ed-bg: #0f1117;
    --ed-bg-card: #161b27;
    --ed-bg-elevated: #1e2535;
    --ed-border: rgba(255, 255, 255, 0.08);
    --ed-text: #f0f4ff;
    --ed-text-muted: #8892a4;
    --ed-text-dim: #4a5568;
    --ed-radius: 12px;
    --ed-radius-sm: 8px;
    --ed-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --ed-shadow-glow: 0 0 0 3px rgba(21, 96, 189, 0.25);
    --ed-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ed-transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --ed-z-toolbar: 9000;
    --ed-z-overlay: 9100;
    --ed-z-modal: 9200;
    --ed-z-toast: 9300;
}

/* ============================================================================
   2. EDITABLE HIGHLIGHTS
   ============================================================================ */
body.editor-active [data-editable] {
    outline: 1.5px dashed rgba(21, 96, 189, 0.45);
    outline-offset: 2px;
    border-radius: 3px;
    cursor: text !important;
    position: relative;
}

body.editor-active [data-editable]:hover {
    outline: 2px dashed var(--ed-primary);
    outline-offset: 3px;
    background: rgba(21, 96, 189, 0.04);
}

body.editor-active [data-editable].ed-editing {
    outline: 2px solid var(--ed-primary) !important;
    outline-offset: 3px;
    background: rgba(21, 96, 189, 0.07);
    box-shadow: var(--ed-shadow-glow);
}

/* Tooltip label */
body.editor-active [data-editable]:hover::before {
    content: attr(data-label);
    position: absolute;
    top: -24px;
    left: 0;
    background: var(--ed-primary);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
}

/* Image editable */
body.editor-active [data-editable-img] {
    outline: 1.5px dashed rgba(21, 96, 189, 0.45);
    outline-offset: 2px;
    cursor: pointer !important;
    position: relative;
}

body.editor-active [data-editable-img]:hover {
    outline: 2px dashed var(--ed-primary);
}

/* ============================================================================
   3. IMAGE OVERLAY
   ============================================================================ */
.ed-img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(21, 96, 189, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: var(--ed-transition);
    border-radius: inherit;
    cursor: pointer;
    z-index: 20;
    pointer-events: none;
}

body.editor-active [data-editable-img]:hover .ed-img-overlay {
    opacity: 1;
    pointer-events: all;
}

.ed-img-overlay-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.ed-img-overlay-icon svg {
    width: 18px;
    height: 18px;
}

.ed-img-overlay-label {
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ============================================================================
   4. TOOLBAR
   ============================================================================ */
#ed-toolbar {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(140px);
    z-index: var(--ed-z-toolbar);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--ed-bg-card);
    border: 1px solid var(--ed-border);
    border-radius: 999px;
    padding: 8px 14px;
    box-shadow: var(--ed-shadow), 0 0 0 1px rgba(21, 96, 189, 0.12);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    white-space: nowrap;
}

#ed-toolbar.ed-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.ed-divider {
    width: 1px;
    height: 26px;
    background: var(--ed-border);
    margin: 0 2px;
    flex-shrink: 0;
}

/* Buttons */
.ed-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ed-transition);
    flex-shrink: 0;
    white-space: nowrap;
}

.ed-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.ed-btn-icon {
    padding: 8px;
    border-radius: 50%;
}

.ed-btn-primary {
    background: var(--ed-primary);
    color: #fff;
}

.ed-btn-primary:hover {
    background: var(--ed-primary-dark);
    transform: scale(1.04);
}

.ed-btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--ed-text-muted);
    border: 1px solid var(--ed-border);
}

.ed-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ed-text);
}

.ed-btn-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--ed-success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.ed-btn-success:hover {
    background: rgba(16, 185, 129, 0.22);
}

.ed-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--ed-danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.ed-btn-danger:hover {
    background: rgba(239, 68, 68, 0.22);
}

.ed-btn-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--ed-warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.ed-btn-warning:hover {
    background: rgba(245, 158, 11, 0.22);
}

/* Mode badge */
#ed-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(21, 96, 189, 0.15);
    border: 1px solid rgba(21, 96, 189, 0.3);
    border-radius: 999px;
    color: var(--ed-primary-light);
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    flex-shrink: 0;
}

#ed-badge .ed-dot {
    width: 6px;
    height: 6px;
    background: var(--ed-primary-light);
    border-radius: 50%;
    animation: ed-blink 1.8s ease-in-out infinite;
}

@keyframes ed-blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(0.7);
    }
}

/* Unsaved dot */
#ed-unsaved {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--ed-warning);
    border-radius: 50%;
    margin-left: 2px;
    opacity: 0;
    transition: opacity 0.3s;
    vertical-align: middle;
    animation: ed-blink 2s ease-in-out infinite;
}

#ed-unsaved.ed-show {
    opacity: 1;
}

/* ============================================================================
   5. MODALS (Auth + Settings)
   ============================================================================ */
.ed-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    z-index: var(--ed-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--ed-transition-slow);
}

.ed-overlay.ed-show {
    opacity: 1;
    visibility: visible;
}

.ed-modal {
    background: var(--ed-bg-card);
    border: 1px solid var(--ed-border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--ed-shadow);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ed-overlay.ed-show .ed-modal {
    transform: scale(1) translateY(0);
}

.ed-modal-icon {
    width: 54px;
    height: 54px;
    background: rgba(21, 96, 189, 0.15);
    border: 1px solid rgba(21, 96, 189, 0.3);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--ed-primary-light);
}

.ed-modal-icon svg {
    width: 24px;
    height: 24px;
}

.ed-modal-title {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--ed-text);
    text-align: center;
    margin-bottom: 6px;
}

.ed-modal-subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: var(--ed-text-muted);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

.ed-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.ed-modal-close {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ed-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ed-text-muted);
    transition: var(--ed-transition);
}

.ed-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ed-text);
}

.ed-modal-close svg {
    width: 13px;
    height: 13px;
}

/* Form */
.ed-field {
    margin-bottom: 16px;
}

.ed-field label {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--ed-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.ed-input {
    width: 100%;
    padding: 13px 16px;
    background: var(--ed-bg-elevated);
    border: 1.5px solid var(--ed-border);
    border-radius: var(--ed-radius-sm);
    color: var(--ed-text);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    outline: none;
    transition: var(--ed-transition);
}

.ed-input:focus {
    border-color: var(--ed-primary);
    box-shadow: 0 0 0 3px rgba(21, 96, 189, 0.2);
}

.ed-input.ed-err {
    border-color: var(--ed-danger);
}

.ed-input::placeholder {
    color: var(--ed-text-dim);
}

.ed-err-msg {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    color: var(--ed-danger);
    margin-top: 5px;
    display: none;
}

.ed-err-msg.ed-show {
    display: block;
}

.ed-submit {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    background: var(--ed-primary);
    color: #fff;
    border: none;
    border-radius: var(--ed-radius-sm);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ed-transition);
}

.ed-submit:hover {
    background: var(--ed-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21, 96, 189, 0.4);
}

/* ============================================================================
   6. DROPZONE
   ============================================================================ */
#ed-dropzone {
    position: fixed;
    inset: 0;
    z-index: var(--ed-z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 30, 0.88);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: var(--ed-transition-slow);
}

#ed-dropzone.ed-show {
    opacity: 1;
    visibility: visible;
}

.ed-dz-inner {
    width: 420px;
    max-width: 90vw;
    border: 2px dashed rgba(21, 96, 189, 0.5);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    background: rgba(21, 96, 189, 0.06);
    transition: var(--ed-transition);
}

#ed-dropzone.ed-drag .ed-dz-inner {
    border-color: var(--ed-primary);
    background: rgba(21, 96, 189, 0.12);
    transform: scale(1.02);
}

.ed-dz-icon {
    width: 64px;
    height: 64px;
    background: rgba(21, 96, 189, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--ed-primary-light);
    transition: var(--ed-transition);
}

.ed-dz-icon svg {
    width: 30px;
    height: 30px;
}

#ed-dropzone.ed-drag .ed-dz-icon {
    background: rgba(21, 96, 189, 0.3);
    transform: scale(1.1);
}

.ed-dz-title {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--ed-text);
    margin-bottom: 8px;
}

.ed-dz-sub {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    color: var(--ed-text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.ed-dz-browse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--ed-primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ed-transition);
}

.ed-dz-browse:hover {
    background: var(--ed-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(21, 96, 189, 0.4);
}

.ed-dz-cancel {
    display: block;
    margin-top: 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    color: var(--ed-text-muted);
    cursor: pointer;
    background: none;
    border: none;
    transition: var(--ed-transition);
}

.ed-dz-cancel:hover {
    color: var(--ed-text);
}

/* ============================================================================
   7. BLOG CONTROLS
   ============================================================================ */
.ed-card-del {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: var(--ed-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.editor-active .blog-card {
    position: relative;
}

body.editor-active .ed-card-del {
    display: flex;
}

.ed-card-del:hover {
    background: var(--ed-danger);
    transform: scale(1.1);
}

.ed-card-del svg {
    width: 13px;
    height: 13px;
}

.ed-blog-add {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    border: 2px dashed rgba(21, 96, 189, 0.35);
    border-radius: 20px;
    background: rgba(21, 96, 189, 0.04);
    color: var(--ed-primary-light);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ed-transition);
    width: 100%;
    min-height: 120px;
}

body.editor-active .ed-blog-add {
    display: flex;
}

.ed-blog-add:hover {
    border-color: var(--ed-primary);
    background: rgba(21, 96, 189, 0.1);
    transform: scale(1.01);
}

.ed-blog-add svg {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   8. TOAST
   ============================================================================ */
#ed-toasts {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--ed-z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.ed-toast {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border-radius: 999px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--ed-shadow);
    animation: ed-tin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.ed-toast.ed-out {
    animation: ed-tout 0.25s ease forwards;
}

.ed-toast svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.ed-toast-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.ed-toast-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.ed-toast-info {
    background: rgba(21, 96, 189, 0.12);
    border: 1px solid rgba(21, 96, 189, 0.3);
    color: var(--ed-primary-light);
}

.ed-toast-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

@keyframes ed-tin {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ed-tout {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-8px) scale(0.9);
    }
}

/* ============================================================================
   9. CONTEXT MENU
   ============================================================================ */
#ed-ctx {
    position: fixed;
    z-index: var(--ed-z-modal);
    background: var(--ed-bg-card);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius);
    padding: 6px;
    min-width: 180px;
    box-shadow: var(--ed-shadow);
    display: none;
}

#ed-ctx.ed-show {
    display: block;
    animation: ed-menu 0.18s ease;
}

@keyframes ed-menu {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-4px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ed-ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--ed-text-muted);
    cursor: pointer;
    transition: var(--ed-transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.ed-ctx-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ed-text);
}

.ed-ctx-item.ed-red {
    color: var(--ed-danger);
}

.ed-ctx-item.ed-red:hover {
    background: rgba(239, 68, 68, 0.1);
}

.ed-ctx-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.ed-ctx-sep {
    height: 1px;
    background: var(--ed-border);
    margin: 4px 0;
}

/* ============================================================================
   10. RESPONSIVE
   ============================================================================ */
@media (max-width: 640px) {
    #ed-toolbar {
        bottom: 12px;
        max-width: calc(100vw - 24px);
        padding: 6px 10px;
        gap: 4px;
        overflow-x: auto;
        scrollbar-width: none;
        border-radius: 20px;
    }

    #ed-toolbar::-webkit-scrollbar {
        display: none;
    }

    .ed-btn {
        padding: 7px 10px;
        font-size: 11px;
        flex-shrink: 0;
    }

    #ed-badge {
        font-size: 10px;
        padding: 5px 10px;
        flex-shrink: 0;
    }
}

/* ============================================================================
   11. HIDDEN FILE INPUT
   ============================================================================ */
#ed-file-input {
    display: none !important;
}