/* Make service table scrollable and create button fixed */
.service-table-scroll {
    max-height: 420px;
    overflow-y: auto;
}

.create-service-fixed {
    position: fixed;
    bottom: 30px;
    right: 40px;
    z-index: 1055;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
:root {
    --company-green: #65bd25;
    --company-green-darker: #489c0c;
    --background-grey: #B6B6B6;

    /* CSS HSL */
    --kelly-green: hsla(95, 67%, 45%, 1);
    --cinereous: hsla(28, 13%, 60%, 1);
    --liver: hsla(12, 16%, 31%, 1);
    --redwood: hsla(14, 30%, 43%, 1);
    --caput-mortuum: hsla(4, 40%, 25%, 1);

    /* CSS HEX */
    --kelly-green: #65bd26ff;
    --jet: #353535ff;
    --white: #ffffffff;
    --french-gray: #d2d7dfff;
    --carrot-orange: #f19a3eff;
}

.container {
    max-width: 400px;
    margin: auto;
    padding: 20px;
    border-radius: 5px;
    /* background-color: var(--background-grey); */
}

.app-header-top {
    max-width: 1320px;
    margin: 0 auto 0.75rem;
    padding: 0.75rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.app-header-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.app-header-logo {
    width: clamp(180px, 30%, 320px);
    max-width: 100%;
    height: auto;
    margin: 0;
}

.app-header-user {
    margin-left: auto;
    text-align: right;
    line-height: 1.25;
}

.app-header-user p {
    margin: 0;
}

.app-header-user-welcome {
    font-weight: 600;
}

.app-header-user-meta {
    font-size: 0.95rem;
    color: var(--jet);
}

.header-container {
    max-width: 1320px;
    margin: auto;
    padding: 10px;
    background-color: var(--company-green);
    color: var(--white);
    font-size: large;
    border-radius: 5px;
}

.app-header-nav-desktop,
.app-header-mobile-links {
    margin-top: 0;
}

.header-container nav a,
.app-header-toggle {
    color: var(--white);
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header-container nav a {
    margin: auto 10px;
}

.header-container nav a:hover,
.header-container nav a:active,
.header-container nav a:focus,
.app-header-toggle:hover,
.app-header-toggle:focus {
    background-color: rgba(255, 255, 255, 0.8);
    color: var(--company-green);
}

.header-container .nav-link.active {
    background-color: rgba(255, 255, 255, 0.18);
    font-weight: 600;
}

.app-header-nav-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.app-header-toggle {
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    font-weight: 600;
}

.app-header-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header-mobile-links {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.25rem;
}

.app-header-mobile-links .nav-link {
    margin: 0;
    padding: 0.8rem 0.9rem;
    text-align: left;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-item.dropdown:hover .nav-link,
.nav-item.dropdown .nav-link.show,
.nav-item.dropdown .nav-link[aria-expanded="true"] {
    color: var(--company-green) !important;
    background-color: rgba(255, 255, 255, 0.8) !important;
}

.dropdown-item {
    background-color: black;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
}

#add-movement-button {
    background-color: white;
    color: var(--company-green);
    font-size: large;
    font-weight: bold;
    border: 0px;
}

thead {
    position: sticky;
    top: 0px;
    background-color: white;
}

/* Mobile-friendly styles */
.mobile-button-height {
    min-height: 44px;
    padding-top: 0.4rem !important;
    padding-bottom: 0.4rem !important;
}

.mobile-action-btn {
    min-width: 44px;
    min-height: 44px;
}

.service-actions {
    row-gap: 0.25rem;
}

.service-action-menu-floating {
    position: fixed !important;
    right: auto !important;
    margin: 0 !important;
    z-index: 1060;
    max-height: min(360px, calc(100vh - 16px));
    overflow-y: auto;
}

.mobile-action-note {
    padding: 0.45rem 1rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.35;
    color: #6c757d;
    list-style: none;
}

.service-filter-card {
    border-radius: 0.65rem;
}

.service-filter-card-header {
    padding: 0.5rem 0.75rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.service-filter-toggle {
    width: 100%;
    min-height: 40px;
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--jet);
    font-weight: 600;
    background: transparent;
    border: 0;
}

.service-filter-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.service-filter-toggle:hover,
.service-filter-toggle:focus {
    color: var(--jet);
}

.service-filter-toggle-icon {
    transition: transform 0.2s ease;
}

.service-filter-toggle[aria-expanded="true"] .service-filter-toggle-icon {
    transform: rotate(180deg);
}

.service-filter-card-body {
    padding: 0.85rem 1rem;
}

.service-filter-row {
    align-items: end;
}

.service-filter-row .form-label,
.filter-button-label-spacer {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.service-filter-control {
    min-height: 36px;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.9rem;
}

.service-filter-status {
    min-height: 0;
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
}

/* Filter form button alignment */
.filter-button-wrapper {
    align-items: flex-start !important;
    flex-direction: column;
}

.filter-button-stack {
    width: 100%;
}

.filter-button-label-spacer {
    visibility: hidden;
}

.filter-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 36px;
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    font-size: 0.9rem;
}

.service-datetime-picker {
    display: grid;
    gap: 0.4rem;
    max-width: 500px;
}

.service-datetime-picker .service-datetime-row {
    display: flex !important;
    align-items: center;
    flex-wrap: nowrap !important;
    gap: 0.375rem;
}

.service-datetime-picker .service-datetime-row > .form-control {
    flex: 1 1 145px !important;
    min-width: 0 !important;
    width: auto !important;
}

.service-datetime-picker .service-time-select {
    flex: 0 0 66px !important;
    width: 66px !important;
    min-width: 66px !important;
}

.service-time-separator {
    color: #6c757d;
    font-weight: 700;
}

.service-time-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.service-time-shortcuts .btn {
    min-height: 32px;
    min-width: 58px;
    padding: 0.25rem 0.625rem;
}

/* Service table responsive adjustments */
.service-table-scroll {
    max-height: 420px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    font-size: 0.9rem;
}

.table td {
    padding: 0.5rem 0.5rem;
    line-height: 1.4;
}

.table th {
    padding: 0.5rem 0.5rem;
}

/* Mobile form improvements */
@media (max-width: 767px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }

    .table-responsive {
        margin-right: -10px;
        margin-left: -10px;
    }

    .table {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    .table td {
        padding: 0.4rem 0.25rem;
        word-break: break-word;
    }

    .table th {
        padding: 0.4rem 0.25rem;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .form-select,
    .form-control {
        font-size: 1rem;
        min-height: 44px;
    }

    .service-datetime-picker .service-datetime-row {
        gap: 0.25rem;
    }

    .service-datetime-picker .service-datetime-row > .form-control {
        flex-basis: 135px !important;
    }

    .service-datetime-picker .service-time-select {
        flex-basis: 62px !important;
        width: 62px !important;
        min-width: 62px !important;
    }

    .service-filter-card-body {
        padding: 0.75rem;
    }

    .service-filter-card {
        margin-bottom: 0.75rem !important;
    }

    .service-filter-collapse {
        border-top: 1px solid rgba(0, 0, 0, 0.04);
    }

    .service-filter-row .form-label,
    .filter-button-label-spacer {
        font-size: 0.74rem;
    }

    .service-filter-control,
    .filter-button {
        min-height: 40px;
        font-size: 0.95rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.3rem 0.5rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }

    /* Dropdown menu alignment for mobile */
    .dropdown-menu {
        position: fixed;
        right: 10px !important;
        left: auto !important;
        max-width: calc(100vw - 20px);
    }

    .dropdown-item {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Make modals mobile-friendly */
    .modal {
        --bs-modal-margin: 0;
        --bs-modal-width: 100%;
        --bs-modal-padding: 0;
    }

    .modal-dialog {
        margin: 0;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .modal-content {
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        max-height: 100vh;
    }

    .modal-header {
        padding: 1rem 0.75rem;
        flex-shrink: 0;
    }

    .modal-body {
        padding: 1rem 0.75rem;
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }

    .modal-footer {
        padding: 0.75rem;
        gap: 0.25rem;
        flex-shrink: 0;
    }

    .modal-footer .btn {
        flex: 1;
        min-height: 44px;
        font-size: 0.9rem;
    }

    .row {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    .col-md-6,
    .col-md-4 {
        padding: 0.25rem;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    .table {
        font-size: 0.9rem;
    }

    .table td {
        padding: 0.5rem 0.3rem;
    }

    .col-md-3 {
        flex: 0 0 calc(50% - 0.75rem);
    }

    .col-md-2 {
        flex: 0 0 calc(50% - 0.75rem);
    }
}

/* Header mobile improvements */
@media (max-width: 767px) {
    .app-header-top {
        padding: 0.5rem 10px;
        margin-bottom: 0.5rem;
        align-items: flex-start;
    }

    .app-header-logo {
        width: min(180px, 48vw);
    }

    .app-header-user {
        font-size: 0.85rem;
        text-align: right;
        max-width: 50%;
    }

    .app-header-user-welcome {
        font-size: 0.95rem;
    }

    .app-header-user-meta {
        font-size: 0.8rem;
    }

    .header-container {
        margin: auto;
        padding: 8px 10px;
        border-radius: 10px;
    }

    .alert {
        min-width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        transform: none !important;
        right: 0 !important;
        border-radius: 0;
    }
}
