/* === MELVIN PLUGIN CSS - Refined Layout === */

body.melvin-active {
    --melvin-sidebar-width: 310px;
    --melvin-sidebar-gap: 10px;
    --melvin-total-width: calc(var(--melvin-sidebar-width) + var(--melvin-sidebar-gap));
}

/* ============================================
   MELVIN SIDEBAR
   ============================================ */
#melvin {
    position: fixed;
    right: 0px;
    top: 0;
    width: 310px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0px 6px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-bar #melvin {
    top: 32px;
    height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
    .admin-bar #melvin {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

/* ============================================
   MOBILE DISABLE
   ============================================ */
@media screen and (max-width: 768px) {
    #melvin {
        display: none !important;
    }
    
    body.melvin-active .site.grid-container,
    body.melvin-active #page,
    body.melvin-active .site-header,
    body.melvin-active .main-navigation,
    body.melvin-active .site-footer,
    body.melvin-active .elementor-section-stretched,
    body.melvin-active .n2-ss-align,
    body.melvin-active .n2-ss-slide-background-image,
    body.melvin-active .n2-ss-section-main-content,
    body.melvin-active .elementor-widget-wrap.elementor-element-populated {
        padding-right: 0 !important;
        right: 0 !important;
        max-width: none !important;
    }
}

#melvin_upper_bar {
    display: flex;
    justify-content: space-between;
    margin: 15px 5px 0;
    flex-shrink: 0;
}

#melvin_upper_bar button {
    font-size: 1.1em;
    transition: transform 0.2s ease;
    background: #55555e;
    color: #fff;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 8px 12px;
}

#melvin_upper_bar button:hover {
    transform: scale(1.1);
}

#contenido {
    overflow: auto;
    margin: 0 3px;
    font-size: 0.9em;
    white-space: pre-wrap;
    line-height: 1.5;
    flex: 1;
}

#melvin_tabs {
    display: flex;
    flex-direction: row;
    gap: 5px;
    margin: 0 0 10px;
    flex-shrink: 0;
}

.melvin_tab {
    color: #333;
    padding: 8px 16px;
    cursor: pointer;
    background: #eee;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    transition: background 0.3s ease, font-weight 0.3s ease;
}

.melvin_tab.active {
    background: #fff;
    font-weight: bold;
    border-bottom: 1px solid white;
}

#melvin hr {
    margin: 10px 0;
    border: 0;
    border-top: 1px solid #ccc;
}

#selected_element_container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    flex-shrink: 0;
}

#selected_element {
    max-width: 290px;
    text-align: center;
    border-radius: 5px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

#selected_element:hover {
    transform: scale(1.05);
    box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.15);
}

#bottom_buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#bottom_buttons button {
    border: none;
    font-size: 1.5em;
    cursor: pointer;
}

#bottom_buttons button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#prev_button {
    margin-left: 10px;
    margin-bottom: 10px;
}

#next_button {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* ============================================
   MINIMIZED STATE STYLES
   ============================================ */

/* When body has melvin-minimized class, reset all layout shifts */
body.melvin-active.melvin-minimized .site.grid-container,
body.melvin-active.melvin-minimized #page,
body.melvin-active.melvin-minimized .site-header,
body.melvin-active.melvin-minimized .site-navigation,
body.melvin-active.melvin-minimized #site-navigation,
body.melvin-active.melvin-minimized .site-footer,
body.melvin-active.melvin-minimized #footer-widgets,
body.melvin-active.melvin-minimized .footer-widgets-container,
body.melvin-active.melvin-minimized .site-info,
body.melvin-active.melvin-minimized .elementor-section-stretched,
body.melvin-active.melvin-minimized .n2-ss-align,
body.melvin-active.melvin-minimized .n2-ss-slide-background-image,
body.melvin-active.melvin-minimized .n2-ss-section-main-content,
body.melvin-active.melvin-minimized [class*="n2-ss-layer-content"],
body.melvin-active.melvin-minimized .elementor-widget-wrap.elementor-element-populated {
    margin-right: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
    right: 0 !important;
}

/* Hide main sidebar when minimized */
body.melvin-active.melvin-minimized #melvin {
    transform: translateX(120%);
    opacity: 0;
    pointer-events: none;
}

/* Show toggle button when minimized */
body.melvin-active.melvin-minimized #melvin-toggle {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Toggle Button Styles (collapsed state) */
#melvin-toggle {
    position: fixed;
    right: 0px;
    top: 50%;
    transform: translateY(-50%) translateX(120%);
    width: 50px;
    height: 50px;
    background: #1e73be;
    color: white;
    border-radius: 50% 0 0 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
    font-size: 24px;
}

#melvin-toggle:hover {
    background: #155a8a;
    width: 55px;
    transform: translateY(-50%) translateX(-5px);
}

/* Smooth transition for sidebar */
#melvin {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Minimize button hover effect */
#minimize_button {
    margin-left: auto;
    background: #55555e !important;
}

#minimize_button:hover {
    transform: scale(1.1);
}
