/* HoloBaby / InfantSim Styles */

/* Color Palette */
:root {
    --primary-maroon: #C44555;
    --secondary-teal: #4A8BA8;
    --accent-orange: #E67E3C;
    --dark-gray: #2a2a2a;
    --light-gray: #f5f5f5;
}

/* Layout */
.holobaby-layout {
    position: fixed;
    top: 64px; /* Height of MatAppBar header */
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 18px; /* VR-FRIENDLY: Increased from default 16px for better readability in VR */
}

.main-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.mode-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

/* WebGL Persistence Layer Architecture (Phase 8)
   Background: CenterPanel iframe persists across mode switches (D-01)
   Foreground: Mode components overlay with transparent center gap (D-02) */

.webgl-background-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: grid;
    grid-template-columns: 250px 40px 1fr 40px 300px;
    pointer-events: none;
}

.webgl-background-layer .center-panel {
    grid-column: 3;
    pointer-events: auto;
}

.mode-foreground-layer {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    pointer-events: none;
}

/* Transparent gap where WebGL shows through in mode layouts (D-02) */
.center-panel-gap {
    background-color: transparent;
    pointer-events: none;
}

/* Allow input to pass through foreground grid to WebGL background layer */
.mode-foreground-layer .three-panel-layout {
    pointer-events: none;
}

.mode-foreground-layer .left-panel,
.mode-foreground-layer .right-panel,
.mode-foreground-layer .vertical-tab-indicator {
    pointer-events: auto;
}

/* Mode Selector Container */
.mode-selector-container {
    display: flex;
    flex-direction: row;
    background-color: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* Mode Buttons */
.mode-buttons {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0;
    width: 100%;
    background-color: transparent;
    border-radius: 0;
}

/* Scenario Status Bar */
.scenario-status {
    padding: 0.75rem 1rem;
    background-color: #f5f5f5;
    text-align: center;
    border-radius: 0 0 8px 8px;
    border-top: 1px solid #ddd;
}

.scenario-name {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background-color: #6d1f2a;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    font-size: 1.1rem; /* VR-FRIENDLY: Larger button text */
    min-height: 48px; /* VR-FRIENDLY: Larger touch targets */
}

.mode-btn:hover:not(:disabled) {
    background-color: #8a2936;
}

.mode-btn.active {
    background-color: var(--primary-maroon);
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Three Panel Layout */
.three-panel-layout {
    display: grid;
    grid-template-columns: 250px 40px 1fr 40px 300px;
    /* left-panel | left-tab | center | right-tab | right-panel */
    height: 100%;
    gap: 0;
    background-color: transparent;
    overflow: hidden;
}

/* Panels */
.left-panel,
.center-panel,
.right-panel {
    background-color: white;
    overflow-y: auto;
}

.left-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-x: hidden;
}

.center-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgb(250, 250, 255); /* Match deck-service preview background */
    overflow: hidden; /* Prevent scrollbars */
}

.center-panel iframe {
    border: none;
    width: 100%;
    height: 100%;
}

.right-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-x: hidden;
}

/* Tab Headers */
.tab-headers {
    display: none; /* Hidden in favor of vertical tab indicators */
    border-bottom: 2px solid #ddd;
}

.tab-headers.vertical {
    display: none; /* Hidden in favor of vertical tab indicators */
    flex-direction: column;
    border-bottom: none;
    border-right: 2px solid #ddd;
    width: 80px;
}

.tab-header {
    flex: 1;
    padding: 0.75rem 1rem;
    background-color: #f0f0f0;
    border: none;
    border-right: 1px solid #ddd;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    font-size: 1.1rem; /* VR-FRIENDLY: Larger tab text */
}

.tab-headers.vertical .tab-header {
    border-right: none;
    border-bottom: 1px solid #ddd;
    text-align: left;
    padding: 1rem 0.5rem;
    font-size: 0.9rem;
}

.tab-header:hover {
    background-color: #e0e0e0;
}

.tab-header.active {
    background-color: white;
    border-bottom: 2px solid var(--secondary-teal);
}

.tab-headers.vertical .tab-header.active {
    background-color: white;
    border-bottom: 1px solid #ddd;
    border-right: 2px solid var(--secondary-teal);
}

.tab-content {
    flex: 1;
    width: 100%;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Scenario Name Header - shown above tabs
   Design: Teal background with white text for high visibility and brand consistency
   Always visible regardless of active tab (OPEN/SAVE or STATES)
   Positioned above tab headers to provide constant context awareness */
.scenario-name-header {
    padding: 1rem;
    background-color: var(--secondary-teal);
    border-bottom: 2px solid #2d6b80;
}

.scenario-name-display {
    margin: 0;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Left Panel - Scenario Tab */
.scenario-tab {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* DEPRECATED: .scenario-info - replaced by .scenario-name-display */
.scenario-info {
    padding: 0.5rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow: hidden;
}

/* Left Panel - States Tab */
.states-tab {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.states-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.state-btn {
    padding: 0.75rem 1.5rem; /* VR-FRIENDLY: More padding */
    border: 2px solid #ddd;
    background-color: white;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.1rem; /* VR-FRIENDLY: Larger text */
    min-height: 48px; /* VR-FRIENDLY: Larger touch targets */
}

.state-btn:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

.state-btn.selected {
    background-color: var(--secondary-teal);
    color: white;
    border-color: var(--secondary-teal);
}

.state-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

/* Action Buttons */
.action-btn {
    padding: 0.75rem 1.5rem; /* VR-FRIENDLY: More padding */
    border: none;
    border-radius: 0;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 1.1rem; /* VR-FRIENDLY: Larger button text */
    min-height: 48px; /* VR-FRIENDLY: Larger touch targets */
}

.action-btn.new {
    background-color: var(--accent-orange);
    color: white;
}

.action-btn.new:hover {
    background-color: #d46e2c;
}

.action-btn.open {
    background-color: var(--accent-orange);
    color: white;
}

.action-btn.open:hover {
    background-color: #d46e2c;
}

.action-btn.save {
    background-color: var(--accent-orange);
    color: white;
}

.action-btn.save:hover {
    background-color: #d46e2c;
}

.action-btn.delete {
    background-color: var(--primary-maroon);
    color: white;
}

.action-btn.delete:hover {
    background-color: #a33545;
}

.action-btn.add {
    background-color: var(--accent-orange);
    color: white;
}

.action-btn.add:hover {
    background-color: #d46e2c;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Right Panel - Parameter Editors */
.settings-editor,
.parameters-editor,
.setup-editor,
.present-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.param-section {
    margin-bottom: 1.5rem; /* VR-FRIENDLY: Increased spacing */
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e0e0e0; /* Slightly thicker divider */
    max-width: 100%;
    overflow: hidden;
}

.param-section:last-child {
    border-bottom: none; /* Remove divider from last section */
}

/* Disabled section styling for Phase 2+ features */
.param-section.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.param-section.disabled h4::after {
    content: " (Phase 2+)";
    font-size: 0.85rem; /* VR-FRIENDLY: Increased from 0.7rem */
    font-style: italic;
    text-transform: none;
}

.param-section label {
    display: block;
    margin-bottom: 0.5rem; /* VR-FRIENDLY: Increased spacing */
    font-weight: 600; /* VR-FRIENDLY: Bolder for better visibility */
    font-size: 1.1rem; /* VR-FRIENDLY: Increased from 0.9rem for VR */
    word-wrap: break-word;
}

.param-section input[type="range"],
.param-section input[type="number"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0.5rem 0;
    font-size: 1.1rem; /* VR-FRIENDLY: Larger input text */
    padding: 0.5rem; /* VR-FRIENDLY: More padding for easier interaction */
}

.param-section input[type="text"],
.param-section select {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1.1rem; /* VR-FRIENDLY: Larger text */
}

.param-section input[type="checkbox"] {
    margin-right: 0.5rem;
}

h4 {
    background-color: var(--secondary-teal);
    color: white;
    padding: 0.75rem 1rem;
    margin: 1rem -1rem 0.75rem -1rem; /* VR-FRIENDLY: Improved spacing */
    text-transform: uppercase;
    font-weight: 600;
    font-size: 1.2rem; /* VR-FRIENDLY: Increased from 0.95rem for VR readability */
    border-bottom: none;
}

/* Slider Controls Container */
.slider-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.slider-control input[type="range"] {
    flex: 1;
    margin: 0;
}

/* Fine Control Arrow Buttons */
.fine-control-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    border: 2px solid #ddd;
    background-color: white;
    color: var(--dark-gray);
    font-weight: 600;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    flex-shrink: 0;
}

.fine-control-btn:hover:not(:disabled) {
    background-color: #f5f5f5;
    border-color: #999;
}

.fine-control-btn:active:not(:disabled) {
    background-color: var(--secondary-teal);
    color: white;
    border-color: var(--secondary-teal);
}

.fine-control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: #fafafa;
}

/* Equipment Toggles */
.equipment-toggle {
    padding: 0.5rem;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
    max-width: 100%;
}

.equipment-toggle label {
    word-wrap: break-word;
    display: block;
}

/* Equipment section dimming when holograms hidden (Phase 1: Present Mode Toggle) */
.equipment-section-dimmed {
    opacity: 0.5;
    transition: opacity 0.2s ease-in-out;
}

.setup-instructions {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-left: 4px solid var(--secondary-teal);
    font-style: italic;
}

/* Center Panel - WebGL placeholder styles removed (now using iframe) */

/* Startup Message */
.startup-message {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 1.2rem;
    color: #666;
}

/* Debrief Placeholder */
.debrief-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.placeholder-content {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.placeholder-content h2 {
    color: #333;
    margin-bottom: 1rem;
}

.placeholder-content ul {
    text-align: left;
    line-height: 1.8;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: auto; /* Block all input behind modal */
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 400px;
    max-width: 600px;
    pointer-events: auto; /* Ensure modal content is interactive */
}

.modal-content.large {
    min-width: 600px;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #ddd;
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-confirm,
.btn-cancel {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
}

.btn-confirm {
    background-color: var(--accent-orange);
    color: white;
}

.btn-confirm:hover {
    background-color: #d46e2c;
}

.btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
}

.btn-cancel:hover {
    background-color: #5a6268;
}

/* Startup Modal - Initial user choice dialog
   Design: Large prominent buttons for touch/VR interaction
   Orange buttons match app accent color scheme
   Displayed on app launch before any scenario is created or loaded */
.startup-modal {
    min-width: 600px;
}

.startup-modal h2 {
    font-size: 2rem;
    text-align: center;
    color: var(--secondary-teal);
    margin: 0;
}

.startup-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    padding: 3rem 2rem;
}

.startup-btn {
    width: 220px;
    height: 160px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 0; /* Match action buttons - no rounded corners */
    cursor: pointer;
    color: white;
    transition: background-color 0.2s;
    text-transform: uppercase;
    line-height: 1.4;
}

.startup-btn.new-btn {
    background-color: var(--accent-orange);
}

.startup-btn.new-btn:hover {
    background-color: #d46e2c;
}

.startup-btn.open-btn {
    background-color: var(--accent-orange);
}

.startup-btn.open-btn:hover {
    background-color: #d46e2c;
}

/* Save As Modal - prevent scrollbar on simple input */
.save-as-modal .modal-body {
    overflow-y: visible;
    max-height: none;
}

/* Scenario List */
.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scenario-item {
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-item:hover {
    background-color: #f5f5f5;
    border-color: var(--secondary-teal);
}

.scenario-item h4 {
    margin: 0 0 0.5rem 0;
    color: var(--secondary-teal);
    border-bottom: none;
    padding-bottom: 0;
    background-color: transparent;
}

.scenario-item p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #666;
}

/* Vertical Tab Indicators */
.vertical-tab-indicator {
    display: flex;
    align-items: stretch;
    background-color: var(--dark-gray);
    position: relative;
    height: 100%;
}

.vertical-tab-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.vertical-tab-button {
    flex: 1;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, margin 0.3s ease;
}

.vertical-tab-button:not(.active) {
    opacity: 0.7;
}

.vertical-tab-button:hover {
    opacity: 1;
}

/* Active tab juts out horizontally into the page */
.vertical-tab-indicator.left .vertical-tab-button.active {
    margin-right: -1.5rem;
}

.vertical-tab-indicator.right .vertical-tab-button.active {
    margin-left: -1.5rem;
}

.vertical-tab-text {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    padding: 1rem 0;
    text-transform: uppercase;
}

/* Skin Color Swatches */
.skin-color-swatches {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.skin-swatch {
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.skin-swatch:hover {
    transform: scale(1.1);
}

.skin-swatch.selected {
    border-color: var(--secondary-teal);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--secondary-teal);
}

/* Radio Button Labels */
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

/* Footer Styles */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(42, 42, 42, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    z-index: 100;
    text-align: center;
}
/* ========================================
   RGBA Color Picker Component
   ======================================== */

.rgba-picker {
    padding: 1rem;
    border: 2px solid var(--secondary-teal);
    border-radius: 8px;
    background-color: white;
    margin-bottom: 1rem;
}

.rgba-picker-label {
    display: block;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.75rem;
    font-size: 1.1rem; /* VR-FRIENDLY: Large text */
}

.rgba-picker-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.rgba-sliders {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rgba-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rgba-slider-label {
    min-width: 25px;
    font-weight: 600;
    font-size: 1rem;
}

.rgba-slider {
    flex: 1;
    height: 36px; /* VR-FRIENDLY: Large touch target */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}

/* Slider Track Colors */
.rgba-slider-red::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 36px;
    background: var(--primary-maroon);
    cursor: pointer;
    border-radius: 4px;
}

.rgba-slider-red::-moz-range-thumb {
    width: 24px;
    height: 36px;
    background: var(--primary-maroon);
    cursor: pointer;
    border-radius: 4px;
    border: none;
}

.rgba-slider-red {
    background: linear-gradient(to right, #000000, #ff0000);
}

.rgba-slider-green::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 36px;
    background: #006400;
    cursor: pointer;
    border-radius: 4px;
}

.rgba-slider-green::-moz-range-thumb {
    width: 24px;
    height: 36px;
    background: #006400;
    cursor: pointer;
    border-radius: 4px;
    border: none;
}

.rgba-slider-green {
    background: linear-gradient(to right, #000000, #00ff00);
}

.rgba-slider-blue::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 36px;
    background: #000080;
    cursor: pointer;
    border-radius: 4px;
}

.rgba-slider-blue::-moz-range-thumb {
    width: 24px;
    height: 36px;
    background: #000080;
    cursor: pointer;
    border-radius: 4px;
    border: none;
}

.rgba-slider-blue {
    background: linear-gradient(to right, #000000, #0000ff);
}

.rgba-slider-alpha::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 36px;
    background: var(--dark-gray);
    cursor: pointer;
    border-radius: 4px;
}

.rgba-slider-alpha::-moz-range-thumb {
    width: 24px;
    height: 36px;
    background: var(--dark-gray);
    cursor: pointer;
    border-radius: 4px;
    border: none;
}

.rgba-slider-alpha {
    background: linear-gradient(to right,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 1)),
        /* Checkerboard pattern for transparency */
        repeating-conic-gradient(#e0e0e0 0% 25%, white 0% 50%) 50% / 20px 20px;
}

.rgba-slider-value {
    min-width: 45px;
    text-align: right;
    font-weight: 600;
    font-size: 1rem;
    color: var(--dark-gray);
}

.rgba-preview-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.rgba-preview {
    width: 120px;
    height: 120px;
    border: 3px solid var(--dark-gray);
    border-radius: 8px;
    /* Checkerboard pattern to show transparency */
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.rgba-hex {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--secondary-teal);
    color: white;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.rgba-hex-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.rgba-hex-value {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
