/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Card Layout */
.location-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    min-height: 100px;
}

.empty-state-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    background-color: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    color: #6c757d;
}

.location-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    position: relative;
}

    .location-card h5 {
        margin-bottom: 5px;
        color: #0056b3;
    }

    .location-card .location-address {
        font-size: 0.9em;
        color: #6c757d;
        margin-bottom: 15px;
    }

.renewal-status {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.8em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    background-color: #ffc107;
    color: #333;
}

.location-card .selected-services-list {
    font-size: 0.9em;
    margin-bottom: 15px;
    flex-grow: 1;
}

.location-card .service-entry {
    margin-bottom: 10px;
    padding-left: 5px;
    padding-top: 5px;
    border-top: 1px solid #f0f0f0;
}

.location-card .service-name {
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
}

.location-card .details-summary {
    list-style: none;
    padding-left: 15px;
    font-size: 0.95em;
    color: #555;
}

.location-card .manage-btn {
    align-self: flex-end;
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    overflow-y: auto;
    padding: 20px 0;
}

    .modal-backdrop.hidden {
        display: none;
    }

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0 5px;
}

.modal-step {
    padding: 20px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.modal-validation-errors {
    color: #dc3545;
    font-size: 0.9em;
    margin-right: auto;
    text-align: left;
}

/* Form Elements */
.service-list-flat {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* UPDATED: Increase spacing between service list items */
.service-list-item {
    padding: 15px 15px; /* Increased vertical padding */
    border-bottom: 1px solid #e9ecef; /* Slightly darker border */
    margin-bottom: 10px; /* Add margin below each item */
}

    /* UPDATED: Adjust Subcomponent Indentation/Styling */
    .service-list-item.subcomponent {
        padding-left: 25px; /* Adjusted indentation */
        background-color: #fdfdfd;
        border-left: 3px solid #007bff; /* Added visual indicator */
        margin-left: 10px; /* Indent the whole block slightly */
    }

.service-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 5px;
}

/* UPDATED: Improve spacing/padding within the questions area */
.service-details {
    margin-top: 10px; /* Space below the service label */
    padding: 20px; /* More internal padding */
    padding-left: 20px; /* Consistent padding */
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

    .service-details.hidden {
        display: none;
    }

/* UPDATED: Style Component Headers */
.component-group-header {
    margin-top: 1rem; /* Keep some space above */
    margin-bottom: 0.75rem; /* Add space below header */
    padding-bottom: 5px;
    border-bottom: 1px solid #dee2e6; /* Slightly darker */
    color: #343a40; /* Darker text */
    font-weight: 600; /* Bolder */
    font-size: 1.1em;
}

    .component-group-header:first-of-type {
        margin-top: 0;
    }

.required-indicator {
    color: #dc3545;
    font-weight: bold;
    margin-left: 3px;
}

/* UPDATED: Checkbox/Radio Group Layout Refinements */
.checkbox-group {
    display: grid;
    /* Adjust columns for potentially better wrapping and alignment */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2px 15px; /* Reduced row gap */
    padding-left: 5px; /* Slight indent for the grid */
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 5px;
}

/* NEW: Style form groups within the details section */
.service-details .form-group {
    margin-bottom: 1rem; /* More space below each question group */
}

    .service-details .form-group:last-child {
        margin-bottom: 0; /* No extra margin after the last question */
    }

/* NEW: Improve checkbox/radio group label styling */
.checkbox-group label, .radio-group label {
    font-weight: normal; /* Ensure labels aren't bold */
    display: flex; /* Use flex for better alignment */
    align-items: baseline; /* Align text baseline with checkbox/radio */
    margin-bottom: 0.3rem; /* Space between checkboxes */
}

.checkbox-group input[type="checkbox"], .radio-group input[type="radio"] {
    margin-right: 0.5em; /* Space after the checkbox/radio */
    margin-top: 0.2em; /* Adjust vertical alignment if needed */
}

/* NEW: Improve Multi-Column Checkbox Group Readability */
/* Ensure the main label for the group sits above the grid */
.form-group[data-question-code="TARGET_POP"] > label,
.form-group[data-question-code="SPECIAL_POP"] > label,
.form-group[data-question-code="PUBLIC_FUNDERS"] > label,
.form-group[data-question-code="PRIVATE_FUNDERS"] > label {
    display: block; /* Make label take full width */
    margin-bottom: 0.5rem; /* Space before the checkbox grid */
    font-weight: 500; /* Slightly bolder label */
}

/* NEW: Limit width of number/text inputs where appropriate */
.service-details input[type="number"],
.service-details input[type="text"] {
    max-width: 250px; /* Prevent excessive width */
}

.service-details input[data-question-code="CAPACITY"] {
    max-width: 100px; /* Specific width for capacity */
}

.service-details textarea {
    max-width: 100%; /* Allow textarea to use available width */
    min-height: 80px; /* Ensure a reasonable minimum height */
}

/* NEW: Clearer separation for the 'Other' text input */
.other-input {
    grid-column: 1 / -1; /* Make 'Other' description span all columns if using grid */
    padding-left: 20px; /* Indent it under the 'Other' checkbox */
    margin-top: 5px;
    padding-top: 10px;
    border-top: 1px dashed #ccc; /* Separator */
}

    .other-input .form-group {
        margin-bottom: 0; /* Remove extra margin */
    }

.conditional-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #adb5bd;
}

    .conditional-section.hidden {
        display: none;
    }

/* Repeating Groups */
.repeating-group-stub {
    border: 1px solid #e0e0e0;
    padding: 15px;
    margin-top: 15px;
    margin-bottom: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

    .repeating-group-stub .form-group {
        display: grid;
        grid-template-columns: 2.5fr 1.5fr 1.5fr auto;
        gap: 10px 15px;
        align-items: end;
        margin-bottom: 10px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }

.validation-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.validation-summary {
    color: #dc3545;
    font-size: 0.9em;
    font-weight: bold;
}

.status-message {
    font-style: italic;
    color: #28a745;
}

/* NEW: Focus state improvements for form elements */
.service-details input:focus,
.service-details select:focus,
.service-details textarea:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

/* NEW: Better form field groups and labels */
.form-group > label {
    display: block;
    margin-bottom: 0.1rem;
    font-weight: 500;
    color: #495057;
    min-height: 15px;
}

/* NEW: Make the "Add New Component" button more prominent */
.btn-add-service {
    margin-bottom: 15px;
    padding: 8px 16px;
    font-weight: 500;
}

/* NEW: Improve empty state message */
.empty-state-message {
    padding: 40px 20px;
    text-align: center;
    font-size: 1.1em;
    color: #6c757d;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 6px;
    margin: 10px 0 20px;
}

/* NEW: Better display of configured services in the location card */
.selected-services-list ul {
    padding-left: 20px;
    margin-top: 5px;
}

.selected-services-list li {
    margin-bottom: 8px;
}

/* NEW: Improve "Manage Components" button styling */
.manage-services-btn {
    padding: 5px 12px;
    font-size: 0.9em;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    color: #495057;
    border-radius: 4px;
    transition: all 0.2s ease;
}

    .manage-services-btn:hover {
        background-color: #e9ecef;
        border-color: #adb5bd;
        color: #212529;
    }

/* NEW: Required field visual indicator improvements */
.required-field label::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* NEW: Validation message improvements */
.validation-message {
    color: #c71a1a !important;
    font-size: 0.85em;
    margin-top: 0.25rem;
}

/* NEW: Save button improvement in the modal */
.btn-save-changes {
    font-weight: 500;
    padding: 8px 16px;
}


/* Checkbox/Label Spacing Fix */
.checkbox-group label,
.radio-group label,
.service-label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: normal;
}

    .checkbox-group input[type="checkbox"],
    .radio-group input[type="radio"],
    .service-label input[type="checkbox"] {
        margin-right: 0.75rem;
        margin-top: 0.25rem; /* Align slightly from the top for better visual alignment */
        min-width: 16px; /* Ensure consistent width */
    }

/* Blue Border Refinement */
/* Option 1: Keep only for subcomponents but make it more subtle */
.service-list-item.subcomponent {
    padding-left: 20px;
    background-color: #fafafa;
    border-left: 3px solid #e9ecef;
    margin-left: 0; /* Remove the indent - this was causing uneven spacing */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Subtle shadow for depth */
}

/* Option 2: Alternative - use different visual indicator for all items */
.service-list-item {
    border-left: 3px solid transparent; /* Transparent border for spacing consistency */
    transition: border-color 0.2s ease;
}

    .service-list-item:hover {
        border-left-color: #007bff; /* Subtle hover indicator */
    }

/* Component Headers Improvement */
.component-group-header {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
    padding-bottom: 5px;
    border-bottom: 1px solid #dee2e6;
    color: #343a40;
    font-weight: 600;
    font-size: 1.1em;
}

/* Better spacing in checkbox groups */
.checkbox-group {
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Improve form field spacing */
.service-details .form-group {
    margin-bottom: 1.25rem;
}

    .service-details .form-group:last-child {
        margin-bottom: 0;
    }

/* Better visual spacing for the service-details sections */
.service-details {
    margin-top: 12px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

    /* Better form control styling */
    .service-details input.form-control,
    .service-details textarea.form-control,
    .service-details select.form-control {
        border-color: #ced4da;
        padding: 0.5rem 0.75rem;
    }

        /* Improved focus state */
        .service-details input.form-control:focus,
        .service-details textarea.form-control:focus,
        .service-details select.form-control:focus {
            border-color: #80bdff;
            box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        }

/* Better required indicator */
.required-indicator {
    color: #dc3545;
    font-weight: bold;
    margin-left: 4px;
}

/* Radio buttons need special treatment */
.radio-group {
    margin-top: 0.5rem;
}

/* Better spacing for labels and other form elements */
.form-group > label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
    min-height: 15px;
}

/* Improved heading styles for service sections */
h5.component-group-header {
    color: #0056b3;
    border-bottom-color: #cfe2ff;
}

/* Card Container */
.location-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}

    .location-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }

    /* Card Header */
    .location-card h5 {
        margin-bottom: 5px;
        color: #0056b3;
        font-size: 1.25rem;
        font-weight: 600;
    }

    .location-card .location-address {
        font-size: 0.9em;
        color: #6c757d;
        margin-bottom: 20px;
        font-style: italic;
    }

    /* Services Section Header */
    .location-card .selected-services-list > strong {
        display: block;
        margin-bottom: 12px;
        padding-bottom: 6px;
        border-bottom: 1px solid #e9ecef;
        color: #495057;
    }

    /* Service Entry Styling */
    .location-card .service-entry {
        margin-bottom: 16px;
        padding: 12px;
        background-color: #f8f9fa;
        border-radius: 6px;
        border-left: 3px solid #007bff;
    }

    .location-card .service-name {
        font-weight: 600;
        display: block;
        margin-bottom: 8px;
        color: #343a40;
        font-size: 1.05em;
    }

    /* Detailed Info List */
    .location-card .details-summary {
        list-style: none;
        padding-left: 10px;
        margin-bottom: 0;
    }

        .location-card .details-summary li {
            display: grid; /* Use Grid Layout */
            grid-template-columns: 140px 1fr; /* Label column fixed width, Value takes remaining space */
            gap: 0 8px; /* Optional: Gap between label and value columns */
            align-items: baseline; /* Align text baselines */
            margin-bottom: 8px; /* Keep vertical spacing */
            line-height: 1.4;
        }

            .location-card .details-summary li:last-child {
                margin-bottom: 0;
            }

        .location-card .details-summary .label {
            font-weight: 500;
            color: #495057;
            /* min-width: 140px; */ /* No longer needed, width set by grid */
            /* margin-right: 8px; */ /* No longer needed, gap set by grid */
            /* display: inline-block; */ /* No longer needed */
            /* Label automatically goes into the first grid column */
        }

        .location-card .details-summary .value {
            /* Value automatically goes into the second grid column */
            overflow-wrap: break-word; /* Allow long words/text to break and wrap */
            word-break: break-word; /* Alternative breaking */
            /* You might need hyphens for better appearance, but it's complex */
            /* hyphens: auto; */
        }


    /* Better Manage Button */
    .location-card .manage-btn {
        align-self: flex-end;
        margin-top: 16px;
        padding: 6px 12px;
        background-color: #6c757d;
        color: white;
        border: none;
        border-radius: 4px;
        font-weight: 500;
        transition: background-color 0.2s ease;
    }

        .location-card .manage-btn:hover {
            background-color: #5a6268;
        }

    /* Empty state styling */
    .location-card .no-services {
        padding: 15px;
        background-color: #f8f9fa;
        border-radius: 4px;
        color: #4E545A !important;
        font-style: italic;
        text-align: center;
    }

/* Renewal status indicator */
.renewal-status {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.8em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 4px;
    background-color: #ffc107;
    color: #333;
}

/* Make the labels stack above the content on small screens */
@media (max-width: 576px) {
    .location-card .details-summary li {
        /*         Example: Stack columns on small screens */
        grid-template-columns: 1fr;
        gap: 4px 0;
    }

    .location-card .details-summary .label {
        margin-bottom: 4px;
        min-width: auto;
    }

    .location-card {
        padding: 15px;
    }
}

.weekly-hours-table th, .weekly-hours-table td {
    vertical-align: middle;
}

.weekly-hours-table .form-check-input {
    margin: auto;
    display: block;
}

.weekly-hours-table input[type="time"]:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* --- Style Polish Additions --- */

/* 1. Weekly Hours Table Enhancements */
.weekly-hours-table thead th {
    background-color: #f8f9fa; /* Light background for header */
    font-weight: 600; /* Slightly bolder header text */
    border-bottom-width: 2px; /* Emphasize header bottom border */
    text-align: center; /* Center header text */
    vertical-align: middle;
}

.weekly-hours-table th:first-child {
    text-align: left; /* Keep day names left-aligned */
}

.weekly-hours-table tbody tr:hover {
    background-color: #f1f1f1; /* Subtle hover effect for rows */
}

.weekly-hours-table td {
    vertical-align: middle; /* Ensure vertical centering */
    padding: 0.4rem 0.5rem; /* Adjust padding slightly if needed */
}

/* Ensure time inputs don't get too small */
.weekly-hours-table input[type="time"] {
    min-width: 100px;
}

/* Center the checkbox within its cell */
.weekly-hours-table td:nth-child(2) { /* Target the 'Closed All Day' cell */
    text-align: center;
}

    .weekly-hours-table td:nth-child(2) input[type="checkbox"] {
        margin: auto; /* Helps centering */
    }


/* 2. Checkbox Size Adjustment */
/* Increase size slightly and ensure vertical alignment */
input[type="checkbox"].form-check-input,
input[type="checkbox"].mt-1.me-2 /* Target specific common classes used */ {
    width: 1.1rem; /* Slightly larger width */
    height: 1.1rem; /* Slightly larger height */
    margin-top: 0.15rem; /* Adjust top margin for better baseline alignment with text */
    vertical-align: top; /* Helps alignment in some flex contexts */
    cursor: pointer; /* Explicitly set cursor */
}
/* Increase clickable area around checkboxes by padding the label slightly more if needed */
/* label:has(input[type="checkbox"].form-check-input) { */
/* padding-top: 0.1rem; */
/* padding-bottom: 0.1rem; */
/* } */


/* 3. Other Easy Wins */

/* Add more visual separation for Component Headers (h5) in the modal */
.modal-body h5.component-group-header {
    margin-top: 1.5rem; /* Increase space above headers */
    padding-top: 0.5rem;
    border-top: 1px solid #dee2e6; /* Add a top border */
}

    .modal-body h5.component-group-header:first-of-type {
        margin-top: 0.5rem; /* Less space for the very first header */
        border-top: none;
    }

/* Slightly more space between general form groups in the details section */
.service-details > .form-group {
    margin-bottom: 1.5rem; /* Increase spacing */
}

/* Tone down the 'Select All' label boldness if desired */
.multi-checkbox-group-container .select-all-option label {
    /* font-weight: normal; */ /* Uncomment if you want it less bold */
}

/* Style for highlighting rows with errors */
.table-danger-light {
    background-color: #f8d7da !important; /* Light red background, !important might be needed to override hover */
    border-color: #f5c6cb;
}

    .table-danger-light:hover {
        background-color: #f3c6c9 !important; /* Slightly darker red on hover */
    }
