﻿/* ===========================================
   Progress Steps
   =========================================== */

.progress-container {
    display: block;
    color: inherit;
    padding: 0.5rem 1rem;
    border-radius: var(--bs-border-radius-xl) !important;
    position: relative;
    z-index: 2; /* must stay to be above Bootstrap stretched-link::after (z-index: 1) */
}

.progress-steps {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    margin: 0;
}

.step {
    display: flex;
    align-items: center;
    flex: 1 1 0%;
    min-width: 0;
}

.step:last-child {
    flex: 0 0 auto;
}

.step-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step-icon i.bi {
    font-size: 1.2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

a.step-icon {
    color: white;
    text-decoration: none;
}

a.step-icon:hover {
    color: white;
    transform: scale(1.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.step-connector {
    flex: 1 0 12px;
    height: 2px;
    margin: 0 -1px;
}

.step:last-child .step-connector {
    display: none;
}

/* Step Status: Completed */
.step.completed .step-icon {
    background-color: #198754;
    border: 2px solid #198754;
}

.step.completed .step-connector {
    background-color: #198754;
}

.step.completed:has(+ .step.in-progress) .step-connector {
    background: linear-gradient(to right, #198754, #fd7e14);
}

.step.completed:has(+ .step.rejected) .step-connector {
    background: linear-gradient(to right, #198754, #dc3545);
}

/* Step Status: In-Progress */
.step.in-progress .step-icon {
    background-color: #fd7e14;
    border: 2px solid #fd7e14;
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.25);
}

.step.in-progress:has(+ .step.pending) .step-connector {
    background: linear-gradient(to right, #fd7e14, #dee2e6);
}

/* Step Status: Rejected */
.step.rejected .step-icon {
    background-color: #dc3545;
    border: 2px solid #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

/* Step Status: Pending */
.step.pending .step-icon {
    background-color: #6c757d;
    border: 2px solid #6c757d;
}

.step.pending .step-connector {
    background-color: #dee2e6;
}

/* ===========================================
   Case Filters Layout
   =========================================== */

.case-filters-container {
    width: 100%;
}

/* Main Row - Desktop: alles in einer Zeile */
.case-filter-main-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

/* Filter Buttons Container */
.case-filter-buttons {
    min-width: 0;
}

.case-filter-grow {
    flex: 1 1 auto;
}

.case-filter-buttons .btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

.case-filter-buttons .btn-group .btn {
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* Search and Dropdowns Container */
.case-filter-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
}

.case-search-form {
    max-width: 400px;
    min-width: 200px;
    flex: 2 2 auto;
}

.case-filter-dropdowns {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.case-filter-dropdowns .dropdown button {
    white-space: nowrap;
}

.case-filter-dropdowns .dropdown .dropdown-btn-text {
    display: inline;
}

.case-filter-dropdowns .dropdown .dropdown-text {
    display: inline-block;
    max-width: 15ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.authorityApprovedMinEndDate-form .input-group {
    width: fit-content;
}

.authorityApprovedMinEndDate-form input[type="date"] {
    max-width: 8rem;
    flex: 0 0 11rem;
}

/* ===========================================
   Case Cards
   =========================================== */

.case-card.case-action-required {
    background-color: rgba(253, 126, 20, 0.11);
}

/* ===========================================
   Rent Table
   =========================================== */

@media (min-width: 577px) {
    .rent-table-responsive {
        overflow-x: visible;
    }

    .rent-table-responsive table.table {
        overflow-y: visible;
    }
}

/* ===========================================
   Responsive: Mobile (max-width: 576px)
   =========================================== */

@media (max-width: 576px) {
    /* Main Row - Stack everything vertically on mobile */
    .case-filter-main-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Filter Buttons - Mobile Layout */
    .case-filter-buttons {
        width: 100%;
    }

    .case-filter-buttons .btn-group {
        justify-content: center;
    }

    .case-filter-buttons .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }

    /* Search and Controls - Stack Vertically on Mobile */
    .case-filter-controls {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .case-search-form {
        width: 100%;
    }

    .case-filter-dropdowns {
        display: grid;
        grid-template-columns: 2fr 2fr 3.5rem;
        gap: 0.5rem;
        width: 100%;
    }

    .case-filter-dropdowns .dropdown {
        min-width: 0;
        width: 100%;
    }

    .case-filter-dropdowns .dropdown button {
        width: 100%;
        justify-content: space-between;
    }

    .case-search-form {
        max-width: unset;
    }

    /* ===========================================
   Responsive: Mobile (max-width: 472px)
   =========================================== */

    @media (max-width: 472px) {
        .case-filter-buttons .btn-group .btn:first-child {
            border-top-left-radius: 0;
            border-bottom-left-radius: 0;
            margin-left: calc(var(--bs-border-width) * -1);
        }
        
        .case-filter-buttons .btn-group .btn:last-child {
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
        }
    }

    /* Progress Steps - Mobile Layout (3 steps visible, scrollable) */
    .progress-container {
        padding: 0.25rem 0.25rem;
        position: relative;
        overflow: clip;
    }

    /* Fade edges to hint at scrollability */
    .progress-container::before,
    .progress-container::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 16px;
        z-index: 3;
        pointer-events: none;
    }

    .progress-container::before {
        left: 0;
        border-radius: var(--bs-border-radius-xl) 0 0 var(--bs-border-radius-xl);
        background: linear-gradient(to right, rgba(var(--bs-light-rgb), 1), rgba(var(--bs-light-rgb), 0));
    }

    .progress-container::after {
        right: 0;
        border-radius: 0 var(--bs-border-radius-xl) var(--bs-border-radius-xl) 0;
        background: linear-gradient(to left, rgba(var(--bs-light-rgb), 1), rgba(var(--bs-light-rgb), 0));
    }

    .progress-steps {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x; /* ensure horizontal touch scroll works everywhere */
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        padding: 0.75rem 0;
        flex-wrap: nowrap;
    }

    .progress-steps::-webkit-scrollbar {
        display: none;
    }

    /* Each step = 1/3 of viewport, icon centered inside */
    .step {
        flex: 0 0 calc(100% / 3);
        justify-content: center;
        position: relative;
        scroll-snap-align: center;
    }

    .step:last-child {
        flex: 0 0 calc(100% / 3);
    }

    .step-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        position: relative;
        z-index: 2;
    }

    .step-icon i.bi {
        font-size: 1.05rem;
    }

    /* Connector: absolutely positioned from this icon's right edge to the next icon's left edge */
    .step-connector {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: calc(50% + 18px);       /* step center + half icon width (36/2) */
        width: calc(100% - 36px);      /* full step width minus one icon width */
        height: 2px;
        flex: none;
        min-width: unset;
        margin: 0;
    }

    .step:last-child .step-connector {
        display: none;
    }
}

/* ===========================================
   Responsive: Tablet (577px - 992px)
   =========================================== */

@media (min-width: 577px) and (max-width: 992px) {
    /* Filter Buttons - Slightly smaller on tablets */
    .case-filter-buttons .btn-group .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.65rem;
    }

    /* Search form - smaller on medium screens */
    .case-search-form {
        width: 220px;
        min-width: 180px;
    }

    /* Progress Steps - Tablet Layout */
    .step-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .step-icon i.bi {
        font-size: 1.1rem;
    }

    .progress-steps {
        padding: 0.5rem 0.5rem;
    }
}

/* ===========================================
   Responsive: Small Tablets (577px - 768px)
   =========================================== */

@media (min-width: 577px) and (max-width: 768px) {
    /* On smaller tablets, wrap to second line if needed */
    .case-filter-main-row {
        gap: 0.5rem;
    }

    .case-filter-buttons {
        flex: 1 1 100%;
    }

    .case-filter-controls {
        flex: 1 1 100%;
        justify-content: space-between;
    }

    .case-search-form {
        flex: 1 1 auto;
        min-width: 150px;
    }
}

/* ===========================================
   Responsive: Medium Screens (769px - 1199px)
   =========================================== */

@media (min-width: 769px) and (max-width: 1199px) {
    /* Smaller button text on medium screens */
    .case-filter-buttons .btn-group .btn {
        font-size: 0.85rem;
        padding: 0.45rem 0.6rem;
    }
}

/* ===========================================
   Responsive: Large Screens (1200px+)
   =========================================== */

@media (min-width: 1200px) {
    /* Full size buttons on large screens */
    .case-filter-buttons .btn-group .btn {
        font-size: 0.9rem;
        padding: 0.5rem 0.85rem;
    }
}

