.github-link {
    position: absolute;
    top: 20px; /* Adjust as needed */
    right: 20px; /* Adjust as needed */
    z-index: 100;
    display: flex; /* To align icon and text */
    align-items: center; /* Vertically align icon and text */
    text-decoration: none;
    color: #333; /* Default text color */
    font-size: 0.9em; /* Adjust text size */
}

.github-icon {
    fill: #333; /* Icon color */
    width: 24px;  /* Matched to SVG attribute */
    height: 24px; /* Matched to SVG attribute */
    margin-right: 8px; /* Space between icon and text */
    transition: fill 0.3s ease;
}

.github-link:hover .github-icon {
    fill: #007bff; /* Icon color on hover */
}
.github-link:hover span {
    color: #007bff; /* Text color on hover */
    text-decoration: underline;
}

body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 20px;
    background-color: #f4f4f4;
}

h1, h2, h3 {
    color: #333;
}

/* CIDR legend */
.cidr-legend-compact {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 8px 12px; /* Reduced padding */
    margin-bottom: 20px;
    font-size: 0.9em; /* Even smaller font size */
    color: #495057;
    text-align: center; /* Center title and table */
}

.cidr-legend-compact .legend-title {
    font-weight: 500;
    margin-right: 8px; /* Space between title and table if they wrap */
    display: inline-block; /* Keep title on same line as table if space allows */
    margin-bottom: 5px; /* Add some space below if it wraps */
}

.cidr-legend-compact table {
    display: inline-block; /* Allow table to sit next to title */
    border-collapse: collapse;
    text-align: center;
    vertical-align: middle; /* Align table nicely with title */
}

/* Remove cell borders or make very light */
.cidr-legend-compact th,
.cidr-legend-compact td {
    border: none; /* Remove cell borders */
    padding: 2px 6px; /* Adjust padding */
    white-space: nowrap; /* Prevent wrapping within cells */
}

.cidr-legend-compact th { /* Mask row */
    font-weight: 500;
    font-family: monospace;
    border-bottom: 1px solid #dee2e6; /* Separator line */

}

.cidr-legend-compact td { /* IP count row */
    font-weight: normal;
}

/* Input Section */

.input-section, .results-section {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

label {
    display: inline-block;
    width: 200px; /* Adjust as needed */
    margin-bottom: 10px;
}

.input-group input[type="number"] {
    padding: 8px; /* Increased padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 80px; /* Slightly wider if needed, or adjust based on new padding */
    margin: 0;
    font-size: 1.05em; /* Slightly larger font */
}

button#calculateBtn {
    padding: 10px 20px; /* Increased padding */
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.05em; /* Slightly larger font */
    display: inline-flex; /* For aligning icon and text */
    align-items: center; /* For aligning icon and text */
    gap: 8px; /* Space between icon and text */
}

button:hover {
    background-color: #0056b3;
}

#results h3 {
    margin-top: 25px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

#results p {
    margin: 5px 0 10px 0;
}

#summary strong {
    color: #28a745; /* Green for key results */
}
#summary .warning {
     color: orange;
     font-weight: bold;
}

/* === Add or Modify these styles in style.css === */

.input-section {
    display: flex;         /* Use flexbox to arrange the groups */
    flex-wrap: wrap;       /* Allow items to wrap onto the next line */
    align-items: flex-end; /* Align items based on their bottom edge */
    gap: 20px 25px;        /* Vertical and Horizontal gap between groups */
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.input-group {
    /* Structure for label + input */
    display: flex;
    flex-direction: column; /* Stack label above input */
    gap: 4px; /* Small space between label and its input */
}

.input-group label {
    /* Reset previous label styles if they conflict */
    width: auto;           /* Remove fixed width */
    margin-bottom: 0;      /* Remove default margin */
    font-weight: 500;      /* Optional: Make labels slightly bolder */
    font-size: 0.9em;      /* Optional: Adjust font size */
    color: #333;
    text-align: left;      /* Ensure labels align left */
}

.input-group input[type="number"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 75px; /* Adjust width as needed, or use 'auto' */
    margin: 0; /* Reset margins */
    font-size: 1em; /* Ensure consistent font size */
}

button#calculateBtn { /* Be specific if needed */
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    /* margin-top: 10px; Remove this if using align-items: flex-end */
}

button#calculateBtn:hover {
    background-color: #0056b3;
}

#results {
    display: grid;                     /* Use CSS Grid */
    grid-template-columns: 1fr 1.2fr;  /* Define two columns. Right slightly wider (adjust ratio as needed) */
    gap: 30px;                         /* Gap between columns */
    /* Keep existing background, padding, etc. */
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Optional: Style the columns if needed, but often not necessary */
.results-left-column {
    /* Takes up the first grid column */
}

.results-right-column {
    /* Takes up the second grid column */
    display: flex; /* Use flexbox to stack allocation groups vertically */
    flex-direction: column;
    gap: 1px; /* Space between the allocation groups */
}

/* Optional: Style for the allocation groups in the right column */
.allocation-group h3 {
    margin-top: 0; /* Remove default top margin if needed */
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-size: 1.1em;
}

/* --- Make sure other styles for summary, viz-container, etc., are still present --- */

/* Example: Ensure summary paragraphs have reasonable margins */
#summary p {
    margin: 8px 0 12px 0;
    line-height: 1.5;
}
#summary strong {
    color: #28a745;
}
#summary .warning {
     color: orange;
     font-weight: bold;
}


/* --- Visualization Styles --- */
.viz-container {
    width: 100%;
    height: 30px; /* Height of the bar */
    background-color: #e9ecef; /* Background of the container (represents total) */
    border-radius: 4px;
    margin-bottom: 5px;
    overflow: hidden; /* Hide text overflow */
    position: relative; /* For positioning text */
    border: 1px solid #ccc;
}

.viz-bar {
    height: 100%;
    background-color: #28a745; /* Color of the used portion */
    width: 0%; /* Start with 0 width, JS will set this */
    transition: width 0.5s ease-in-out; /* Animate the width change */
    text-align: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
}

/* Make text viewable even if bar is small */
.viz-text {
    position: absolute; /* Position text relative to container */
    width: 100%; /* Span the whole container */
    left: 0;
    text-align: center;
    line-height: 30px; /* Match container height */
    color: #333; /* Dark text color */
    text-shadow: 1px 1px 1px #fff, -1px -1px 1px #fff; /* Basic outline for readability */
}

.viz-bar .viz-text {
    /* Style for text when it's inside the colored bar (optional override) */
     color: white; /* White text when inside the bar */
     text-shadow: none;
}


#nodeVizBar { background-color: #007bff; } /* Blue for Nodes */
#podVizBar { background-color: #fd7e14; } /* Orange for Pods */
#serviceVizBar { background-color: #6f42c1; } /* Purple for Services */

#nodeVizLegend, #podVizLegend, #serviceVizLegend {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
}

/* Cluster Visualization */
.cluster-viz-section {
    background-color: #fff;
    padding: 20px;
    margin-top: 20px; /* Space below previous results */
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cluster-viz-section h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

.cluster-container {
    border: 2px solid #6c757d; /* Dark grey border for cluster */
    border-radius: 8px;
    padding: 40px 20px 20px 20px; /* More padding top for label */
    position: relative; /* For positioning the cluster label */
    min-height: 300px; /* Give it some minimum height */
    display: flex; /* Use flex to position node/service areas */
    gap: 20px;
    align-items: flex-start; /* Align areas to the top */
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.cluster-label {
    position: absolute;
    top: -12px; /* Position label slightly overlapping the top border */
    left: 15px;
    background-color: #fff; /* Background to cover the border */
    padding: 0 10px;
    font-weight: bold;
    color: #6c757d;
}

/* Node Area Styles */
.node-area {
    border: 1px dashed #007bff; /* Blue dashed border for node area */
    padding: 15px;
    border-radius: 6px;
    background-color: #e7f3ff; /* Light blue background */
    flex: 2; /* Allow node area to take more space */
    min-width: 250px;
    transition: border-color 0.5s ease; /* Smooth color transition */
}

.area-label {
    font-size: 0.9em;
    font-weight: 500;
    color: #555;
    margin-bottom: 10px;
    display: block; /* Make it block for margin */
}
.area-label small {
    font-weight: normal;
    color: #777;
}

.node-box {
    border: 2px solid #007bff; /* Solid blue border for the node */
    background-color: #fff;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px; /* Space between node boxes if showing more */
    min-height: 100px; /* Ensure node box has some height */
    position: relative;
    transition: border-color 0.5s ease; /* For color change effect */
}
.element-label {
    font-weight: bold;
    font-size: 0.85em;
    color: #0056b3;
}
.node-details {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 10px;
}


/* Pod Area Styles inside Node */
.pod-area {
    border: 1px solid #fd7e14; /* Orange border for pod area */
    background-color: #fff9f3; /* Light orange background */
    border-radius: 3px;
    padding: 8px;
    margin-top: 5px;
    transition: border-color 0.5s ease;
}
.pod-icons {
    margin-bottom: 5px;
}
.pod-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #fd7e14; /* Orange pod */
    border-radius: 2px; /* Slightly rounded square */
    margin-right: 4px;
}
.pods-label {
     margin-bottom: 0; /* Reset margin */
     font-size: 0.85em;
}
.pods-label small { font-size: 0.9em; }


/* Service Area Styles */
.service-area {
    border: 1px dashed #6f42c1; /* Purple dashed border */
    padding: 15px;
    border-radius: 6px;
    background-color: #f4eFFF; /* Light purple background */
    flex: 1; /* Allow service area to take less space */
    min-width: 150px;
}
.service-icon-container {
    text-align: center; /* Center icons */
}
.service-icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    background-color: #6f42c1; /* Purple service */
    border-radius: 50%; /* Circle */
    margin: 5px;
}

/* Faded elements to indicate 'more' */
.faded-icon {
    opacity: 0.4;
}
.faded-box {
    border-style: dashed; /* Use dashed border for faded look */
    opacity: 0.5;        /* Make it semi-transparent */
    text-align: center;
    padding-top: 15px;   /* Adjust padding as needed */
    min-height: 50px;    /* Give it some minimum height */
    margin-top: 10px;    /* Add margin if needed */
    /* Inherits .node-box border-color, padding etc. unless overridden */
}

.faded-box .element-label {
    color: #666; /* Lighter color for the text */
    font-weight: normal; /* Less emphasis */
}

/* Styles when a resource has unused capacity */
.has-room {
    border-width: 2px; /* Make border slightly thicker */
    border-color: #28a745 !important; /* Green border - use !important if needed to override default */
}
.has-room > .area-label { /* Style label within the area */
    /* color: #19692c; */ /* Optional: Change label color */
}

/* Styles when a resource is the limiting factor */
.is-limited {
    border-width: 2px;
    border-color: #dc3545 !important; /* Red border */
}
.is-limited > .area-label {
   /* color: #a71d2a; */ /* Optional: Change label color */
}


/* Style for the small text indicating unused IPs */
.unused-info {
    display: block; /* Put it on its own line */
    font-size: 0.8em;
    font-style: italic;
    color: #555;
    margin-top: 4px;
}
.unused-info.has-room-text { /* Style when showing room */
    color: #19692c; /* Dark green text */
}

/* footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px; /* Space above the footer */
    font-size: 0.85em;
    color: #6c757d; /* Muted text color */
    border-top: 1px solid #dee2e6; /* Separator line */
    background-color: #f8f9fa; /* Optional: Light background for footer */
}

footer p {
    margin: 5px 0;
}

footer a {
    color: #007bff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}
