/* General Body and Container Styles - Dark Mode */
body {
    font-family: 'Inter', sans-serif;
    background-color: #000000; /* Pure black background */
    color: #ffffff; /* Pure white text */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    background-color: #0d1b2a; /* Deep colour for main container */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6); /* Stronger shadow for depth */
    width: 100%;
    max-width: 750px;
    box-sizing: border-box;
    border: 1px solid #1b263b; /* Slightly lighter border for container */
}

h1 {
    color: #1e90ff; /* Vibrant for main title */
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
}

h2, h3 {
    color: #64aaff; /* Lighter for section headings */
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
}

/* Tab Navigation Styles */
.tabs-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background-color: #1b263b; /* Slightly lighter shade of tab background */
    border-radius: 8px;
    padding: 5px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background-color: transparent;
    color: #ffffff; /* White text for inactive tabs */
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 2px;
}

.tab-button:hover:not(.active) {
    background-color: #2c3e50; /* Hover effect for inactive tabs */
    color: #ffffff;
}

.tab-button.active {
    background-color: #1e90ff; /* Active tab */
    color: #ffffff; /* White text on active tab */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* Tab Content Styles */
.tab-content {
    display: none; /* Crucial: Hide all tab content by default */
    padding-top: 20px;
}

.tab-content.active {
    display: block; /* Crucial: Show active tab content */
}

/* Input Section Styles */
.input-section, .results-section, .expandable-section, .placeholder-section {
    margin-bottom: 30px;
    padding: 25px;
    border: 1px solid #1b263b; /* Border matching container */
    border-radius: 10px;
    background-color: #1b263b; /* Slightly lighter shade for sections */
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.3);
}

.input-group {
    margin-bottom: 18px; /* More spacing */
}

/* Inline Input Group for Labels and Fields */
.input-group-inline {
    display: flex; /* Use flexbox for side-by-side */
    align-items: center; /* Vertically align items */
    margin-bottom: 18px;
}

.input-group-inline label {
    flex-basis: 55%; /* Label takes slightly more width now */
    margin-bottom: 0; /* Remove bottom margin from label */
    padding-right: 15px; /* Spacing between label and input */
    text-align: right; /* Align label text to the right */
    color: #ffffff; /* White for labels */
    font-size: 1em; /* Ensure font size is consistent */
}

.input-group-inline input[type="text"],
.input-group-inline input[type="number"],
.input-group-inline input[type="tel"] { /* Added type="tel" */
    flex-basis: 40%; /* Input takes less width */
    max-width: 100px; /* Max width for input fields */
    padding: 10px; /* Slightly smaller padding for compact look */
    font-size: 1em; /* Adjust font size */
    background-color: #1b263b; /* Darker input background */
    color: #ffffff; /* White text */
    border: 1px solid #2c3e50; /* Border color */
    border-radius: 6px; /* Slightly less rounded */
    box-sizing: border-box; /* Ensure padding and border are included in width */
    text-align: center; /* Centered input field text */
}

.input-group-inline input[type="text"]:focus,
.input-group-inline input[type="number"]:focus,
.input-group-inline input[type="tel"]:focus { /* Added type="tel" */
    border-color: #1e90ff; /* Focus border */
    box-shadow: 0 0 8px rgba(30, 144, 255, 0.4); /* Glow */
}


/* Button Styles */
.primary-button { /* For main calculate buttons */
    background-color: #1e90ff; /* Button */
    color: #ffffff; /* White text on button */
    padding: 14px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.primary-button:hover {
    background-color: #4aa3ff; /* Lighter on hover */
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

.primary-button:disabled {
    background-color: #6a6a6a; /* Grey for disabled */
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-button { /* For Add/Remove buttons like Sleep Period */
    background-color: #2c3e50; /* Complementary dark */
    color: #ffffff;
    padding: 8px 15px;
    border: 1px solid #3e5c76;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
    /* Removed margin-right: 5px; */ /* THIS LINE IS REMOVED */
    margin-top: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.secondary-button:hover {
    background-color: #3e5c76;
}

.secondary-button:disabled {
    background-color: #4a4a4a;
    cursor: not-allowed;
}

/* Results Section Styles */
.results-section p {
    font-size: 1.1em;
    margin-bottom: 10px;
    line-height: 1.6;
    color: #ffffff; /* White text */
}

.results-section p strong {
    color: #64aaff; /* Lighter for strong text */
}

/* Dividers */
.divider {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(30, 144, 255, 0), rgba(30, 144, 255, 0.5), rgba(30, 144, 255, 0));
    margin: 30px 0;
}

/* Compliance Status Styling */
.compliant {
    color: #4CAF50; /* Green for compliant */
    font-weight: bold;
}

.non-compliant {
    color: #e74c3c; /* Red for non-compliant */
    font-weight: bold;
}

/* Specific suggestion line hiding */
.suggestion-line {
    display: none; /* Hidden by default, shown by JS */
}

/* Expandable Section Styles */
.expandable-section {
    margin-top: 30px;
}

.expandable-header {
    background-color: #1b263b; /* Darker background for header */
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.1em;
    color: #ffffff;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.expandable-header:hover {
    background-color: #2c3e50;
}

.toggle-icon {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.expandable-header.expanded .toggle-icon {
    transform: rotate(180deg);
}

.expandable-content {
    background-color: #1b263b; /* Slightly lighter for content */
    padding: 20px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    margin-top: -5px;
    border-top: 1px solid #1b263b;
    color: #ffffff;
    font-size: 0.95em;
    line-height: 1.6;
}

.expandable-content p {
    margin-bottom: 8px;
}

.expandable-content strong {
    color: #64aaff; /* Updated to #64aaff */
}

/* Placeholder section for other tabs */
.placeholder-section {
    text-align: center;
    padding: 50px 20px;
    background-color: #1b263b;
    border-radius: 10px;
    border: 1px dashed #1e90ff; /* Dashed border */
    color: #ffffff;
}

.placeholder-section h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

.placeholder-section p {
    font-size: 1.1em;
    margin-bottom: 30px;
}

.placeholder-section img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* IFLS Specific Styles */
/* Removed #sleepPeriodsContainer as a direct styling target */

.sleep-periods-group-container { /* New container for 24-hour sections */
    border: 1px dashed #3e5c76;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #1b263b;
}

.sleep-periods-group-container h4 { /* Styling for sub-headings like "Last 24 Hours" */
    color: #64aaff;
    text-align: left;
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 500;
}

.sleep-periods-sub-container { /* Container for individual sleep inputs within 24hr sections */
    margin-bottom: 10px; /* Space below the container of sleep inputs */
    padding-bottom: 5px; /* Little padding at the bottom */
}


.sleep-period-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px; /* Space between elements */
}

.sleep-period-group label {
    flex-basis: auto; /* Allow label to take natural width */
    text-align: left; /* Align sleep period labels to left */
    padding-right: 0;
    white-space: nowrap; /* Keep label on one line */
}

.sleep-period-group input {
    flex-basis: 50px; /* Make sleep period inputs narrower */
    max-width: 60px; /* Max width for consistency */
}

.sleep-period-group .action-buttons {
    display: flex;
    /* Removed gap: 5px; as it can cause issues with single item alignment */
    margin-left: auto; /* Push buttons to the right */
    /* Ensure consistent width for alignment */
    width: 30px; /* Fixed width to match button size */
    justify-content: center; /* Center content within this reserved space */
    flex-shrink: 0; /* Prevent it from shrinking */
    flex-grow: 0; /* Prevent it from growing */
}

.sleep-period-group .action-buttons button {
    width: 30px; /* Fixed width for plus/minus buttons */
    height: 30px; /* Fixed height */
    padding: 0; /* Remove padding */
    font-size: 1.2em; /* Larger font for + / - */
    margin-top: 0; /* Remove top top margin */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%; /* Make them circular */
}

.sleep-period-group .add-sleep-period-btn {
    background-color: #4CAF50; /* Green for add button */
    border: 1px solid #388E3C;
}

.sleep-period-group .remove-sleep-period-btn {
    background-color: #e74c3c; /* Red for remove button */
    border: 1px solid #c0392b;
}

/* New CSS rule to hide elements while reserving their space */
.hidden {
    visibility: hidden;
}

.ifls-score-green {
    color: #4CAF50; /* Green */
    font-weight: bold;
}

.ifls-score-orange {
    color: #FFA500; /* Orange */
    font-weight: bold;
}

.ifls-score-red {
    color: #e74c3c; /* Red */
    font-weight: bold;
}

.ifls-factor-details {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #3e5c76;
}

/* Disclaimer at bottom right */
.disclaimer {
    position: fixed; /* Fixes it relative to the viewport */
    bottom: 10px;
    right: 10px;
    font-size: 0.75em;
    color: #888;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 1000; /* Ensure it's on top of other content */
    max-width: 250px; /* Limit width */
    text-align: right;
}

.disclaimer p {
    margin: 0;
    line-height: 1.3;
}

/* Endurance Tab Specific Styles */
.styled-input-field {
    flex-basis: 40%; /* Input takes less width */
    max-width: 100px; /* Max width for input fields */
    padding: 10px; /* Slightly smaller padding for compact look */
    font-size: 1em; /* Adjust font size */
    background-color: #1b263b; /* Darker input background */
    color: #ffffff; /* White text */
    border: 1px solid #2c3e50; /* Border color */
    border-radius: 6px; /* Slightly less rounded */
    box-sizing: border-box; /* Ensure padding and border are included in width */
    text-align: center; /* Centered input field text */
}

.styled-input-field:focus {
    border-color: #1e90ff; /* Focus border */
    box-shadow: 0 0 8px rgba(30, 144, 255, 0.4); /* Glow */
}

/* Ensure the general .input-group-inline label styling is as desired for side-by-side */
.input-group-inline label {
    flex-basis: 55%; /* Label takes slightly more width now */
    margin-bottom: 0; /* Remove bottom margin from label */
    padding-right: 15px; /* Spacing between label and input */
    text-align: right; /* Align label text to the right */
    color: #ffffff; /* White for labels */
    font-size: 1em; /* Ensure font size is consistent */
}

.calculated-time-display {
    color: #64aaff; /* Lighter for calculated time */
    font-weight: bold;
    white-space: nowrap; /* Prevent wrapping */
    flex-shrink: 0; /* Prevent it from shrinking */
}

/* Styles for the endurance display element (formerly the button) */
.endurance-display-button {
    cursor: default; /* Remove pointer cursor */
    text-align: center; /* Center the text */
    transition: none; /* Remove transition effects */
    transform: none; /* Remove transform effects */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); /* Keep initial shadow, remove hover shadow */
}

/* Override primary-button hover styles for endurance-display-button */
.endurance-display-button:hover {
    background-color: initial; /* Keep the color set by status classes */
    transform: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); /* Keep the default shadow */
}

/* Color classes for endurance display */
.endurance-red {
    background-color: #e74c3c; /* Red */
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.4);
}
.endurance-orange {
    background-color: #FFA500; /* Orange */
    box-shadow: 0 4px 10px rgba(255, 165, 0, 0.4);
}
.endurance-green {
    background-color: #4CAF50; /* Green */
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
}
