/* Premium Design System */
:root {
    --primary: #ef7d00;
    /* Plotbase Orange */
    --primary-hover: #d56a00;
    --primary-light: #fff2e5;
    --bg-main: #f5f5f5;
    /* Light grey */
    --bg-modal: #FFFFFF;
    --text-primary: #333333;
    /* Darker grey */
    --text-secondary: #777777;
    /* Grey */
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --modal-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --radius-sm: 4px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-xl: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal Overlay with Glassmorphism */
.editor_modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.editor_modal.active {
    display: flex;
}

/* Modal Content */
.editor_modal .panel {
    background: var(--bg-modal);
    border-radius: var(--radius-xl);
    width: 90vw;
    max-width: 1100px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--modal-shadow);
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

/* .modal-overlay.hidden .modal {
    transform: scale(0.95);
} */

/* Modal Header */
.editor_modal .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    background: #FAFAFA;
}

.editor_modal .panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.editor_modal .panel-title i {
    font-size: 24px;
    color: var(--primary);
}

.editor_modal .panel-title h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.editor_modal .panel-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.editor_modal .panel-close:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Modal Body */
.editor_modal .panel-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

/* Categories Sidebar */
.editor_modal .categories-container {
    width: 240px;
    border-right: 1px solid var(--border-color);
    background: #FAFAFA;
    overflow-y: auto;
    padding: 16px 0;
}

.editor_modal .category-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px;
}

.editor_modal .tab-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 15.2px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.editor_modal .tab-btn i {
    font-size: 19.2px;
    margin-right: 8px;
}

.editor_modal .tab-text {
    flex: 1;
}

.editor_modal .tab-count {
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 1.6px 8px;
    border-radius: 16px;
    font-weight: 600;
    transition: var(--transition);
}

.editor_modal .tab-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.editor_modal .tab-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}

.editor_modal .tab-btn.active .tab-count {
    background: var(--primary);
    color: white;
}

.editor_modal .modal-container {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-modal);
}

.editor_object_widget_gallery .modal-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor_modal .modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 32px;
}

/* Modal Card */
.editor_modal .modal-card {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor_modal .modal-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.editor_modal .modal-card.selected {
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.editor_modal .modal-card.selected::after {
    content: '\eb7a';
    font-family: 'RemixIcon';
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14.4px;
    font-weight: bold;
}

/* Preview Drawing Box */
.editor_modal .modal-card-preview-box {
    width: 100%;
    aspect-ratio: 4/3;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm);
    padding: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

/* Common Black Placeholder element */
.editor_modal .ph {
    background: #111827;
    /* Dark almost black */
    border-radius: 2px;
    width: 100%;
    height: 100%;
}

.editor_modal .modal-card-background {
    width: 100%;
}

@media (max-width: 499px) {
    .editor_modal .category-tabs {
        padding: 0 10px;
        position: relative;
    }

    .editor_modal .category-tabs .tab-btn:not(.active) {
        display: none;
    }

    .editor_modal .category-tabs.is-open .tab-btn {
        display: flex;
    }

    .editor_modal .category-tabs .tab-btn.active::after {
        content: '\ea4e';
        font-family: 'RemixIcon';
        font-size: 18px;
        margin-left: 8px;
        transition: transform 0.2s ease;
    }

    .editor_modal .category-tabs.is-open .tab-btn.active::after {
        transform: rotate(180deg);
    }

    .editor_modal .categories-container {
        overflow: visible;
    }

    .editor_modal .panel-body {
        flex-direction: column;
    }

    .editor_modal .categories-container {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .editor_modal .modal-container {
        padding: 0;
    }

    .editor_modal .modal-grid {
        gap: 0px;
        grid-template-columns: 1fr 1fr;
    }

    .editor_modal .modal-card {
        border: none;
        padding: 10px;
        border-radius: 0;
    }

    .editor_modal .modal-card:nth-child(2n) {
        border-left: 1px solid var(--border-color);
    }

    .editor_modal .modal-card:not(:first-child):not(:nth-child(2)) {
        border-top: 1px solid var(--border-color);
    }

    .editor_modal .modal-card-preview-box {
        padding: 0;
        border-radius: 0;
    }
}

/* Upload Progress Modal */
.editor_upload_modal_panel {
    width: 420px !important;
    max-width: 90vw !important;
    height: auto !important;
    min-height: unset !important;
}

.editor_upload_modal_body {
    flex-direction: column !important;
    padding: 32px !important;
    overflow: visible !important;
}

.editor_upload_modal_progress_wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor_upload_modal_progress_bar {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 99px;
    overflow: hidden;
}

.editor_upload_modal_progress_fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 99px;
    transition: width 0.2s ease;
}

.editor_upload_modal_info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}