/* Struckdown Playground Styles */

/* Remove default container padding for full-width layout */
.container-fluid {
    padding-left: 0;
    padding-right: 0;
}

/* Keep padding on navbar content */
.navbar .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Top navbar - compact and dark */
#top-navbar {
    background-color: #1a1a1a;
    min-height: 32px;
    position: relative;
    z-index: 1050;
}

#top-navbar .navbar-brand {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Inputs Strip (left edge trigger) */
#inputs-strip {
    position: fixed;
    left: 0;
    top: 32px;
    bottom: 0;
    width: 28px;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    z-index: 1040;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20px;
    transition: left 0.3s ease;
    border-right: 1px solid #dee2e6;
}

#inputs-strip:hover {
    background: #e9ecef;
    color: #495057;
}

#inputs-strip.offcanvas-open {
    left: 320px;
}

.inputs-strip-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Inputs offcanvas */
#inputs-offcanvas {
    width: 320px;
    top: 32px;
    height: calc(100% - 32px);
}

/* Input textareas full width in offcanvas */
#inputs-offcanvas .input-field {
    width: 100%;
}

/* Main container offset for side strips */
.container-fluid.vh-100 {
    padding-left: 28px;
    padding-right: 28px;
}

/* But navbar should span full width */
#top-navbar.navbar {
    margin-left: -28px;
    margin-right: -28px;
    width: calc(100% + 56px);
}

/* Panel headers (Editor/Outputs) */
.panel-header {
    height: 50px;
    min-height: 50px;
}

/* Dirty indicator dot */
.dirty-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #ffc107;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
}

/* Editor container */
#editor-container {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

#editor-container .cm-editor {
    height: 100%;
}

#editor-container .cm-scroller {
    overflow: auto;
}

/* Output cards */
.output-card {
    transition: box-shadow 0.2s;
}

.output-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.output-card .slot-name {
    font-weight: 600;
    font-size: 0.9em;
}

.output-card .output-value {
    font-size: 0.95em;
    white-space: pre-wrap;
    word-break: break-word;
    /* 75% of outputs panel so user can always see if there's another card */
    max-height: calc(0.75 * (100vh - 112px));
    overflow-y: auto;
}

.output-card.pinned {
    border-color: #0d6efd;
    border-width: 2px;
    order: -1;
}

.output-card-pending {
    opacity: 0.7;
    background-color: #f8f9fa;
}

.output-card-skipped {
    opacity: 0.5;
    background-color: #f8f9fa;
}

.output-card-skipped .card-body {
    font-style: italic;
}

/* Pin button */
.pin-btn {
    color: #adb5bd;
    padding: 0.15rem 0.35rem;
    line-height: 1;
    border: none;
    background: transparent;
}

.pin-btn:hover {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.1);
}

.pin-btn.active,
.pin-btn:active {
    color: #0d6efd;
}

.output-card.pinned .slot-name {
    color: #0d6efd;
}

/* Error banner */
#error-banner.show {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
}

/* Panels */
#inputs-container {
    overflow-y: auto;
}

/* Independent scrolling panels (iframe-like behaviour) */
html, body {
    overflow: hidden;
    height: 100%;
}

/* Main content row - fill viewport minus navbar and status bar */
.row.flex-grow-1 {
    height: calc(100vh - 32px - 30px);
}

/* Both columns fill full height of row */
#editor-column,
#outputs-column {
    height: 100%;
}

/* Editor content area */
#editor-column > .flex-grow-1 {
    height: calc(100% - 50px);
    overflow: hidden;
}

/* Outputs content area */
#outputs-container {
    height: calc(100% - 50px);
    overflow-y: auto;
}

/* Batch table */
#batch-table {
    font-size: 0.85em;
}

#batch-table th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

#batch-table td {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#batch-table td:hover {
    white-space: normal;
    word-break: break-word;
}

.batch-cell-input {
    background-color: #f8f9fa;
}

.batch-cell-output {
    background-color: #fff;
}

.batch-cell-pending {
    color: #6c757d;
    font-style: italic;
}

.batch-cell-error {
    color: #dc3545;
}

.batch-cell-streaming {
    background-color: #e8f4fd;
}

.batch-cell-updated {
    animation: cell-flash 0.3s ease-out;
}

@keyframes cell-flash {
    0% { background-color: #b8daff; }
    100% { background-color: inherit; }
}

/* Column toggles */
#column-toggles .form-check {
    margin-right: 0;
}

#column-toggles .form-check-input {
    margin-top: 0.2em;
}

#column-toggles .form-check-label {
    font-size: 0.8em;
    padding: 0.1em 0.4em;
    border-radius: 3px;
}

#column-toggles .form-check-label.col-input {
    background-color: #e9ecef;
}

#column-toggles .form-check-label.col-output {
    background-color: #d1e7dd;
}

/* Status bar */
.status-running {
    color: #0d6efd;
}

.status-error {
    color: #dc3545;
}

.status-success {
    color: #198754;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #editor-column,
    #outputs-column {
        height: 50vh;
    }

    .row.flex-grow-1 {
        flex-direction: column;
    }
}

/* Cost display */
#cost-display {
    font-family: 'SF Mono', monospace;
}

/* Input fields */
.input-field {
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

/* Missing/required input highlighting */
.input-missing label {
    color: #dc3545;
    font-weight: 600;
}

.input-missing .input-field {
    border: 1px solid #dc3545 !important;
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.25);
}

.input-missing .input-field:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.required-indicator {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.85em;
}

/* File browser */
#file-list .list-group-item {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

#file-list .list-group-item.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

#new-file-name {
    font-family: 'SF Mono', monospace;
    font-size: 0.85rem;
}

/* Settings panel inputs */
#panel-settings input[type="text"],
#panel-settings input[type="password"],
#panel-settings input[type="url"],
#settings-offcanvas input[type="text"],
#settings-offcanvas input[type="password"],
#settings-offcanvas input[type="url"] {
    font-family: 'SF Mono', monospace;
    font-size: 0.85em;
}

/* Setup hint alert */
#setup-hint-alert {
    font-size: 0.9rem;
}

#setup-hint-alert i {
    margin-right: 0.25rem;
}

/* Settings panel missing fields highlight */
#settings-offcanvas .input-missing label {
    color: #dc3545;
    font-weight: 600;
}

#settings-offcanvas .input-missing input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.25);
}

#settings-offcanvas .input-missing input:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Right side strip (single strip for Settings/Help panel) */
#right-strip {
    position: fixed;
    right: 0;
    top: 32px;
    bottom: 0;
    width: 28px;
    background: #f8f9fa;
    color: #6c757d;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    gap: 20px;
    transition: right 0.3s ease;
    border-left: 1px solid #dee2e6;
}

#right-strip.offcanvas-open {
    right: 340px;
}

.right-strip-link {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 3px;
}

.right-strip-link:hover {
    background: #e9ecef;
    color: #495057;
}

/* Right offcanvas panels */
#settings-offcanvas,
#help-offcanvas {
    width: 340px;
    top: 32px;
    height: calc(100% - 32px);
}

.cheatsheet-table {
    font-size: 0.85rem;
}

.cheatsheet-table td:first-child {
    white-space: nowrap;
    width: 1%;
}

.cheatsheet-table code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Keyboard shortcuts styling */
kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    color: #495057;
    font-family: 'SF Mono', monospace;
    font-size: 0.75em;
    padding: 2px 6px;
}

/* Cheatsheet examples */
.cheatsheet-example {
    margin-bottom: 12px;
}

.example-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 4px;
}

.example-code {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 0.8rem;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
