/* --- Base Layout --- */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
    background-color: #f4f6f8;
    color: #333333;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex-grow: 1;
    padding: 0;
    margin: 0;
}

/* --- Components --- */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.footer-custom {
    background-color: #e9ecef;
    color: #333333;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- HTMX & Loading States --- */
.htmx-indicator {
    display: none;
}

.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 20; /* High enough to sit above action-icons */
    display: none; /* Controlled by htmx-indicator class */
}

.spinner-overlay.htmx-request {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-overlay .spinner-border {
    color: var(--bs-primary, #0d6efd) !important;
}

.loading-container.htmx-request {
    opacity: 0.5;
    transition: opacity 300ms ease-in-out;
    pointer-events: none;
}

tr.htmx-request .action-icons {
    visibility: hidden;
}

/* --- Tables --- */
.table {
    table-layout: fixed;
    width: 100%;
}

.table thead th {
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: normal;
    vertical-align: middle;
}

/* Global right-alignment for Action Headers */
.table thead th.text-end {
    text-align: right !important;
    padding-right: 0.75rem !important;
}

.table tbody td {
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
    overflow-wrap: break-word;
}

/* Specific Action Column Logic */
.table td.action-column {
    overflow: visible !important;
    position: relative;
    text-align: right;
}

.action-icons, .accept-decline-icons {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Always hugs the right side */
    gap: 8px;
}

/* --- Icons & Actions --- */
/* Transitions for all icon types */
a.icon img,
.icon-img,
.dropdown-icon {
    transition: transform 0.2s ease, filter 0.2s ease;
    object-fit: contain;
}

/* Main Table Icons */
.action-icons .icon-img {
    width: 25px;
    height: 25px;
}
.accept-decline-icons .icon-img {
    width: 36px;
    height: 36px;
}

/* Hover effects for main icons */
.action-icons .icon-img:hover, .accept-decline-icons,
a.icon:hover img {
    transform: scale(1.15);
    filter: brightness(1.2);
}

/* Icons inside Dropdowns */
.dropdown-item .dropdown-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.dropdown-item:hover .dropdown-icon {
    transform: translateX(3px);
    filter: brightness(1.1);
}

.icon-disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* Remove Bootstrap Dropdown Arrow */
.dropdown-toggle::after,
.dropstart .dropdown-toggle::before {
    display: none !important;
}

/* --- Buttons & UI Colors --- */
.btn-primary-custom {
    background-color: #00a3e0;
    border: 1px solid #00a3e0;
    color: white;
    transition: background-color 0.3s, border-color 0.3s;
}

.btn-primary-custom:hover {
    background-color: #008ec0;
    border-color: #008ec0;
    color: white;
}

.btn-outline-primary-custom {
    background-color: transparent;
    border: 1px solid #00a3e0;
    color: #00a3e0;
    transition: all 0.3s ease;
}

.btn-outline-primary-custom:hover,
.btn-outline-primary-custom:focus {
    background-color: #00a3e0;
    border-color: #00a3e0;
    color: white;
}

.btn-outline-yellow-custom {
    background-color: transparent;
    border: 1px solid #FFC72C;
    color: #FFC72C;
    transition: all 0.3s ease;
}

.btn-outline-yellow-custom:hover,
.btn-outline-yellow-custom:focus {
    background-color: #FFC72C;
    border-color: #FFC72C;
    color: white;
}

.text-primary-custom { color: #008ec0; }
.text-yellow-custom { color: #FFC72C; }

/* --- Badges & Form Controls --- */
.badge-outline {
    background-color: transparent;
    padding: 0.25em 0.5em;
    font-size: 0.75em;
    border-radius: 0.25rem;
    display: inline-block;
    line-height: 1;
    vertical-align: text-bottom;
    border: 1px solid;
}

.badge-outline-primary-custom {
    color: #00a3e0;
    border-color: #00a3e0;
}

.form-control:focus {
    border-color: #00a3e0;
    box-shadow: 0 0 0 0.2rem rgba(0, 163, 224, 0.25);
}

.form-visual-disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Pagination & Navigation --- */
.page-link {
    cursor: pointer;
    color: #00a3e0;
    background-color: white;
    transition: all 0.3s;
}

.page-link:hover {
    color: white;
    background-color: #008ec0;
    border-color: #008ec0;
}

.page-item.disabled .page-link {
    cursor: default;
}

.pagination { margin-bottom: 0; }

.nav-tabs {
    border-bottom: 1px solid #dee2e6;
}

.nav-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    color: #fff;
    background-color: #FFC72C;
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: #6c757d;
    border-bottom: 3px solid #FFC72C;
    background-color: transparent;
}

.breadcrumb-item a {
    color: #008ec0;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: #FFC72C;
    text-decoration: none;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .action-icons, .accept-decline-icons {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        justify-content: center;
    }
    .action-icons .icon-img {
        width: 22px;
        height: 22px;
    }
    .accept-decline-icons .icon-img {
        width: 28px;
        height: 28px;
    }
    .table td.action-column {
        width: 60px; /* Slimmer for stacked mobile icons */
    }
}