/* Full width iframe support */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
}

.container-fluid {
    width: 100%;
    padding-right: 0;
    padding-left: 0;
    margin-right: auto;
    margin-left: auto;
}

/* Responsive adjustments for iframe */
@media (max-width: 768px) {
    .container-fluid {
        padding-right: 10px;
        padding-left: 10px;
    }
}

.logo {
    max-height: 60px;
    margin-bottom: 0;
    margin-right: 15px;
}
.header-section {
    background-color: #003366; /* Dark blue */
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-left {
    display: flex;
    align-items: center;
}
.header-right {
    display: flex;
    align-items: center;
}
.tab-content {
    padding: 20px;
    border: 1px solid #dee2e6;
    border-top: 0;
    border-radius: 0 0 5px 5px;
}
.filter-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}
.config-table {
    height: 550px;
    overflow-y: auto;
    overflow-x: auto;
    font-size: 0.85rem;
}
.config-table th, .config-table td {
    padding: 0.5rem;
}
.config-details {
    height: auto;
    min-height: 600px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    background-color: #f8f9fa;
    overflow-y: auto;
}
.terminal-display {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}
.terminal-component-container {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    margin-bottom: 15px;
}
.left-components, .right-components {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 30%;
}
.terminal-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px;
    width: 40%;
}
.terminal-image img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}
.config-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.component-box {
    background-color: #e9ecef;
    margin: 0;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 120px; /* Smaller height by default */
    transition: height 0.3s ease;
}
.edit-mode .component-box {
    height: 180px; /* Full height in edit mode */
}
.component-name {
    font-weight: 500;
    margin-bottom: 5px;
    color: inherit;
}
.component-value {
    color: #0d6efd;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 1.5rem;
}
.component-description,
.bay-description {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 3px;
    margin-bottom: 8px;
    min-height: 2.4em;
    overflow: visible;
    text-overflow: clip;
    display: block;
    white-space: normal;
    line-height: 1.2;
    transition: min-height 0.3s ease;
}
.edit-mode .component-description,
.edit-mode .bay-description {
    min-height: 3.6em;
}
.component-selector, .module-selector {
    margin-top: auto;
    width: 100%;
    display: none; /* Hide selectors by default */
}

/* Add a class to show selectors when in edit mode */
.edit-mode .component-selector, 
.edit-mode .module-selector {
    display: block;
}

.bay, .power-bay {
    margin: 0;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 120px; /* Smaller height by default */
    background-color: #e9ecef; /* Same grey background */
    transition: height 0.3s ease;
}
.edit-mode .bay, 
.edit-mode .power-bay {
    height: 180px; /* Full height in edit mode */
}
.bays-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    margin-bottom: 15px;
}
.selected-row {
    background-color: #e2f3ff !important;
}
.loading {
    text-align: center;
    padding: 20px;
}
.part-numbers-card {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
    font-size: 0.7rem;
}
.part-numbers-card .card-body {
    padding: 0.75rem;
}
.part-number-value {
    font-weight: 500;
    color: #6c757d;
}
.bay-name {
    font-weight: 500;
    margin-bottom: 5px;
    color: inherit;
}
.bay-value {
    color: #0d6efd;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 1.75rem;
}

/* Auxiliary Equipment styles */
.aux-box {
    background-color: #d1ecf1; /* Light blue background to differentiate from bays */
    margin: 8px;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 200px;
}

/* Terminal container that also holds the auxiliary equipment */
.terminal-aux-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 16px;
    width: 100%;
    margin-bottom: 10px;
}

.config-title {
    color: #0d6efd;
}
.module-selector option:first-child {
    color: #6c757d;
}
.new-config {
    color: #dc3545;
    font-style: italic;
}
.config-details h5 {
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Module tab specific styles */
.module-image-placeholder {
    width: 280px;
    height: 200px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    background-color: #f8f9fa;
}

.placeholder-text {
    color: #6c757d;
    font-size: 1.2rem;
}

.compatibility-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.compatibility-item {
    padding: 8px;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.compatibility-value {
    font-weight: 500;
}

.compatibility-yes {
    color: #28a745;
}

.compatibility-no {
    color: #dc3545;
}

/* Status color coding */
.status-live {
    color: #28a745; /* Green */
    font-weight: 500;
}
.status-requested, .status-candidate {
    color: #9370DB; /* Light purple */
    font-weight: 500;
}
.status-development {
    color: #fd7e14; /* Orange */
    font-weight: 500;
}
.status-superseded, .status-retired {
    color: #6c757d; /* Grey */
    font-weight: 500;
}
.status-specific-usecase {
    color: #0d6efd; /* Blue */
    font-weight: 500;
}

/* Table column styles */
.config-table th.status-column {
    min-width: 130px;
}
.config-table td.status-column {
    min-width: 130px;
}
.config-table th.description-column {
    width: 40%;
}
.config-table td.description-column {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0; /* Needed for text-overflow to work with table cells */
}

/* Product Config column width */
.config-table th.config-column {
    min-width: 130px; /* Base width plus 20px */
}

.config-table td.config-column {
    min-width: 130px;
}

/* Product Type column width */
.config-table th.type-column {
    min-width: 130px;
}

.config-table td.type-column {
    min-width: 130px;
}

/* Table header styling */
.config-table th {
    background-color: #f0f0f0; /* Light grey background */
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: default;
}

/* Sortable header styling */
.config-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px; /* Space for sort indicator */
}

/* Sort indicators */
.config-table th.sortable::after {
    content: "▲▼";
    position: absolute;
    right: 5px;
    font-size: 10px;
    color: #aaa;
    line-height: 1;
}

.config-table th.sortable.asc::after {
    content: "▲";
    color: #333;
}

.config-table th.sortable.desc::after {
    content: "▼";
    color: #333;
}

/* Status color coding */

/* Auxiliary Equipment styles */
.aux-box {
    background-color: #d1ecf1; /* Light blue background to differentiate from bays */
    margin: 8px;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 200px;
}

/* Terminal container that also holds the auxiliary equipment */
.terminal-aux-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 16px;
    width: 100%;
    margin-bottom: 10px;
}

.terminal {
    margin: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.terminal img {
    max-width: 100%;
    max-height: 100%;
}

.terminal .text-white {
    background-color: #343a40;
    padding: 15px;
    border-radius: 10px;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.terminal-box {
    width: 100%;
    background-color: #e9ecef;
    margin: 8px;
    padding: 12px;
    border-radius: 5px;
    text-align: left;
    display: flex;
    flex-direction: column;
    height: 200px;
}

.terminal-box .terminal-details {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.terminal-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.detail-label {
    color: #6c757d;
    font-size: 0.9rem;
}

.detail-value {
    color: #212529;
    font-weight: 500;
}

/* Terminal container that also holds the auxiliary equipment */
.terminal-aux-container {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 16px;
    width: 100%;
    margin-bottom: 10px;
}

.terminal {
    margin: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.aux-box {
    flex: 1;
    background-color: #d1ecf1;
    margin: 8px;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 200px;
}

.terminal-box {
    width: 100%;
    background-color: #e9ecef;
    margin: 8px;
    padding: 12px;
    border-radius: 5px;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 200px;
}

.terminal-box .terminal-details {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.terminal-box .terminal-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.terminal-box .bay-description {
    min-height: 3.6em;
    display: block;
    overflow: visible;
    text-align: center;
}

/* Status filter styles */
.status-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.status-checkboxes .form-check {
    margin-right: 0;
}

.status-checkboxes .form-check-input {
    margin-top: 0.3rem;
}

.status-checkboxes .form-check-label {
    font-size: 0.875rem;
    margin-left: 0.25rem;
}

/* Configuration Details Header styles */
.config-details-header {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
}

.config-details-main {
    flex: 2;
}

.config-details-header h2 {
    font-size: 1.75rem;
    margin-bottom: 12px;
    color: #0d6efd;
}

.config-details-header .status-label {
    margin-bottom: 12px;
}

.config-details-header .status-label span:first-child {
    font-weight: 500;
    margin-right: 8px;
}

.config-details-header .status-badge {
    font-size: 1.1rem;
    padding: 6px 12px;
    display: inline-block;
}

.config-details-header .description {
    font-size: 1.1rem;
    color: #495057;
    line-height: 1.5;
}

.part-numbers-section {
    flex: 1;
    border-left: 1px solid #dee2e6;
    padding-left: 20px;
}

.part-number-item {
    margin-bottom: 12px;
}

.part-number-item:last-child {
    margin-bottom: 0;
}

.part-number-item strong {
    display: block;
    margin-bottom: 4px;
    color: #495057;
}

.part-number-item .part-number-value {
    display: block;
    font-size: 1.1rem;
    color: #0d6efd;
    font-weight: 500;
}

/* External Parts List styles */
.external-parts-list {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-top: 20px;
    width: 100%;
}

.external-parts-title {
    font-weight: 500;
    color: #0d6efd;
    margin-bottom: 10px;
}

.external-parts-content {
    font-family: monospace;
    white-space: pre-wrap;
    background-color: white;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

@media (max-width: 992px) {
    .terminal-component-container {
        flex-direction: column;
    }
    
    .left-components, .right-components {
        width: 100%;
        flex-direction: row;
    }
    
    .terminal-image {
        width: 100%;
        margin: 15px 0;
    }
    
    .bays-container {
        flex-wrap: wrap;
    }
    
    .bay, .power-bay {
        flex: 0 0 48%;
    }
}
