/* --- HEADER & TABS --- */
.header-nav {
    display: flex;
    justify-content: space-around; 
    align-items: center;
    padding: 12px 15px;
    background-color: #ffffff;
    border-bottom: 1px solid #ddd; 
}

.nav-btn {
    padding: 8px 30px;
    font-size: 15px;
    font-weight: 600;
    border: 2px dashed #00b300;
    border-radius: 4px;
    cursor: pointer;
    background-color: transparent;
    color: #333;
    transition: all 0.2s ease;
}

.nav-btn.active-btn {
    background-color: #00b300; 
    color: white;
    border-style: solid;
}

.tab-content {
    display: none; 
    flex-grow: 1; 
    width: 100%;
    height: 100%;
    overflow: hidden; 
}
.tab-content.active-tab { display: flex; }

/* --- ASSEMBLY SEARCH BAR --- */
.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: #3498db; }

/* --- ASSEMBLY LIST ITEMS --- */
.assembly-list-container {
    flex: 1;
    overflow-y: auto;
    background-color: #fff;
}

.assembly-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: all 0.1s;
}

.assembly-item:hover {
    background-color: #f0f9ff;
    border-left: 4px solid #3498db;
    padding-left: 11px; /* Compensates for the border to prevent jumping */
}

.assembly-name {
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
    display: block;
    margin-bottom: 3px;
}

.assembly-children {
    font-size: 11px;
    color: #95a5a6;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- SUB-NAVIGATION (Inside Sensors Tab) --- */
.sub-nav {
    display: flex;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 15px;
    gap: 15px;
    flex-shrink: 0; /* Prevents it from crushing */
}

.sub-nav-btn {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sub-nav-btn:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

.sub-nav-btn.active-btn {
    background-color: #3498db; /* Blue accent for sub-tabs */
    color: white;
}

/* --- SUB-TAB CONTENTS --- */
.sub-tab-content {
    display: none; 
    flex-grow: 1;
    height: 100%;
    overflow: hidden;
}

.sub-tab-content.active-sub-tab {
    display: flex; 
}

/* --- INTERNAL FLOATING WINDOWS --- */
.floating-window {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4); /* Strong shadow to separate from background */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    animation: windowFadeIn 0.2s ease-out;
}

@keyframes windowFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.floating-window-header {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.floating-window-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-window-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-window-btn:hover {
    color: #ef4444; /* Turns red when hovered */
}


/* --- PERFECT OVERLAY WINDOWS --- */
.floating-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: windowFadeIn 0.15s ease-out;
}

@keyframes windowFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.floating-window-header {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.floating-window-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-window-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-window-btn:hover {
    color: #ef4444; /* Turns red when hovered */
}

.floating-window-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
    background-color: #f8fafc;
}

/* --- IFRAME STYLING FOR FLOATING WINDOWS --- */
.floating-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex-grow: 1;
    background-color: #f8fafc; /* Matches the previous background */
}


/* --- PANEL BUTTONS (Threshold Manager) --- */
.panel-btn {
    width: 100%;
    padding: 10px;
    background-color: #f1f5f9; 
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.panel-btn:hover, 
.panel-btn:active, 
.panel-btn:focus {
    background-color: #3498db; 
    color: white;
    border-color: #3498db;
}

/* --- FORM CONTROLS (Dropdowns and Inputs) --- */
.form-control {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 13px;
    color: #334155;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}