/**
 * Wizard styles
 * Prefix: wiz-
 */

/* =============================================
   LAYOUT - Main container with transformation
   ============================================= */

.wiz-layout {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar mode - split layout */
.wiz-layout.wiz-sidebar-mode {
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
}

/* =============================================
   CONFIG BOX - Transforms from centered to sidebar
   ============================================= */

.wiz-box {
    width: 100%;
    max-width: 990px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar mode - nav pushes iframe, content overlays */
.wiz-layout.wiz-sidebar-mode .wiz-box {
    position: relative;
    max-width: 12rem;
    width: 12rem;
    height: 100vh;
    border-radius: 0;
    border-right: 1px solid #374151;
    border-left: 0;
    border-top: 0;
    border-bottom: 0;
    flex-shrink: 0;
    z-index: 20;
}

/* Content collapsed - same as normal (nav only) */
.wiz-layout.wiz-sidebar-mode.wiz-content-collapsed .wiz-box {
    width: 12rem;
    max-width: 12rem;
}

/* =============================================
   FIRST-CONFIG MODE - toolbar-content inline, not fixed
   Placed AFTER sidebar-mode rules for higher precedence
   ============================================= */

/* In first-config mode, wiz-box is wider to contain nav + content */
.wiz-layout.wiz-sidebar-mode.wiz-first-config .wiz-box {
    max-width: 34rem;
    width: 34rem;
    transition: margin-left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* In first-config mode, toolbar-content is inline (not fixed) */
.wiz-layout.wiz-sidebar-mode.wiz-first-config .toolbar-content {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    width: 22rem;
    flex-shrink: 0;
    border-right: none;
    box-shadow: none;
}

/* Panel hidden state - slide entire wiz-box left (margin-left handles both slide and space collapse) */
.wiz-layout.wiz-sidebar-mode.wiz-first-config.wiz-panel-hidden .wiz-box {
    margin-left: -34rem;
}

@media (max-height: 720px) {
    .wiz-box {
        height: 90vh;
    }
    .wiz-layout.wiz-sidebar-mode .wiz-box {
        height: 100vh;
    }
}

@media (max-height: 480px) {
    .wiz-box {
        height: 100vh;
        border-radius: 0;
    }
}

.wiz-box-header {
    flex-shrink: 0;
    transition: padding 0.3s ease;
}

.wiz-box-content {
    flex: 1;
    overflow-y: auto;
    transition: padding 0.3s ease;
}

.wiz-box-footer {
    flex-shrink: 0;
    transition: padding 0.3s ease;
}

.wiz-box-title {
    /* Title block wrapper */
}

.wiz-title {
    /* Main heading */
    transition: font-size 0.3s ease;
}

.wiz-subtitle {
    /* Secondary text under title */
}

.wiz-close {
    /* Close button */
}

/* =============================================
   IFRAME AREA - Hidden initially, shown in sidebar mode
   ============================================= */

.wiz-iframe-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateX(50px);
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar mode - iframe takes full width */
.wiz-layout.wiz-sidebar-mode .wiz-iframe-area {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    position: relative;
    width: 100%;
}

/* First config mode - iframe area fills remaining space naturally */
/* No padding needed since toolbar-content is inline in first-config mode */


.wiz-iframe-container {
    flex: 1;
    position: relative;
}

.wiz-iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* =============================================
   OVERLAYS (progress, error)
   ============================================= */

.wiz-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.wiz-overlay-fullscreen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.wiz-overlay-dark {
    background-color: rgba(17, 24, 39, 0.95);
}

.wiz-overlay-light {
    background: linear-gradient(to bottom right, #f9fafb, #f3f4f6);
}

/* =============================================
   ACCORDION PANELS
   ============================================= */

.wiz-accordion {
    border: 1px solid #374151;
    border-radius: 0.5rem;
    overflow: hidden;
}

.wiz-accordion-header {
    width: 100%;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    transition: background-color 0.15s;
}

.wiz-accordion-content {
    padding: 1rem;
}

/* =============================================
   TOOLBAR (Settings panel style)
   ============================================= */

.toolbar-layout {
    height: 100%;
    overflow-x: hidden;
}

.toolbar-nav {
    width: 12rem;
    flex-shrink: 0;
    position: relative;
    z-index: 40; /* Above toolbar-content so it slides under */
}

/* Headers for nav and content */
.toolbar-header,
.toolbar-content-header {
    height: 3rem;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Close button in content header */
.toolbar-close-btn {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    border: none;
    background: transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-close-btn:hover {
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.1);
}

.toolbar-close-btn svg {
    width: 1rem;
    height: 1rem;
}

.toolbar-header-icon {
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.toolbar-header-text {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

.toolbar-tabs {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.125rem;
}

.toolbar-divider {
    height: 1px;
    background: #374151;
    margin: 0.5rem 0.75rem;
}

.toolbar-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    color: #9ca3af;
    font-size: 0.8125rem;
    text-align: left;
    transition: all 0.15s ease;
    position: relative;
    border: none;
    background: transparent;
    border-radius: 0.375rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}

.toolbar-tab:hover {
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.05);
}

.toolbar-tab.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.15);
}

.toolbar-tab.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 2px;
    background: #3b82f6;
    border-radius: 1px;
}

.toolbar-tab svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.toolbar-tab.active svg {
    opacity: 1;
}

.toolbar-tab.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.toolbar-tab span {
    transition: opacity 0.2s ease;
}

/* Footers - fixed identical height */
.toolbar-nav-footer,
.toolbar-content-footer {
    flex-shrink: 0;
    height: 3.5rem;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    border-top: 1px solid #1f2937;
}

.toolbar-content-footer {
    background: #111827;
    padding: 0 0.75rem;
}

/* Toolbar content - default (creation mode, no iframe) */
.toolbar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #111827;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Toolbar content - sidebar mode (overlays iframe) */
.wiz-layout.wiz-sidebar-mode .toolbar-content {
    position: fixed;
    left: 12rem;
    top: 0;
    bottom: 0;
    width: 22rem;
    border-right: 1px solid #374151;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    z-index: 30;
}

/* Hidden toolbar content (only in sidebar mode) */
.wiz-layout.wiz-sidebar-mode .toolbar-content.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Elements only visible when NOT in first config mode */
.sidebar-only {
    display: flex !important;
}

.wiz-layout.wiz-first-config .sidebar-only {
    display: none !important;
}

/* Hide toolbar content close button in first config mode */
#close-toolbar-content {
    display: flex;
}

.wiz-layout.wiz-first-config #close-toolbar-content {
    display: none;
}

/* Scrollable panels area */
.toolbar-panels {
    flex: 1;
    overflow-y: auto;
}

.toolbar-panel {
    display: none;
}

.toolbar-panel.active {
    display: block;
}

.wiz-accordion-chevron {
    transition: transform 0.2s;
}

.wiz-accordion-chevron.rotate-180 {
    transform: rotate(180deg);
}

/* =============================================
   STRUCTURE PREVIEW PANEL
   ============================================= */

.structure-preview-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 18rem;
    background: #111827;
    border-right: 1px solid #374151;
    display: flex;
    flex-direction: column;
    z-index: 25;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.2s ease;
}

/* Default position: after toolbar-content (22rem from nav 12rem = 34rem) */
.structure-preview-panel {
    left: 34rem;
}

/* When visible */
.structure-preview-panel.visible {
    transform: translateX(0);
    opacity: 1;
}

/* Hidden state */
.structure-preview-panel.hidden {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

/* In sidebar mode - position after the fixed toolbar-content */
.wiz-layout.wiz-sidebar-mode .structure-preview-panel {
    left: 34rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

/* Before sidebar mode (wizard mode) - position after inline toolbar-content */
.wiz-layout:not(.wiz-sidebar-mode) .structure-preview-panel {
    position: absolute;
    left: 100%;
}

/* =============================================
   LEGACY CLASSES (for creation mode)
   ============================================= */

/* Centered layout - before iframe shown */
.wiz-centered {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Split layout - sidebar + iframe */
.wiz-split {
    height: 100vh;
    display: flex;
}

/* Sidebar (in split layout) */
.wiz-sidebar {
    width: 24rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.wiz-sidebar-header {
    flex-shrink: 0;
}

.wiz-sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.wiz-sidebar-footer {
    flex-shrink: 0;
}

/* =============================================
   PLACEHOLDER (Vanta.js background)
   ============================================= */

.wiz-placeholder-content {
    position: relative;
    z-index: 1;
}
