/* ============================================
   FLOATING PANELS & OVERLAYS
   ============================================ */

/* ============================================
   Cursor Position Overlay
   ============================================ */
#cursor-position {
    position: absolute;
    bottom: 220px;
    left: 10px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #4CAF50;
    transition: left 0.3s ease-in-out;
}

#cursor-position.shifted {
    right: 390px;
    left: auto;
}


/* ============================================
   Histogram Panel (Collapsible)
   ============================================ */
#histogram-panel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 300px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    border-radius: 4px;
    transition: left 0.3s ease-in-out, right 0.3s ease-in-out;
}

#histogram-panel.shifted {
    right: 390px;
    left: auto;
}

#histogram-panel.collapsed #histogram-body {
    display: none;
}

#histogram-header {
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

#histogram-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

#histogram-header h4 {
    margin: 0;
    font-size: 12px;
    color: #4CAF50;
    flex: 1;
}

#histogram-expand {
    font-size: 10px;
    color: #888;
}

#histogram-body {
    padding: 8px 12px;
    border-top: 1px solid #444;
}

#histogram-canvas {
    width: 100%;
    height: 120px;
    display: block;
}

#histogram-info {
    margin-top: 8px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #888;
}


/* ============================================
   Step Time Counter Overlay
   ============================================ */
#step-time-counter {
    position: absolute;
    bottom: 100px;
    right: 10px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: #FFA726;
}


/* ============================================
   FPS Counter Overlay
   ============================================ */
#fps-counter {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: #4CAF50;
}

#fps-counter .fps-display {
    margin-bottom: 6px;
}

#fps-counter .frame-limit-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-top: 6px;
}

#fps-counter .frame-limit-controls label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #aaa;
    font-weight: normal;
}

#fps-counter .frame-limit-controls input[type="checkbox"] {
    margin: 0;
}

#fps-counter .frame-limit-controls input[type="range"] {
    width: 100px;
    height: 4px;
}

#fps-counter .frame-limit-controls .range-value {
    color: #4CAF50;
    width: 50px;
    text-align: right;
    display: inline-block;
}


/* ============================================
   Animations
   ============================================ */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* ============================================
   Generic Panel Components
   ============================================ */
.panel-header {
    padding: 12px 16px;
    background: #252525;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.panel-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.panel-content {
    padding: 20px;
    max-height: calc(90vh - 117px); /* Account for menu bar + offset + header */
    overflow-y: auto;
}


/* ============================================
   Coordinate Editor Panel
   ============================================ */
.coordinate-editor-content {
    min-width: 400px;
}

.coordinate-variables {
    margin: 20px 0 15px 0;
}

.coordinate-variables > div:first-child {
    margin-bottom: 12px;
}

.coord-var-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.coord-var-label {
    width: 60px !important;
    flex-shrink: 0;
    text-align: center;
    font-weight: 500;
}

.coord-var-transform {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.coordinate-editor-buttons {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #444;
    display: flex;
    gap: 10px;
}

.coordinate-editor-buttons button {
    flex: 1;
    transition: all 0.2s;
}

.coordinate-editor-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.info-text {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.4;
    color: #999;
}


/* ============================================
   Modal Window & Tabs
   ============================================ */
#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 10px;
}

#modal-window {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    max-width: none;
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #252525;
    border-bottom: 1px solid #444;
}

#modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

#modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

#modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#modal-tab-bar {
    display: flex;
    gap: 0;
    background: #1f1f1f;
    border-bottom: 1px solid #444;
    overflow-x: auto;
}

.modal-tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.modal-tab-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.modal-tab-button.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}


/* ============================================
   Documentation Tab Styles
   ============================================ */
.docs-container {
    max-width: 1200px;
    margin: 0 auto;
}

.docs-section {
    margin-bottom: 16px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #1f1f1f;
    overflow: hidden;
}

.docs-section-header {
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252525;
    transition: background 0.2s;
}

.docs-section-header:hover {
    background: #2a2a2a;
}

.docs-section-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #4CAF50;
}

.docs-toggle {
    color: #888;
    font-size: 12px;
    transition: transform 0.2s;
}

.docs-section.collapsed .docs-toggle {
    transform: rotate(-90deg);
}

.docs-section-content {
    padding: 20px 32px;
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    line-height: 1.6;
}

.docs-section.collapsed .docs-section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.docs-section-content p {
    margin: 0 0 10px 0;
    color: #ccc;
    font-size: 12px;
}

.docs-section-content h5 {
    margin: 16px 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #4CAF50;
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
}

.docs-section-content h5:first-child {
    margin-top: 0;
}

.docs-section-content code {
    background: #2a2a2a;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #4CAF50;
}

.code-example {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.6;
}

.code-example strong {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
