:root {
    /* Primary Colors */
    --primary-color: #e88937;
    --background-color: #f5f5f5;
    --white: #ffffff;
    
    /* Text Colors */
    --text-primary: #000000;
    --text-secondary: #666666;
    
    /* Status Colors */
    --success-color: #4CAF50;
    --warning-color: #FFA726;
    --critical-color: #EF5350;
    --disabled-color: #6c757d;
    
    /* UI Element Colors */
    --border-color: #dddddd;
    --input-background: #ffffff;
    --panel-background: #f5f5f5;
    --table-stripe: #f9f9f9;
    --load-bar-background: #e0e0e0;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    
    /* PDU Colors */
    --pdu-button-color: #4CAF50;
    --pdu-button-color-disabled: #EF5350;
}

html, body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 10px;
}

main {
    flex: 1 0 auto;
    margin-bottom: 30px;
}

.container {
    max-width: 90%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(300px, 300px) 1fr;  /* Fixed left sidebar width */
    grid-template-rows: 1fr auto;
    gap: 20px;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* Layout containers */
.left-sidebar {
    grid-column: 1;
    grid-row: 1;
    width: 300px;  /* Enforce fixed width */
    min-width: 300px;  /* Prevent shrinking */
}

.main-content {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;  /* Allow content to shrink if needed */
    width: 100%;
    overflow-x: auto;  /* Add horizontal scroll if content is too wide */
}

.summary-footer {
    display: none;
}

.settings-panel {
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    background: var(--panel-background);
    border-radius: 8px;
}

/* Style for the import/export buttons container */
.import-export-buttons {
    display: flex;
    justify-content: center;  /* Center buttons horizontally */
    gap: 15px;               /* Space between buttons */
    margin-top: 25px;        /* Space after Circuit Rating */
    width: 100%;             /* Take full width of container */
}

.import-export-buttons button {
    padding: 8px 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: auto;             /* Let buttons size to content */
    min-width: fit-content;  /* Ensure buttons fit their text */
}

/* Style for the utilization summary section */
.utilization-summary {
    padding: 15px;
    background: var(--panel-background);
    border-radius: 8px;
}

.power-summary {
    margin-bottom: 15px;
}

/* Adjust the summary section styling */
.summary-section {
    margin-top: 0;  /* Remove top margin since it's now in grid */
    background: var(--panel-background);
    border-radius: 8px;
    padding: 20px;
}

.utilization-section {
    margin-top: 0;  /* Remove top margin since it's now in grid */
    background: var(--panel-background);
    border-radius: 8px;
    padding: 20px;
}

.settings-panel, .servers-panel, .visualization-panel {
    background: var(--panel-background);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-control {
    width: calc(100% - 16px);  /* Subtract padding to prevent overflow */
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;    /* Include padding and border in width calculation */
}

/* Server Table Styles */
.servers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: var(--white);
    min-width: min-content;  /* Ensure table doesn't shrink below content width */
}

.servers-table th, 
.servers-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.servers-table th {
    background-color: var(--primary-color);
    color: var(--white);
}

.servers-table tr:nth-child(even) {
    background-color: var(--table-stripe);
}

/* PDU Visualization */
.pdu-visualization {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.pdu {
    border: 1px solid var(--border-color);
    padding: 15px;
    background: var(--white);
    border-radius: 4px;
}

.circuit {
    margin: 10px 0;
    padding: 10px;
    background: var(--table-stripe);
    border-radius: 4px;
    position: relative;
}

.circuit-load {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.load-bar {
    height: 20px;
    background: var(--load-bar-background);
    border-radius: 10px;
    overflow: hidden;
}

.load-bar-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

.load-bar-fill.load-warning {
    background: var(--warning-color);
}

.load-bar-fill.load-critical {
    background: var(--critical-color);
}

/* Buttons and Actions */
.actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

button.secondary {
    background: var(--disabled-color);
}

.action-cell {
    white-space: nowrap;
}

.action-cell button {
    display: block;
    width: 100%;
    padding: 5px 10px;
    margin-bottom: 5px;
}

/* Added warning and critical load indicators */
.load-warning .load-bar-fill {
    background: var(--warning-color);
}

.load-critical .load-bar-fill {
    background: var(--critical-color);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-primary);
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Assignment badge styles */
.pdu-assignment {
    display: inline-block;
    background: var(--table-stripe);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px;
    font-size: 0.9em;
}

.power-value {
    color: var(--text-secondary);
    font-size: 0.8em;
}

.power-summary {
    margin-top: 20px;
    padding: 20px;
    background: var(--panel-background);
    border-radius: 8px;
}

.summary-bar {
    margin-bottom: 15px;
}

.summary-bar h3 {
    margin: 0 0 10px 0;
}

.psu-status {
    white-space: nowrap;
}

.psu-indicator {
    display: inline-block;
    padding: 4px 8px;
    margin: 0 2px;
    border-radius: 4px;
    background: var(--pdu-button-color);
    color: var(--white);
    cursor: pointer;
    font-size: 0.9em;
}

.psu-indicator.disabled {
    background: var(--pdu-button-color-disabled);
    text-decoration: line-through;
}

.pdu-assignments {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.psu-status {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.psu-buttons {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 100px;
}

.psu-data {
    flex: 1;
}

.psu-indicator {
    display: block;
    width: 100%;
    text-align: center;
    padding: 4px 8px;
    margin: 0;
    border-radius: 4px;
    background: var(--pdu-button-color);
    color: var(--white);
    cursor: pointer;
    font-size: 0.9em;
}

.assignments {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.summary-section {
    padding: 20px;
    background: var(--panel-background);
    border-radius: 8px;
}

.summary-bar {
    margin-bottom: 15px;
}

.summary-bar h3 {
    margin: 0 0 10px 0;
}

.load-bar {
    height: 20px;
    background: var(--load-bar-background);
    border-radius: 10px;
    overflow: hidden;
}

.load-bar-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

.load-bar-fill.load-warning {
    background: var(--warning-color);
}

.load-bar-fill.load-critical {
    background: var(--critical-color);
}

.import-export-buttons {
    margin-bottom: 20px;
    display: flex;
    flex-direction: row;     /* Make buttons horizontal */
    gap: 10px;
    justify-content: flex-start;  /* Align buttons to the left */
}

.import-export-buttons button {
    padding: 8px 16px;
    background-color: var(--pdu-button-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: auto;            /* Don't fill width */
    min-width: fit-content; /* Only as wide as content needs */
}

.servers-panel {
    background: var(--panel-background);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Adjust the table header section */
.table-header {
    display: flex;
    justify-content: space-between;  /* Space between title and buttons */
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;  /* Add padding to align with table */
}

.import-export-buttons {
    display: flex;
    gap: 15px;  /* Space between buttons */
}

.import-export-buttons button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: auto;
    min-width: fit-content;
}

.phase-loads {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.phase-load {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Container for all buttons */
.settings-panel-buttons {
    margin-top: 25px;        /* Space after Circuit Rating */
    display: flex;
    flex-direction: column;
    gap: 15px;              /* Space between button rows */
    width: 100%;
}

/* Style for the import/export config buttons */
.import-export-buttons {
    display: flex;
    justify-content: center;  /* Center buttons horizontally */
    gap: 15px;               /* Space between buttons */
}

/* Style for the PDF export button */
.pdf-export-button {
    display: flex;
    justify-content: center;
}

.pdf-export-button button {
    width: 100%;            /* Make PDF button fill the space */
    max-width: 200px;       /* But limit its maximum width */
}

.import-export-buttons button,
.pdf-export-button button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #eee;  /* Lighter border */
    padding: 0.4rem 0;  /* Slightly reduced padding */
    margin-top: 1rem;
    font-size: 0.75rem;  /* Even smaller font size (12px) */
    color: #6c757d;  /* Bootstrap's secondary color */
}