/* RoadScript - Roadmap Playground Styles */

html, body, #app {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Container */
.container-fluid {
    display: flex;
    height: 100vh;
}

/* Control Center panel styling */
.control-panel {
    background: #1e1e1e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #333;
    transition: width 0.3s ease;
}

/* Control panel expanded state */
.control-panel-expanded {
    width: 22%;
    min-width: 320px;
    max-width: 420px;
    border-right: 1px solid #333;
}

/* Control panel collapsed state */
.control-panel-collapsed {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    align-items: center;
    padding: 0;
    position: relative;
}

/* Command Center icon buttons */
.cc-icon-btn {
    transition: all 0.2s ease;
}

.cc-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
    filter: brightness(1.1);
}

.cc-icon-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3) !important;
}

/* Monaco editor container - CRITICAL for proper rendering */
.monaco-editor-container,
.monaco-editor,
.overflow-guard {
    height: 100% !important;
    width: 100% !important;
}

/* Ensure editor fills its container */
#roadscript-json-editor {
    height: 100% !important;
    width: 100% !important;
}

/* Fix for Monaco editor height calculation */
.h-100 {
    height: 100% !important;
}

/* Preview pane */
.preview-pane {
    background: #e8eaed;
    overflow: auto;
}

/* Roadmap container - ensures proper scaling */
.roadmap {
    box-sizing: border-box;
}

    .roadmap * {
        box-sizing: border-box;
    }

    /* Smooth transitions for live preview */
    .roadmap h1,
    .roadmap h4,
    .roadmap p,
    .roadmap span,
    .roadmap div {
        transition: all 0.15s ease;
    }

/* History bar striped pattern fallback */
@supports not (background: repeating-linear-gradient(90deg, #000 0px, #000 3px, transparent 3px, transparent 6px)) {
    .history-past {
        opacity: 0.3 !important;
    }
}

/* Ensure milestone diamonds render correctly */
.milestone-diamond {
    box-sizing: border-box;
}

/* Loading indicator */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* Print/export friendly styles */
@media print {
    .control-panel {
        display: none !important;
    }

    .preview-pane {
        width: 100% !important;
        padding: 0 !important;
        background: white !important;
    }

    .roadmap {
        max-width: none !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* Mid-size screens (Surface Pro 9 @ 2880x1920 and similar tablets/smaller desktops) */
@media (min-width: 1201px) and (max-width: 1650px) {
    /* ========== MAXIMIZE SPACE - Reduce all padding/margins ========== */

    /* Wrapper padding */
    .preview-pane > div {
        padding: 10px !important;
    }

    /* Container padding - tight but breathable */
    .roadmap-container {
        padding: 16px 22px !important;
    }

    /* ========== TYPOGRAPHY SCALE - Proportional to desktop ========== */

    /* Title: 36px → 30px (-17%) */
    .roadmap h1 {
        font-size: 30px !important;
        letter-spacing: -0.4px !important;
        line-height: 1.2 !important;
    }

    /* Subtitle: 16px → 14px (-13%) */
    .roadmap > div:first-child > p {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }

    /* Column labels: 20px → 17px (-15%) */
    .roadmap > div > div:last-child > div:first-child > div span:first-child {
        font-size: 17px !important;
        line-height: 1.3 !important;
    }

    /* Column subs: 13px → 11px (-15%) */
    .roadmap > div > div:last-child > div:first-child > div span:last-child {
        font-size: 11px !important;
        line-height: 1.4 !important;
    }

    /* Lane titles: 16px → 14px (-13%) */
    .roadmap > div > div:first-child span {
        font-size: 14px !important;
        line-height: 1.3 !important;
    }

    /* Item titles: 22px → 19px (-14%) */
    .roadmap h4 {
        font-size: 19px !important;
        margin-bottom: 7px !important;
        line-height: 1.25 !important;
    }

    /* Detail text: 18px → 16px (-11%) */
    .roadmap ul li > div {
        font-size: 16px !important;
        line-height: 1.5 !important;
        padding-left: 14px !important;
    }

    /* Sub-bullets: 15px → 13px (-13%) */
    .roadmap ul li ul li {
        font-size: 13px !important;
        line-height: 1.5 !important;
        padding-left: 20px !important;
    }

    /* Milestone labels: 15px → 13px (-13%) */
    .roadmap > div > div:last-child > div:nth-child(2) span {
        font-size: 13px !important;
        line-height: 1.3 !important;
        padding: 3px 8px !important;
    }

    /* ========== LAYOUT OPTIMIZATION ========== */

    /* Title container spacing */
    .roadmap > div:first-child {
        margin-bottom: 12px !important;
        padding: 5px 8px !important;
    }

    /* Lane label area - narrower for more timeline space */
    .roadmap > div > div:first-child {
        width: 150px !important;
        padding-right: 10px !important;
        padding-top: 44px !important;
    }

    /* Column header height: 48px → 44px */
    .roadmap > div > div:last-child > div:first-child {
        height: 44px !important;
    }

    /* Milestone row height: 40px → 36px */
    .roadmap > div > div:last-child > div:nth-child(2) {
        height: 36px !important;
    }

    /* Item card padding: 12/16px → 10/14px */
    .roadmap > div > div:last-child > div:last-child > div > div {
        padding: 10px 14px !important;
    }

    /* Completed badge: 26px → 23px */
    .roadmap > div > div:last-child > div:last-child > div > div > div > div:last-child {
        width: 23px !important;
        height: 23px !important;
        font-size: 13px !important;
    }

    /* ========== PANEL WIDTHS ========== */

    /* Control Center panel - narrower for more preview (only when expanded) */
    .control-panel-expanded {
        width: 19% !important;
        min-width: 290px !important;
        max-width: 350px !important;
    }

    /* Keep collapsed state narrow on mid-size screens too */
    .control-panel-collapsed {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
    }

    /* Property panel - narrower */
    .property-panel {
        width: 270px !important;
        min-width: 270px !important;
        max-width: 320px !important;
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1200px) {
    .container-fluid {
        flex-direction: column !important;
    }

    .control-panel {
        width: 100% !important;
        height: 40% !important;
        border-right: none !important;
        border-bottom: 1px solid #333 !important;
    }

    .preview-pane {
        width: 100% !important;
        height: 60% !important;
    }
}

/* Scrollbar styling for preview pane */
.preview-pane::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.preview-pane::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.preview-pane::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

    .preview-pane::-webkit-scrollbar-thumb:hover {
        background: #a1a1a1;
    }

/* Button hover states (fallback for inline styles) */
button:disabled {
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* Monaco editor specific fixes */
.monaco-editor .margin,
.monaco-editor .monaco-editor-background {
    background-color: #1e1e1e !important;
}

/* ========== INTERACTIVE EDITING FEATURES ========== */

/* Clickable roadmap elements */
.clickable-element {
    cursor: pointer;
    transition: all 0.2s ease;
}

.clickable-element:hover {
    filter: brightness(1.1);
    transform: scale(1.01);
}

/* Selection highlight */
.selected-element {
    outline: 3px solid #667eea !important;
    outline-offset: 2px;
    z-index: 100 !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3) !important;
}

/* Property Panel */
.property-panel {
    width: 320px;
    min-width: 320px;
    max-width: 400px;
    background: #1e1e2f;
    border-left: 1px solid #3a3a4e;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

/* Property Editor Form Styles */
.property-editor {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Controls */
.form-control {
    background: #2a2a3e;
    border: 1px solid #3a3a4e;
    color: #e0e7ff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-control::placeholder {
    color: #555;
}

/* Range Slider */
.form-range,
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #3a3a4e;
    border-radius: 3px;
    outline: none;
}

.form-range::-webkit-slider-thumb,
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.form-range::-moz-range-thumb,
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #667eea;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: none;
}

/* Color Picker */
input[type="color"] {
    width: 50px;
    height: 36px;
    border: 1px solid #3a3a4e;
    border-radius: 4px;
    cursor: pointer;
    background: #2a2a3e;
    padding: 2px;
}

/* Buttons */
.btn-add {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

.btn-add:hover {
    background: #5568d3;
}

.btn-remove {
    background: #ef4444;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.btn-remove:hover {
    background: #dc2626;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    transition: background 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Detail Item */
.detail-item {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.detail-item .form-control {
    flex: 1;
}

/* Responsive - Property Panel */
@media (max-width: 1400px) {
    .property-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        box-shadow: -4px 0 12px rgba(0,0,0,0.3);
        transform: translateX(0);
    }

    .property-panel:not(:has(.selected-element)) {
        transform: translateX(100%);
    }
}

/* Scrollbar for Property Panel */
.property-panel::-webkit-scrollbar {
    width: 6px;
}

.property-panel::-webkit-scrollbar-track {
    background: #1e1e2f;
}

.property-panel::-webkit-scrollbar-thumb {
    background: #3a3a4e;
    border-radius: 3px;
}

.property-panel::-webkit-scrollbar-thumb:hover {
    background: #4a4a5e;
}
