/* Layout Structure */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}


#wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    align-items: stretch;
}

/* Sidebar styling */
#sidebar-wrapper {
    height: 100vh;
    width: 250px;
    min-width: 250px;
    margin-left: 0;
    transition: margin 0.25s ease-out;
    background: #343a40;
    color: white;
    display: flex;
    flex-direction: column;
}

#sidebar-wrapper .sidebar-heading {
    padding: 1.15rem 1.25rem;
    font-size: 1.2rem;
    flex-shrink: 0;
}

#sidebar-wrapper .list-group {
    flex: 1;
    overflow-y: auto;
}

.list-group-item {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 0.75rem 1.25rem;
}

.list-group-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.list-group-item.active {
    background: #007bff;
    color: white;
}

/* Page Content Structure */
#page-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0; /* Important for flex child with overflow */
}

.navbar {
    padding: 0.5rem 1rem;
    flex-shrink: 0;
    background-color: #fff;
    z-index: 1000;
}

#main-scroll-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.container-fluid-content {
    flex: 1;
    padding: 1.5rem;
}

footer {
    flex-shrink: 0;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
}

/* Desktop Toggle Logic */
body.toggled #sidebar-wrapper {
    margin-left: -250px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -250px;
        position: absolute;
        z-index: 1050;
    }
    body.toggled #sidebar-wrapper {
        margin-left: 0;
    }
}

/* Hamburger Animation */
.hamburger-icon {
    width: 20px;
    height: 14px;
    position: relative;
    transform: rotate(0deg);
    transition: .5s ease-in-out;
    cursor: pointer;
}

.hamburger-icon span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: #6c757d;
    border-radius: 9px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

/* Default state (Sidebar OPEN) -> X Mark */
.hamburger-icon span:nth-child(1) {
    top: 6px;
    transform: rotate(135deg);
}

.hamburger-icon span:nth-child(2) {
    top: 6px; /* Added back to ensure correct positioning when transitioning */
    opacity: 0;
    left: -40px;
}

.hamburger-icon span:nth-child(3) {
    top: 6px;
    transform: rotate(-135deg);
}

/* Toggled state (Sidebar CLOSED) -> 3 Lines */
body.toggled .hamburger-icon span:nth-child(1) {
    top: 0px;
    transform: rotate(0deg);
}

body.toggled .hamburger-icon span:nth-child(2) {
    top: 6px; /* Added back to ensure 3 lines are visible */
    opacity: 1;
    left: 0;
}

body.toggled .hamburger-icon span:nth-child(3) {
    top: 12px;
    transform: rotate(0deg);
}

#sidebarToggle:hover .hamburger-icon span {
    background: #5a6268;
}

.btn-outline-secondary:hover .hamburger-icon span {
    background: #fff;
}

/* Dashboard Cards */
.card-counter {
    box-shadow: 2px 2px 10px #DADADA;
    margin: 5px;
    padding: 20px 10px;
    background-color: #fff;
    height: 100px;
    border-radius: 5px;
    transition: .3s linear all;
    position: relative;
}

.card-counter:hover {
    box-shadow: 4px 4px 20px #DADADA;
}

.card-counter.primary { background-color: #007bff; color: #FFF; }
.card-counter.danger { background-color: #ef5350; color: #FFF; }
.card-counter.success { background-color: #66bb6a; color: #FFF; }
.card-counter.info { background-color: #26c6da; color: #FFF; }
.card-counter.warning { background-color: #ffa726; color: #FFF; }

.card-counter i {
    font-size: 5em;
    opacity: 0.2;
}

.card-counter .count-numbers {
    position: absolute;
    right: 35px;
    top: 20px;
    font-size: 32px;
    display: block;
}

.card-counter .count-name {
    position: absolute;
    right: 35px;
    top: 65px;
    font-style: italic;
    text-transform: capitalize;
    opacity: 0.5;
    display: block;
    font-size: 18px;
}

/* Requests list: row opens edit/details on click */
.request-row {
    cursor: pointer;
}

.table.matrix-edit-mode .request-row {
    cursor: default;
}

.request-row .btn,
.request-row .form-check-input {
    cursor: default;
}

/* Test results list: row opens detail view on click */
.test-result-row {
    cursor: pointer;
}

/* Requests list: keep action buttons on one line */
.request-actions-cell {
    white-space: nowrap;
    width: 1%;
    min-width: 8.75rem;
}

.request-actions-group {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
}

.request-actions-group form {
    display: inline-flex;
    margin: 0;
}

/* Requests list: column order drag handles in Columns dropdown */
#col-order-list .col-order-item {
    cursor: grab;
    border: 1px solid transparent;
}

#col-order-list .col-order-item:active {
    cursor: grabbing;
}

#col-order-list .col-order-item-dragging {
    opacity: 0.55;
}

#col-order-list .col-order-item-drag-over {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.08);
}

#col-order-list .col-order-handle {
    width: 0.875rem;
    text-align: center;
    flex-shrink: 0;
}

/* Requests list: grip icon on column headers to reorder */
#requestsIndexTable thead th .requests-col-drag-handle {
    display: inline-flex;
    align-items: center;
    margin-right: 0.35rem;
    color: #6c757d;
    cursor: grab;
    vertical-align: middle;
    user-select: none;
}

#requestsIndexTable thead th .requests-col-drag-handle:active,
#requestsIndexTable thead th .requests-col-drag-handle-active {
    cursor: grabbing;
}

#requestsIndexTable thead th.requests-th-dragging {
    opacity: 0.55;
}

#requestsIndexTable thead th.requests-th-drag-over {
    box-shadow: inset 0 -3px 0 #0d6efd;
}

/* Test results list: column order drag handles in Columns dropdown */
#test-result-col-order-list .col-order-item {
    cursor: grab;
    border: 1px solid transparent;
}

#test-result-col-order-list .col-order-item:active {
    cursor: grabbing;
}

#test-result-col-order-list .col-order-item-dragging {
    opacity: 0.55;
}

#test-result-col-order-list .col-order-item-drag-over {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.08);
}

#test-result-col-order-list .col-order-handle {
    width: 0.875rem;
    text-align: center;
    flex-shrink: 0;
}

/* Test results list: grip icon on column headers to reorder */
#test-results-list-table thead th .test-results-col-drag-handle {
    display: inline-flex;
    align-items: center;
    margin-right: 0.35rem;
    color: #6c757d;
    cursor: grab;
    vertical-align: middle;
    user-select: none;
}

#test-results-list-table thead th .test-results-col-drag-handle:active,
#test-results-list-table thead th .test-results-col-drag-handle-active {
    cursor: grabbing;
}

#test-results-list-table thead th.test-results-th-dragging {
    opacity: 0.55;
}

#test-results-list-table thead th.test-results-th-drag-over {
    box-shadow: inset 0 -3px 0 #0d6efd;
}

/* Request create/edit: scroll inside card body; keep header/footer fixed */
form.request-form {
    display: block;
}

.request-form-card {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 11rem);
}

.request-form-card .card-header,
.request-form-card .card-footer {
    flex-shrink: 0;
}

.request-form-card .card-footer {
    background-color: #f6f7f9;
    border-top: 1px solid #e9ecef;
}

.request-form-card .request-form-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

/* Request create/edit: checkboxes aligned with label-on-top fields */
.request-form .request-checkbox-control {
    display: flex;
    align-items: center;
    min-height: calc(1.5em + 0.75rem + 2px);
}

.request-form .request-checkbox-control .form-check-input {
    margin: 0;
    float: none;
}

/* Request create/edit: muted placeholders vs entered values */
.request-form .form-control::placeholder,
.request-form textarea.form-control::placeholder {
    color: #adb5bd;
    opacity: 1;
}

.request-form .form-control::-moz-placeholder,
.request-form textarea.form-control::-moz-placeholder {
    color: #adb5bd;
    opacity: 1;
}

.request-form .form-select:has(option[value=""]:checked) {
    color: #adb5bd;
}

.request-form .form-select option {
    color: #212529;
}

.request-form .form-select option[value=""] {
    color: #adb5bd;
}

/* Empty date fields: mute mm/dd/yyyy hint */
.request-form input[type="date"]:blank {
    color: #adb5bd;
}

.request-form input[type="date"]:blank::-webkit-datetime-edit,
.request-form input[type="date"]:blank::-webkit-datetime-edit-fields-wrapper,
.request-form input[type="date"]:blank::-webkit-datetime-edit-text,
.request-form input[type="date"]:blank::-webkit-datetime-edit-month-field,
.request-form input[type="date"]:blank::-webkit-datetime-edit-day-field,
.request-form input[type="date"]:blank::-webkit-datetime-edit-year-field {
    color: #adb5bd;
}

.request-form input[type="date"]:not(:blank) {
    color: #212529;
}

.request-form input[type="date"]:not(:blank)::-webkit-datetime-edit,
.request-form input[type="date"]:not(:blank)::-webkit-datetime-edit-fields-wrapper,
.request-form input[type="date"]:not(:blank)::-webkit-datetime-edit-text,
.request-form input[type="date"]:not(:blank)::-webkit-datetime-edit-month-field,
.request-form input[type="date"]:not(:blank)::-webkit-datetime-edit-day-field,
.request-form input[type="date"]:not(:blank)::-webkit-datetime-edit-year-field {
    color: #212529;
}

.request-source-provenance input[readonly] {
    cursor: default;
    background-color: #e9ecef;
}

.request-source-provenance input[readonly]::placeholder {
    color: #adb5bd;
    opacity: 1;
}

.request-source-provenance input[readonly]:placeholder-shown {
    color: #adb5bd;
}

.request-source-chevron {
    transition: transform 0.2s ease;
}

.request-source-provenance button[aria-expanded="true"] .request-source-chevron {
    transform: rotate(180deg);
}

.test-result-json {
    font-size: 0.75rem;
    max-height: 14rem;
    overflow: auto;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

.test-result-row-block + .test-result-row-block {
    border-top: 1px solid #e9ecef;
    padding-top: 0.75rem;
}
