:root {
    --brand-primary: var(--brand-slate);
    --brand-dark: var(--brand-navy);
    --brand-secondary: var(--brand-orange);
    --bg-main: #f1f5f9; /* Slightly deeper than f8fafc for better contrast */
}

body { 
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    margin: 0; /* Ensures no default browser padding/margin interferes with the height */
    background-color: var(--bg-main); 
    background-image: 
        radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    font-family: 'Inter', sans-serif; 
    color: #1e293b;
}
.font-display { font-family: 'Outfit', sans-serif; }

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.03);
}

.navbar {
	background: white !important;
	border-bottom: 1px solid #e2e8f0;
}

.nav-link {
	font-weight: 600;
	color: #64748b;
	border-bottom: 2px solid transparent;
	transition: all 0.2s;
}

.nav-pills .nav-link.active {
	background-color:lightgrey;
	color: var(--bs-link-hover-color) !important;
	border-bottom: 2px solid var(--bs-link-hover-color);
}

.nav-item .nav-link.active{
    color: var(--bs-link-hover-color);
    border-bottom: 2px solid var(--bs-link-hover-color) !important;
}

/* Hide all action containers by default */
.tab-actions {
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    transform: translateY(-10px);
}

/* Show actions only when the sibling nav-link is active */
.nav-link.active + .tab-actions {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Style the Nav Item to look like a highlighted block */
.nav-item {
    transition: background 0.3s ease;
    border-radius: 12px;
}

/* Optional: add a light background to the whole active 'cell' */
/*
.nav-item:has(.nav-link.active) {
    background-color: #f8f9fa;
}
*/

/* Reset Bootstrap's default tab border/styling to fit this custom look */
.nav-tabs .nav-link {
    border: 1px solid transparent !important;
    border-radius: 8px !important;
}

.nav-tabs .nav-link.active {
    background-color: #0d6efd !important;
    color: white !important;
}

.stat-card {
	border-left: 5px solid var(--brand-primary);
	transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }

.btn-brand {
	background-color: var(--brand-primary);
	color: white;
	font-weight: 700;
	border-radius: 0.75rem;
	padding: 0.6rem 1.5rem;
}
.btn-brand:hover { background-color: var(--brand-dark); color: white; }

/* Custom Status Badges */
.status-badge-operational { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.status-badge-maintenance { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.status-badge-offline { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.animate-fade-in {
	animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}
@media (min-width: 992px) {
    /* Make the Command Center modal extra wide */
    .modal-xl-custom {
        max-width: 900px;
    }
    
    .p-3 h4 { font-size: 1.8rem; }
    .p-3 table { font-size: 1.1rem; }
    .p-3 .btn { font-size: 1rem; padding: 12px; }
}

/*
// Custom Accordion Styling
.accordion {
    --bs-accordion-bg: transparent;
    --bs-accordion-border-color: transparent;
}

.accordion-item {
    background-color: white;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

// Hover effect to make it feel "Interactive"
.accordion-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--brand-primary) !important;
}

// The Header Button
.accordion-button {
    font-weight: 600;
    padding: 1.25rem;
    background-color: white !important;
    color: #1e293b;
}

// When the accordion is open
.accordion-button:not(.collapsed) {
    color: var(--brand-primary);
    background-color: rgba(2, 132, 199, 0.03) !important; // Very light brand tint
    box-shadow: none; // Remove default blue glow
}

// Hide the default focus ring
.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(2, 132, 199, 0.2);
}

.accordion-header button {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}
*/

/* Left-side status indicator strip */
.machine-row-indicator {
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}
.modal-content {
    border-radius: 1.25rem;
    overflow: hidden;
    border: none;
}

.modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
}

/* Make inputs look modern within the modal */
.form-control, .form-select {
    border: 1px solid #e2e8f0;
    padding: 0.6rem 0.8rem;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.1);
}

.form-control[disabled], .form-control[readonly] {
    background-color: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.global-close-btn{
/*	position: absolute; */
	top: 1.5rem;
	right: 1.5rem;
	z-index: 1051;
}

/* The vertical stem line */
.history-container { position: relative; padding-left: 20px; }
.history-container::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #e9ecef; }

.parent-row { position: relative; transition: all 0.2s; border-radius: 8px; }
.parent-row:hover { background-color: #f8f9fa; }
/* The Dot on the stem */
.parent-row::before { content: ''; position: absolute; left: -17px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: #0d6efd; z-index: 2; }

/* The branch line for children */
.child-row { position: relative; margin-left: 30px; border-left: 2px solid #dee2e6; padding-left: 15px; margin-bottom: 5px; }
.child-row::before { content: ''; position: absolute; left: -2px; top: 15px; width: 10px; height: 2px; background: #dee2e6; }

#settingsTabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    transition: all 0.2s ease;
}

#settingsTabs .nav-link.active {
    background: transparent;
    border-bottom-color: var(--bs-primary);
}

#settingsTabs .nav-link:hover:not(.active) {
    background-color: #f8f9fa;
    border-bottom-color: #dee2e6;
}
#update-toast {
    position: fixed;
    /* Uses the dynamic height + 20px, defaults to 85px if not set */
    bottom: var(--nav-height, 60px); 
    left: 50%;
    transform: translateX(-50%) translateY(200px);
    background: #222;
    color: #fff;
    padding: 14px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 10001;
    width: calc(100% - 30px); /* Margin for small screens */
    max-width: 420px;
}
#update-toast.show {
    transform: translateX(-50%) translateY(0);
}
#update-toast button {
    background: #007bff;
    border: none;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}
#update-toast button:hover {
    background: #0056b3;
}
