/**
 * Module: Interactive Guide
 * Description: Styling for the shortcode UI using WP Preset colors.
 */

.vortex-guide-container {
    --guide-bg: var(--wp--preset--color--accent-1, #1e1e1e);
    --guide-text: var(--wp--preset--color--accent-3, #ffffff); 
    --guide-border: var(--wp--preset--color--custom-gris, #333333); 
    --guide-panel-bg: var(--wp--preset--color--accent-2, #141414);
    --guide-accent: var(--wp--preset--color--accent-5, #8526ff);
    --guide-warning: var(--wp--preset--color--custom-rojo, #ff4c4c);
    
    font-family: inherit;
    color: var(--guide-text);
    background: var(--guide-bg);
    border-radius: 8px;
    padding: 24px;
    max-width: 900px;
    margin: 0 auto 40px auto;
}

/* 1. Controls & Selectors */
.vortex-guide-controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--guide-border);
}

.vortex-guide-control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.vortex-guide-control-group.is-centered {
    align-items: center;
    text-align: center;
}

.vortex-guide-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--guide-text);
}

/* 2. Button Groups */
.vortex-guide-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.vortex-guide-btn {
    background: transparent;
    color: var(--guide-text);
    border: 1px solid var(--guide-accent);
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vortex-guide-btn:hover {
    opacity: 0.8;
}

.vortex-guide-btn.is-selected {
    background: var(--guide-accent);
    color: var(--guide-bg);
    border-color: var(--guide-accent);
    font-weight: 600;
    opacity: 1;
}

/* 3. Custom Dropdown */
.vortex-custom-select {
    position: relative;
    width: 250px;
    max-width: 100%;
    user-select: none;
}

.vortex-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--guide-panel-bg);
    border: 1px solid var(--guide-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.vortex-select-trigger:hover {
    border-color: var(--guide-accent);
}

.vortex-select-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.vortex-custom-select.is-open .vortex-select-arrow {
    transform: rotate(180deg);
}

.vortex-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--guide-panel-bg);
    border: 1px solid var(--guide-border);
    border-radius: 6px;
    margin: 6px 0 0 0;
    list-style: none;
    padding: 0;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    max-height: 250px;
    overflow-y: auto;
}

.vortex-custom-select.is-open .vortex-select-options {
    display: block;
    animation: fadeIn 0.2s ease forwards;
}

.vortex-select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.vortex-select-option:hover {
    background: var(--guide-bg);
}

.vortex-select-option.is-selected {
    font-weight: 700;
    color: var(--guide-accent);
    background: var(--guide-bg);
}

/* 4. Panel State Management & Animations */
.vortex-guide-panel,
.vortex-guide-lang-block,
.vortex-guide-control-group.is-hidden {
    display: none;
}

.vortex-guide-panel.is-active,
.vortex-guide-lang-block.is-active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 5. Guide Content Layout (Main Steps) */
.vortex-guide-title {
    color: var(--guide-accent);
    margin-bottom: 24px;
    font-size: 1.8rem;
}

.vortex-guide-step {
    background: var(--guide-panel-bg);
    border: 1px solid var(--guide-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
}

.vortex-guide-step-badge {
    display: inline-block;
    background: var(--guide-border);
    color: var(--guide-text);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.vortex-guide-step-title {
    margin: 0 0 12px 0;
    font-size: 1.3rem;
}

.vortex-guide-note {
    background: var(--guide-bg);
    border-left: 4px solid var(--guide-accent);
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 4px 4px 0;
}

.vortex-guide-note.has-warning {
    border-left-color: var(--guide-warning);
}

/* Responsive Image Scaling powered by dynamic CSS variables */
.vortex-guide-img {
    width: var(--vg-img-pc, 100%);
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-top: 16px;
    border: 1px solid var(--guide-border);
    transition: filter 0.2s ease;
}

@media (max-width: 1024px) {
    .vortex-guide-img { width: var(--vg-img-lap, 100%); }
}
@media (max-width: 768px) {
    .vortex-guide-img { width: var(--vg-img-tab, 100%); }
}
@media (max-width: 480px) {
    .vortex-guide-img { width: var(--vg-img-mob, 100%); }
}

.vortex-guide-img:hover {
    filter: brightness(1.1);
}

/* Download / Action Button */
.vortex-guide-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--guide-accent);
    color: #ffffff; /* Explicitly hardcoded to contrast nicely against vivid accents */
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.vortex-guide-action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #ffffff;
}

/* 6. Rich Text Formats (Lists & Line Breaks) */
.vortex-guide-text p,
.vortex-guide-note p {
    margin-top: 0;
    margin-bottom: 12px;
}

.vortex-guide-text p:last-child,
.vortex-guide-note p:last-child {
    margin-bottom: 0;
}

.vortex-guide-step ul,
.vortex-guide-step ol,
.vortex-guide-substep ul,
.vortex-guide-substep ol,
.vortex-guide-substep--seamless ul,
.vortex-guide-substep--seamless ol {
    margin: 10px 0 14px 24px;
    padding: 0;
}

.vortex-guide-step ul,
.vortex-guide-substep ul,
.vortex-guide-substep--seamless ul {
    list-style-type: disc;
}

.vortex-guide-step ol,
.vortex-guide-substep ol,
.vortex-guide-substep--seamless ol {
    list-style-type: decimal;
}

.vortex-guide-step li,
.vortex-guide-substep li,
.vortex-guide-substep--seamless li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* 7. Substeps (Inside Steps) Layout */
.vortex-guide-substeps-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vortex-guide-substep {
    background: var(--guide-bg);
    border: 1px solid var(--guide-border);
    border-radius: 6px;
    padding: 16px;
}

.vortex-guide-substep-title {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--guide-text);
}

.vortex-guide-substep--seamless {
    background: transparent;
    border: none;
    padding: 0;
}

.vortex-guide-substep--seamless .vortex-guide-text {
    margin-bottom: 0;
}

/* 8. Indentation Line */
.vortex-guide-substep.is-indented,
.vortex-guide-substep--seamless.is-indented {
    padding-left: 20px;
    border-left: 2px solid var(--guide-border);
}

.vortex-guide-substep.is-indented {
    border-radius: 0 6px 6px 0;
}

/* 9. Lightbox (Image Zoom Feature) */
#vg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
}

#vg-lightbox.is-active {
    opacity: 1;
    pointer-events: auto;
}

.vg-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    cursor: zoom-out;
}

.vg-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.vg-lightbox-close:hover {
    opacity: 1;
}

.vg-lightbox-scroll-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vg-lightbox-img {
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 90vh; 
    max-width: 90vw;
    object-fit: contain;
    cursor: zoom-in;
    transition: all 0.3s ease;
    margin: auto;
}

.vg-lightbox-img.is-zoomed {
    max-height: none; 
    max-width: none;  
    cursor: zoom-out;
}

/* 10. CSS Grid Layout Engine Updates */
.vortex-guide-grid {
    display: grid;
    grid-template-columns: repeat(var(--vg-cols, 1), 1fr);
    gap: 20px;
    width: 100%;
}

.vortex-guide-grid-col {
    grid-column: span var(--vg-col-span, 1);
    display: grid;
    grid-template-rows: repeat(var(--vg-rows, 1), 1fr);
    gap: 16px;
    width: 100%;
}

.vortex-guide-grid-cell {
    grid-row: span var(--vg-row-span, 1);
    min-width: 0;
}

.vortex-guide-grid-cell.is-indented {
    padding-left: 20px;
    border-left: 2px solid var(--guide-border);
    border-radius: 0 6px 6px 0;
}

.vortex-guide-grid-cell .vortex-guide-step-title,
.vortex-guide-grid-cell .vortex-guide-substep-title {
    margin-top: 0;
}

.vortex-guide-grid-cell .vortex-guide-img {
    margin-top: 0;
}

/* Mobile Responsiveness Override */
@media (max-width: 768px) {
    .vortex-guide-grid {
        grid-template-columns: 1fr !important;
        gap: 15px; 
    }
    
    .vortex-guide-grid-col {
        grid-column: span 1 !important;
        grid-template-rows: auto !important;
    }

    .vortex-guide-grid-cell {
        grid-row: span 1 !important;
    }
}

/* 11. Custom Dividers / Headings */
.vortex-guide-divider {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--guide-text);
    margin: 32px 0 16px 0;
    line-height: 1.3;
}
