/* HCAI Custom Styles */

:root {
    --primary-orange: #FF6B35; /* A strong, friendly orange */
    --light-orange-bg: #f5e4da; /* A very light orange for backgrounds */
    --card-header-bg: #ffba90;
    --dark-text: rgb(44 62 80 / var(--tw-text-opacity, 1));
    --light-text: #FFFFFF;
    --warning-color: #FFC107; /* legacy - used by Bootstrap warning */
    --success-color: #28A745; /* legacy - used by Bootstrap success */
    --heading-color: linear-gradient(135deg, #FF6B35, #FF8C42, #FF7F7F, #FF9500); /* A darker orange for headings */

    /* Brand palette for domains */
    --visit-color: #FFC107;              /* Amber */
    --visit-bg: rgba(255, 193, 7, 0.15);
    --case-color: #28A745;               /* Green */
    --case-bg: rgba(40, 167, 69, 0.12);
    --product-color: #0DCAF0;            /* Cyan/Info */
    --product-bg: rgba(13, 202, 240, 0.12);
    --doctor-color: #0D6EFD;             /* Primary Blue */
    --doctor-bg: rgba(13, 110, 253, 0.12);
    --representative-color: #6f42c1;     /* Purple */
    --representative-bg: rgba(111, 66, 193, 0.12);
}

body {
    background-color: var(--light-orange-bg);
    color: var(--dark-text);
}

.navbar-custom {
    background-color: var(--primary-orange);
}

.navbar-custom .navbar-brand,
.navbar-custom .nav-link {
    text-align: center;
    color: var(--light-text);
    font-weight: bold;
}

.navbar-custom .nav-link:hover {
    color: #fdfefe;
}

.btn-primary {
    background-color: var(--primary-orange);
    border-color: var(--primary-orange);
}

.btn-primary:hover {
    background-color: #D35400;
    border-color: #D35400;
}

/* Custom warning and success button colors */
.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: #000;
}

.btn-warning:hover {
    background-color: #E0A800;
    border-color: #E0A800;
    color: #000;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
    color: #fff;
}

/* Background color classes for consistency */
.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

/* Domain-specific buttons */
.btn-visit { background-color: var(--visit-color); border-color: var(--visit-color); color: #000; }
.btn-visit:hover { background-color: #e0a800; border-color: #e0a800; color: #000; }
.btn-outline-visit { color: var(--visit-color); border-color: var(--visit-color); }
.btn-outline-visit:hover { background-color: var(--visit-color); color: #000; }

.btn-case { background-color: var(--case-color); border-color: var(--case-color); color: #fff; }
.btn-case:hover { background-color: #218838; border-color: #218838; color: #fff; }
.btn-outline-case { color: var(--case-color); border-color: var(--case-color); }
.btn-outline-case:hover { background-color: var(--case-color); color: #fff; }

.btn-product { background-color: var(--product-color); border-color: var(--product-color); color: #fff; }
.btn-product:hover { background-color: #11b7d9; border-color: #11b7d9; color: #fff; }
.btn-outline-product { color: var(--product-color); border-color: var(--product-color); }
.btn-outline-product:hover { background-color: var(--product-color); color: #fff; }

.btn-doctor { background-color: var(--doctor-color); border-color: var(--doctor-color); color: #fff; }
.btn-doctor:hover { background-color: #0b5ed7; border-color: #0b5ed7; color: #fff; }
.btn-outline-doctor { color: var(--doctor-color); border-color: var(--doctor-color); }
.btn-outline-doctor:hover { background-color: var(--doctor-color); color: #fff; }

.btn-representative { background-color: var(--representative-color); border-color: var(--representative-color); color: #fff; }
.btn-representative:hover { background-color: #5a32a3; border-color: #5a32a3; color: #fff; }
.btn-outline-representative { color: var(--representative-color); border-color: var(--representative-color); }
.btn-outline-representative:hover { background-color: var(--representative-color); color: #fff; }

.card {
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.card-header {
     background-color: var(--card-header-bg);
     border-bottom: 1px solid #FAD7B0;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
}

/* Compact statistic tiles */
.stat-tile {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    padding: 10px 8px;
    height: 100%;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.06);
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* Desktop optimizations for statistics cards */
@media (min-width: 768px) {
    .stat-card .card-body {
        padding: 1.5rem 1rem !important;
        min-height: 160px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .stat-card {
        margin-bottom: 1rem;
        height: 100%;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    }
    
    /* Ensure cards are horizontally aligned on desktop */
    .row.mb-4 .col-md-3 {
        margin-bottom: 0rem;
        display: flex;
    }
    
    .row.mb-4 {
        margin-bottom: 2rem !important;
        display: flex;
        flex-wrap: wrap;
    }
    
    /* Force horizontal layout on desktop */
    @media (min-width: 992px) {
        .row.mb-4 .col-md-3 {
            flex: 0 0 25%;
            max-width: 25%;
        }
    }
}
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
}

/* Desktop icon optimization */
@media (min-width: 768px) {
    .stat-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
        margin-bottom: 12px;
    }
    
    .stat-value {
        font-size: 2rem !important;
        font-weight: 700;
        margin-bottom: 4px;
    }
    
    .stat-label {
        font-size: 0.875rem !important;
        color: #6c757d;
        font-weight: 500;
    }
}
.stat-icon-visit { background: var(--visit-bg); color: var(--visit-color); }
.stat-icon-case { background: var(--case-bg); color: var(--case-color); }
.stat-icon-product { background: var(--product-bg); color: var(--product-color); }
.stat-icon-doctor { background: var(--doctor-bg); color: var(--doctor-color); }
.stat-icon-representative { background: var(--representative-bg); color: var(--representative-color); }
.stat-actions { display: flex; gap: 6px; }
.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}
.text-visit { color: var(--visit-color) !important; }
.text-case { color: var(--case-color) !important; }
.text-product { color: var(--product-color) !important; }
.text-doctor { color: var(--doctor-color) !important; }
.text-representative { color: var(--representative-color) !important; }
.bg-visit { background-color: var(--visit-color) !important; }
.bg-case { background-color: var(--case-color) !important; }
.bg-product { background-color: var(--product-color) !important; }
.bg-doctor { background-color: var(--doctor-color) !important; }
.bg-representative { background-color: var(--representative-color) !important; }
.stat-label {
    font-size: 0.75rem;
}

/* Helper for truncating long names in tight spaces */
.truncate-1 {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* Custom alert styles */
.alert-info {
    background-color: var(--light-orange-bg);
    border-color: var(--primary-orange);
    color: var(--dark-text);
}

.alert-success {
    background-color: #D5F5E3;
    border-color: #58D68D;
    color: #1E8449;
}

.alert-warning {
    background-color: #FCF3CF;
    border-color: #F7DC6F;
    color: #B7950B;
}

.alert-danger {
    background-color: #FADBD8;
    border-color: #F1948A;
    color: #C0392B;
}


/* Custom badge styles for better visibility */
.badge-success {
    background-color: var(--success-color) !important;
    color: #fff !important;
}

.badge-warning {
    background-color: var(--warning-color) !important;
    color: #000 !important;
    font-weight: 600;
}

.badge-danger {
    background-color: #DC3545 !important;
    color: #fff !important;
    font-weight: 600;
}

/* Ensure all badges have proper contrast */
.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35em 0.65em;
}

/* PWA Specific Styles */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    color: white;
}

.offline-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    margin-top: 10px;
}

/* App-like experience styles */
@media (display-mode: standalone) {
    body {
        padding-top: 0;
    }
    
    .navbar {
        padding-top: env(safe-area-inset-top);
    }
    
    .container {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Touch-friendly improvements */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: 10px 10px;
    }
    
    .nav-link {
        padding: 10px 10px;
    }
    
    .card {
        margin-bottom: 0rem;
    }
}

/* Custom padding override for py-3 */
.py-3 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Sticky navbar for all devices */
.navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

/* Adjust main content to account for sticky navbar */
main.flex-shrink-0 {
    padding-top: 0;
}

/* Ensure container has proper spacing */
main .container {
    margin-top: 1rem !important;
}

/* Navigation buttons layout options */
/* For 2x2 layout on very small screens, 4x1 on larger mobile */
@media (max-width: 375px) {
    .navigation-section .col-3 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* Table headers with centered icons (navbar style) */
.table-header-centered {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 12px 8px !important;
    min-width: 80px;
}

/* Table body cells with centered text */
.table-body-centered {
    text-align: center !important;
    vertical-align: middle !important;
}

/* Left-aligned table header */
.table-header-left {
    text-align: left !important;
    vertical-align: middle !important;
    padding: 12px 8px !important;
    min-width: 80px;
}

/* Left-aligned table body cells */
.table-body-left {
    text-align: left !important;
    vertical-align: middle !important;
}

.table-header-centered i {
    display: block !important;
    font-size: 16px;
    margin-bottom: 4px;
}

.table-header-centered .header-text {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.table-header-left i {
    display: block !important;
    font-size: 16px;
    margin-bottom: 4px;
}

.table-header-left .header-text {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* Responsive table headers for mobile */
@media (max-width: 768px) {
    .table-header-centered, .table-header-left {
        padding: 8px 4px !important;
        min-width: 60px;
    }
    
    .table-header-centered i, .table-header-left i {
        font-size: 14px;
        margin-bottom: 2px;
    }
    
    .table-header-centered .header-text, .table-header-left .header-text {
        font-size: 10px;
    }
}

/* Desktop Quick Actions button styling */
.btn .fa-plus {
    padding: 6px;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
}

/* Ensure proper vertical alignment for desktop buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Loading states for offline functionality */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sync-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1070;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    display: none;
}

.sync-indicator.show {
    display: block;
}


/* Centered content utility */
.centered-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

html, body {
    height: 100%;
}

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

main {
    flex: 1 0 auto;
}

.footer {
    flex-shrink: 0;
}

/* View Toggle Styles */
.view-toggle-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.view-toggle-btn {
    background: #fff;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.view-toggle-btn:hover {
    background: #f8f9fa;
    color: var(--primary-orange);
}

.view-toggle-btn.active {
    background: var(--primary-orange);
    color: #fff;
}

.view-toggle-btn i {
    font-size: 16px;
}

/* Table View Styles */
.table-view .item-container {
    display: none !important;
}

.table-view .items-table-container {
    display: block !important;
}

.table-view .table-responsive {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== Table Consistency Utility Classes ===== */

/* Text alignment utilities for table cells */
.table-cell-center {
    text-align: center !important;
    vertical-align: middle !important;
}

.table-cell-left {
    text-align: left !important;
    vertical-align: middle !important;
}

/* Date and time formatting for tables */
.table-date-primary {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    /*color: var(--dark-text);*/
    color: #494f54;
}

.table-time-secondary {
    display: block;
    font-size: 0.8rem;
    font-style: italic;
    color: #6c757d;
    line-height: 1.2;
    margin-top: 2px;
}

/* Actions column specific styling */
.table-actions-column {
    text-align: center !important;
    vertical-align: middle !important;
    min-width: 180px;
    white-space: nowrap;
}

/* Ensure actions column stays on the right */
.table-responsive table thead tr th:last-child,
.table-responsive table tbody tr td:last-child {
    position: sticky;
    right: 0;
    /*background-color: inherit; */
}

/* Enhanced table-actions class for consistency */
.table-view .table-actions {
    text-align: center !important;
    vertical-align: middle !important;
    min-width: 180px;
}

/* Enhanced table-date class for consistency */
.table-view .table-date {
    white-space: nowrap;
    text-align: left !important;
}

/* Enhanced table-status class for consistency */
.table-view .table-status {
    text-align: center !important;
    vertical-align: middle !important;
}

.table-view .table-status .text-muted {
    text-align: center !important;
}

/* Mobile responsiveness for table utility classes */
@media (max-width: 768px) {
    .table-actions-column {
        min-width: 140px;
        font-size: 0.85rem;
    }
    
    .table-date-primary {
        font-size: 0.85rem;
    }
    
    .table-time-secondary {
        font-size: 0.75rem;
    }
}

/* ===== End Table Consistency Utility Classes ===== */

/* ===== Table Sorting Styles ===== */

/* Sortable column header styling */
.sortable {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox (legacy) */
    -ms-user-select: none;     /* IE 10+ */
    position: relative;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sortable:hover {
    background-color: rgba(255, 107, 53, 0.1);
}

.sortable:active {
    background-color: rgba(255, 107, 53, 0.15);
}

/* Sort indicator styling */
.sort-indicator {
    margin-left: 6px;
    font-size: 0.75em;
    opacity: 0.4;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: inline-block;
    vertical-align: middle;
}

/* Active sort state */
.sortable.sorted .sort-indicator {
    opacity: 1;
    color: var(--primary-orange);
}

/* Sort direction animations */
.sortable.sorted.asc .sort-indicator {
    transform: translateY(-1px);
}

.sortable.sorted.desc .sort-indicator {
    transform: translateY(1px);
}

/* Ensure sort indicators are visible and accessible */
.sort-indicator i {
    display: inline-block;
    width: 12px;
    text-align: center;
}

/* Focus state for keyboard accessibility */
.sortable:focus {
    outline: 2px solid var(--primary-orange);
    outline-offset: -2px;
}

.sortable:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: -2px;
}

/* Mobile responsiveness for sorting */
@media (max-width: 768px) {
    .sort-indicator {
        font-size: 0.7em;
        margin-left: 4px;
    }
    
    .sortable:hover {
        background-color: rgba(255, 107, 53, 0.08);
    }
}

/* High contrast mode support for sorting */
@media (prefers-contrast: high) {
    .sortable:hover {
        background-color: rgba(0, 0, 0, 0.1);
        border: 1px solid #000;
    }
    
    .sortable.sorted .sort-indicator {
        opacity: 1;
        color: #000;
    }
}

/* Reduced motion support for sorting */
@media (prefers-reduced-motion: reduce) {
    .sortable,
    .sort-indicator {
        transition: none;
    }
    
    .sortable.sorted.asc .sort-indicator,
    .sortable.sorted.desc .sort-indicator {
        transform: none;
    }
}

/* ===== End Table Sorting Styles ===== */

/* ===== Column Visibility Styles ===== */

/* Column visibility control button */
.column-visibility-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.column-visibility-btn {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.column-visibility-btn:hover {
    background: #f8f9fa;
    color: var(--primary-orange);
    border-color: var(--primary-orange);
}

.column-visibility-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.16);
    border-color: var(--primary-orange);
}

.column-visibility-btn i {
    font-size: 14px;
}

/* Column visibility dropdown menu */
.column-visibility-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #0a3865;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.792);
    padding: 12px;
    z-index: 1060;
    min-width: 200px;
    max-width: 280px;
    max-height: 400px;
    overflow-y: auto;
}

/* Menu item styling */
.column-visibility-item {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 4px;
}

.column-visibility-item:hover {
    background-color: rgba(255, 107, 53, 0.08);
}

.column-visibility-item input[type="checkbox"] {
    margin: 0;
    margin-right: 10px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.column-visibility-item input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.column-visibility-item label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    user-select: none;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox (legacy) */
    -ms-user-select: none;     /* IE 10+ */
    flex: 1;
    line-height: 1.4;
}

.column-visibility-item input[type="checkbox"]:disabled + label {
    cursor: not-allowed;
}

/* Hidden column class */
.column-hidden {
    display: none !important;
}

/* Scrollbar styling for menu */
.column-visibility-menu::-webkit-scrollbar {
    width: 6px;
}

.column-visibility-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.column-visibility-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.column-visibility-menu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile responsiveness for column visibility */
@media (max-width: 768px) {
    .column-visibility-control {
        margin-left: 6px;
    }
    
    .column-visibility-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .column-visibility-btn i {
        font-size: 13px;
    }
    
    .column-visibility-menu {
        min-width: 180px;
        max-width: 90vw;
        max-height: 60vh;
        padding: 10px;
    }
    
    .column-visibility-item {
        padding: 10px 6px;
    }
    
    .column-visibility-item label {
        font-size: 13px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .column-visibility-btn {
        border: 2px solid #000;
    }
    
    .column-visibility-btn:hover {
        background-color: #000;
        color: #fff;
    }
    
    .column-visibility-menu {
        border: 2px solid #000;
    }
    
    .column-visibility-item:hover {
        background-color: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .column-visibility-btn,
    .column-visibility-item {
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.column-visibility-item:focus-within {
    background-color: rgba(255, 107, 53, 0.12);
    outline: 2px solid var(--primary-orange);
    outline-offset: -2px;
}

.column-visibility-item input[type="checkbox"]:focus {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
}

/* ===== End Column Visibility Styles ===== */

/* ===== Keyboard Navigation Styles ===== */

/* Focused cell styling */
.table-keyboard-focus {
    outline: 2px solid var(--primary-orange) !important;
    outline-offset: -2px;
    background-color: rgba(255, 107, 53, 0.15) !important;
    position: relative;
    z-index: 1;
    transition: background-color 0.2s ease, outline 0.2s ease;
}

/* Selected row styling */
.table-row-selected {
    background-color: rgba(255, 107, 53, 0.08) !important;
    transition: background-color 0.2s ease;
}

/* Ensure focus indicators are clearly visible */
.table-keyboard-focus::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border: 2px solid var(--primary-orange);
    border-radius: 2px;
}

/* Smooth transitions for focus changes */
table tbody tr,
table tbody td {
    transition: background-color 0.2s ease;
}

/* High contrast mode support for keyboard navigation */
@media (prefers-contrast: high) {
    .table-keyboard-focus {
        outline: 3px solid #000 !important;
        background-color: rgba(0, 0, 0, 0.1) !important;
    }
    
    .table-row-selected {
        background-color: rgba(0, 0, 0, 0.05) !important;
        border: 2px solid #000;
    }
}

/* Reduced motion support for keyboard navigation */
@media (prefers-reduced-motion: reduce) {
    .table-keyboard-focus,
    .table-row-selected,
    table tbody tr,
    table tbody td {
        transition: none;
    }
}

/* Mobile responsiveness for keyboard navigation */
@media (max-width: 768px) {
    .table-keyboard-focus {
        outline-width: 3px;
        outline-offset: -3px;
    }
    
    .table-keyboard-focus::after {
        border-width: 3px;
    }
}

/* Ensure keyboard focus is visible over other elements */
.table-keyboard-focus {
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.3);
}

/* Focus state for table when using keyboard navigation */
table:focus {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
}

table:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
}

/* ===== End Keyboard Navigation Styles ===== */

/* Ensure calendar dropdowns aren't clipped by table overflow */
.table-responsive:has(.calendar-quick-action--open) {
    overflow: visible !important;
}

/* Fallback for browsers that don't support :has() selector */
.table-responsive.calendar-dropdown-open {
    overflow: visible !important;
}

.table-view table {
    /*background: #fff;*/
    border: none;
    margin-bottom: 0;
}

.table-view th {
    text-align: center;
    background-color: var(--primary-orange);
    color: white;
    border: none;
    font-weight: 600;
    padding: 12px;
    vertical-align: middle;
}

.table-view td {
    border: none;
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid #f8f9fa;
}

.table-view tbody tr:hover {
    background-color: #f8f9fa;
}

.table-view tbody tr:last-child td {
    border-bottom: none;
}

.table-view .btn-group {
    white-space: nowrap;
}

/* ===== Action Button Wrapping Styles ===== */

/* Button group with wrapping support */
.btn-group-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* Fallback for older Safari versions that don't support gap */
@supports not (gap: 4px) {
    .btn-group-wrap {
        gap: 0;
    }
    
    .btn-group-wrap > * {
        margin: 2px;
    }
}

/* Visual separation for delete buttons */
.btn-group-wrap .btn-outline-danger {
    margin-left: 8px;
}

/* Ensure proper spacing in fallback mode */
@supports not (gap: 4px) {
    .btn-group-wrap .btn-outline-danger {
        margin-left: 10px;
    }
}

/* Mobile responsiveness for button wrapping */
@media (max-width: 768px) {
    .btn-group-wrap {
        gap: 3px;
    }
    
    @supports not (gap: 3px) {
        .btn-group-wrap > * {
            margin: 1.5px;
        }
    }
    
    .btn-group-wrap .btn-outline-danger {
        margin-left: 6px;
    }
}

/* Mobile-specific button group styling */
.btn-group-wrap-mobile {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}

/* Fallback for older Safari versions that don't support gap */
@supports not (gap: 4px) {
    .btn-group-wrap-mobile {
        gap: 0;
    }
    
    .btn-group-wrap-mobile > * {
        margin: 2px;
    }
}

/* Visual separation for delete buttons in mobile */
.btn-group-wrap-mobile .btn-outline-danger {
    margin-left: 8px;
}

/* Ensure proper spacing in fallback mode */
@supports not (gap: 4px) {
    .btn-group-wrap-mobile .btn-outline-danger {
        margin-left: 10px;
    }
}

/* ===== End Action Button Wrapping Styles ===== */

.table-view .badge {
    font-size: 0.75rem;
}

.table-view .text-truncate {
    max-width: 200px;
}

/* Text wrapping alternatives to text-truncate */
.text-wrap {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.text-wrap-ellipsis {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 100%;
}

.table-view .text-wrap {
    max-width: 200px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.table-view .text-wrap-wide {
    max-width: 300px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

.table-view .table-actions {
    /*width: 240px;*/
    text-align: left;
}

.table-view .table-status .text-muted {
    /*width: 120px;*/
    text-align: center !important;
}

.table-view .table-date {
    /*width: 140px;*/
    white-space: nowrap;
}

/* Calendar quick action buttons */
.calendar-quick-action {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.calendar-quick-action__toggle {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calendar-quick-action__toggle:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(45, 156, 219, 0.25);
}

.calendar-quick-action--open .calendar-quick-action__toggle {
    transform: rotate(45deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.calendar-quick-action__options {
    position: absolute;
    display: flex;
    gap: 0.4rem;
    bottom: calc(100% + 0.5rem);
    right: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1080;
}

.calendar-quick-action--open .calendar-quick-action__options {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.calendar-quick-action__option {
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(6px) scale(0.9);
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.calendar-quick-action--open .calendar-quick-action__option {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.calendar-quick-action--open .calendar-quick-action__option:nth-child(1) {
    transition-delay: 0.05s;
}

.calendar-quick-action--open .calendar-quick-action__option:nth-child(2) {
    transition-delay: 0.1s;
}

.calendar-quick-action--open .calendar-quick-action__option:nth-child(3) {
    transition-delay: 0.15s;
}

.calendar-quick-action__option:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

@media (max-width: 768px) {
    .calendar-quick-action__options {
        right: auto;
        left: 50%;
        transform: translate(-50%, 10px) scale(0.96);
    }

    .calendar-quick-action--open .calendar-quick-action__options {
        transform: translate(-50%, 0) scale(1);
    }
    
    /* Ensure mobile table containers don't clip dropdowns */
    .table-responsive {
        overflow: visible !important;
    }
}

/* Card View Styles (default) - keeping existing card styling intact */

.card-view .items-table-container {
    display: none !important;
}

/* ===== View Toggle Initial State Styles ===== */

/* Default state: hide table view, show card view */
.items-table-container {
    display: none;
}

.items-card-container {
    display: block;
}

/* When table view is active (via data-view attribute on body) */
body[data-view="table"] .items-table-container {
    display: block;
}

body[data-view="table"] .items-card-container {
    display: none;
}

/* When card view is active (via data-view attribute on body) */
body[data-view="card"] .items-table-container {
    display: none;
}

body[data-view="card"] .items-card-container {
    display: block;
}

/* ===== End View Toggle Initial State Styles =====
}

/* Mobile Responsiveness for Views */
@media (max-width: 768px) {
    /* Hide view toggle buttons on mobile - only show cards */
    .view-toggle-container {
        display: none !important;
    }
    
    /* Force card view on mobile regardless of toggle */
    .table-view .item-container {
        display: block !important;
    }
    
    .table-view .items-table-container {
        display: none !important;
    }
}

/* Logo Header Styling */
.logo-header {
    background-color: var(--light-orange-bg);
    border-bottom: 1px solid rgba(255, 107, 53, 0.2);
}

.site-title {
    color: var(--primary-orange);
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
}

/* Mobile polish */
@media (max-width: 768px) {
    /* Improve navbar toggler contrast/visibility on orange */
    .navbar-custom.navbar-dark .navbar-toggler {
        border-color: rgba(255,255,255,0.6);
    }
    .navbar-custom.navbar-dark .navbar-toggler-icon {
        filter: brightness(0) invert(1);
    }

    /* Section wrapper used in mobile dashboards */
    .mobile-section {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        padding: 12px 14px;
        margin-bottom: 10px; /* slightly tighter to remove excess gap */
    }

    /* Tighten headings on mobile */
    .mobile-heading {
        margin-bottom: 8px;
        font-size: 0.95rem;
        color: #6c757d;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    /* Make tables scrollable with softer edges on small screens */
    .table-responsive {
        border-radius: 10px;
    }
    .table-responsive th {
        text-align: center !important;
        border-radius: 0px;
    }
    /* Increase bottom space above footer on very short pages */
    main .container { padding-bottom: 56px; }

    /* Trim extra space inside mobile recent activity items */
    .mobile-recent-item { margin-bottom: 6px; }

    /* Enhanced Quick Actions button styling */
    .btn-lg .fa-plus.fa-lg {
        padding: 8px;
        margin-bottom: 12px !important;
        display: inline-block;
        line-height: 1;
    }

    /* Ensure proper vertical centering for button content */
    .btn-lg.d-flex.flex-column {
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .btn-lg.d-flex.flex-column span {
        text-align: center;
        width: 100%;
    }

    /* Navigation card styling for proper vertical centering */
    .mobile-section .card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        min-height: 50px;
    }

    .mobile-section .card i {
        margin-bottom: 3px;
        display: block;
    }

    .mobile-section .card .small {
        text-align: center;
        width: 100%;
    }
}

/* Dynamic Filters Enhancements */
.filtering-in-progress {
    cursor: wait;
}

.filtering-in-progress .form-control,
.filtering-in-progress .form-select {
    opacity: 0.7;
    pointer-events: none;
}

.loading-indicator {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Mobile enhancements for dynamic filters */
@media (max-width: 768px) {
    .mobile-select-indicator {
        font-size: 11px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    /* Enhanced mobile input styling */
    .form-control:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
        border-color: var(--primary-orange);
    }
    
    .form-select:focus {
        box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
        border-color: var(--primary-orange);
    }
    
    /* Clear button styling for search inputs */
    .input-group .btn-outline-secondary {
        border-color: #ccc;
        color: #6c757d;
    }
    
    .input-group .btn-outline-secondary:hover {
        background-color: #f8f9fa;
        border-color: #adb5bd;
    }
}

/* Filter form enhancements */
.row.mb-4 form .row {
    align-items: end;
}

.row.mb-4 form .col-md-1 {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.row.mb-4 form .col-md-2:last-child {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Responsive filter adjustments */
@media (max-width: 992px) {
    .row.mb-4 form .col-md-1,
    .row.mb-4 form .col-md-2:last-child {
        margin-top: 0rem;
    }
}

/* Enhanced filter button styling */
.btn-outline-primary:not(:disabled):not(.disabled) {
    transition: all 0.2s ease-in-out;
}

.btn-outline-secondary:not(:disabled):not(.disabled) {
    transition: all 0.2s ease-in-out;
}

/* Enhanced focus states for dynamic filtering */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-orange) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25) !important;
    outline: none;
}

/* Focused input glow effect */
.form-control:focus {
    background-color: rgba(255, 107, 53, 0.02);
    transition: all 0.15s ease-in-out;
}

/* Enhanced visual feedback for active filtering */
.form-control[name="search"]:not(:placeholder-shown) {
    border-left: 3px solid var(--primary-orange);
    padding-left: calc(0.75rem - 2px);
}

.form-select:not([value=""]) {
    border-left: 3px solid var(--primary-orange);
    padding-left: calc(0.75rem - 2px);
}

/* Smooth transitions for all form elements */
.form-control,
.form-select {
    transition: border-color 0.15s ease-in-out, 
                box-shadow 0.15s ease-in-out,
                background-color 0.15s ease-in-out,
                border-left 0.2s ease-in-out,
                padding-left 0.2s ease-in-out;
}

/* Enhanced loading state for inputs */
.filtering-in-progress .form-control:focus,
.filtering-in-progress .form-select:focus {
    border-color: #ccc !important;
    box-shadow: none !important;
}

/* Keyboard navigation enhancements */
.form-control:focus::placeholder {
    color: rgba(255, 107, 53, 0.5);
}

/* Clear button enhancements */
.input-group .btn-outline-secondary:focus {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
}

/* Focus restoration animation */
@keyframes focusRestore {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
        border-color: var(--primary-orange);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 107, 53, 0.1);
        border-color: var(--primary-orange);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0);
        border-color: var(--primary-orange);
    }
}

/* Enhanced visual feedback for typing state */
.form-control:focus:not(:placeholder-shown) {
    border-left-width: 4px;
    border-left-color: var(--primary-orange);
    background-color: rgba(255, 107, 53, 0.03);
}

/* Hospitals page specific filter alignment */
.hospitals-filters .row.align-items-end > .col-md-2:last-child .d-flex {
    height: 38px; /* Match form control height */
    align-items: stretch;
}

.hospitals-filters .view-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

/* Better alignment for integrated view toggles */
.row.align-items-end .d-flex.gap-1 {
    gap: 0.25rem !important;
}

.row.align-items-end .d-flex.gap-1 .btn {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Searchable Doctor Select Component Styles */
.searchable-doctor-select {
    position: relative;
    width: 100%;
}

.searchable-doctor-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow: hidden;
}

.searchable-doctor-results {
    max-height: 300px;
    overflow-y: auto;
    border: none;
}

.searchable-doctor-result {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease;
}

.searchable-doctor-result:hover,
.searchable-doctor-result.highlighted {
    background-color: rgba(255, 107, 53, 0.08);
    color: var(--primary-orange);
}

.searchable-doctor-result:last-child {
    border-bottom: none;
}

.searchable-doctor-result strong {
    font-weight: 600;
    color: var(--primary-orange);
}

.searchable-doctor-no-results {
    padding: 16px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.searchable-doctor-clear {
    border-left: none;
}

.searchable-doctor-select .form-control.selected {
    border-color: var(--success-color);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.searchable-doctor-select .form-control.selection-complete {
    border-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.05);
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    transition: all 0.3s ease-out;
}

.searchable-doctor-select.dropdown-open .form-control {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
}

.searchable-doctor-select.dropdown-open .input-group .btn {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Mobile optimizations for searchable doctor select */
@media (max-width: 768px) {
    .searchable-doctor-dropdown {
        max-height: 50vh; /* Limit height on mobile */
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }
    
    .searchable-doctor-results {
        max-height: 50vh;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .searchable-doctor-result {
        padding: 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-bottom: 1px solid #e9ecef;
    }
    
    .searchable-doctor-result:active {
        background-color: rgba(255, 107, 53, 0.15);
    }
    
    .searchable-doctor-no-results {
        padding: 20px 16px;
        font-size: 14px;
    }
    
    /* Ensure proper touch targets */
    .searchable-doctor-clear {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile keyboard optimizations */
    .searchable-doctor-select .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 16px;
    }
}

/* Enhanced focus states for keyboard navigation */
.searchable-doctor-result:focus,
.searchable-doctor-result.highlighted {
    outline: none;
    background-color: rgba(255, 107, 53, 0.12);
    border-left: 3px solid var(--primary-orange);
    padding-left: 13px; /* Adjust for border */
}

.searchable-doctor-select .form-control:focus {
    border-color: var(--primary-orange) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25) !important;
    z-index: 1051; /* Ensure it's above dropdown */
}

/* Smooth animations */
.searchable-doctor-dropdown {
    animation: fadeInDown 0.15s ease-out;
    transform-origin: top center;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scaleY(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

/* Loading state for searchable select */
.searchable-doctor-select.loading .form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3e%3cpath fill='%23ff6b35' d='M6 0L6 12L6 0zM6 0C2.6862915,0 0,2.6862915 0,6C0,9.3137085 2.6862915,12 6,12'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Improved accessibility */
.searchable-doctor-result[aria-selected="true"] {
    background-color: var(--primary-orange);
    color: white;
}

.searchable-doctor-result[aria-selected="true"] strong {
    color: white;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .searchable-doctor-result:hover,
    .searchable-doctor-result.highlighted {
        background-color: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .searchable-doctor-dropdown {
        border: 2px solid #000;
    }
}

/* Sticky Floating Action Buttons (FAB) with Liquid Glass Effect */
.sticky-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1050;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Liquid Glass Effect */
    background: rgba(255, 107, 53, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(255, 107, 53, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    
    /* Glass reflection */
    background-image: 
        linear-gradient(135deg, 
            rgba(255, 255, 255, 0.3) 0%, 
            rgba(255, 255, 255, 0.1) 30%, 
            rgba(255, 255, 255, 0.05) 60%, 
            rgba(0, 0, 0, 0.05) 100%);
}

/* Back FAB positioning - align with main FAB */
.fab-back-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
}

.fab-back-container .sticky-fab {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    top: auto;
}

/* Tooltip positioning for back FAB (positioned on left side) */
.fab-back-container .sticky-fab[data-tooltip]::after {
    right: auto;
    left: 100%;
    margin-right: 0;
    margin-left: 12px;
}

.sticky-fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 16px 40px rgba(255, 107, 53, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    color: white;
    background: rgba(255, 107, 53, 0.9);
    
    /* Enhanced glass effect on hover */
    background-image: 
        linear-gradient(135deg, 
            rgba(255, 255, 255, 0.4) 0%, 
            rgba(255, 255, 255, 0.15) 30%, 
            rgba(255, 255, 255, 0.08) 60%, 
            rgba(0, 0, 0, 0.03) 100%);
}

.sticky-fab:active {
    transform: translateY(-2px) scale(1.02);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.sticky-fab:focus {
    outline: none;
    box-shadow: 
        0 8px 32px rgba(255, 107, 53, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(255, 107, 53, 0.3);
}

/* Pulse animation for attention */
.sticky-fab::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: rgba(255, 107, 53, 0.3);
    animation: fabPulse 2s infinite;
    z-index: -1;
}

@keyframes fabPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile optimizations for sticky-fab */
@media (max-width: 768px) {
    .sticky-fab {
        width: 56px;
        height: 56px;
        font-size: 20px;
        
        /* Enhanced backdrop blur for mobile */
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        
        /* Better touch target */
        touch-action: manipulation;
    }
    
    .sticky-fab:hover {
        /* Disable hover effects on mobile (use active instead) */
        transform: none;
        scale: none;
    }
    
    .sticky-fab:active {
        transform: scale(0.95);
        background: rgba(255, 107, 53, 0.95);
    }
}

/* Different colors for different action types */
.sticky-fab.fab-visit {
    background: rgba(255, 193, 7, 0.85);
    box-shadow: 
        0 8px 32px rgba(255, 193, 7, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.sticky-fab.fab-visit:hover {
    background: rgba(255, 193, 7, 0.9);
    box-shadow: 
        0 16px 40px rgba(255, 193, 7, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.sticky-fab.fab-visit::before {
    background: rgba(255, 193, 7, 0.3);
}

.sticky-fab.fab-case {
    background: rgba(40, 167, 69, 0.85);
    box-shadow: 
        0 8px 32px rgba(40, 167, 69, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.sticky-fab.fab-case:hover {
    background: rgba(40, 167, 69, 0.9);
    box-shadow: 
        0 16px 40px rgba(40, 167, 69, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.sticky-fab.fab-case::before {
    background: rgba(40, 167, 69, 0.3);
}

/* Tooltip for FAB */
.sticky-fab[data-tooltip] {
    position: relative;
}

.sticky-fab[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-right: 12px;
    z-index: 1051;
    
    /* Glass effect for tooltip */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sticky-fab[data-tooltip]:hover::after {
    opacity: 1;
}

/* Hide tooltip on mobile */
@media (max-width: 768px) {
    .sticky-fab[data-tooltip]::after {
        display: none;
    }
}

/* Accessibility improvements */
.sticky-fab:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .sticky-fab {
        transition: none;
        animation: none;
    }
    
    .sticky-fab::before {
        animation: none;
    }
    
    .sticky-fab:hover {
        transform: none;
    }
    
    /* Disable shimmer animation for reduced motion */
    .fab-main button::after,
    .fab-sub-button .btn::after {
        animation: none;
        display: none;
    }
}

/* Expandable Floating Action Button (Desktop Dashboard) */
.fab-container {
    position: relative;
}

/* Subtle backdrop overlay when FAB is expanded (no blur) */
.fab-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 50%),
        rgba(0, 0, 0, 0.15);
    /* Removed backdrop-filter blur for screen */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.fab-container.expanded::before {
    opacity: 1;
    visibility: visible;
}

/* Main FAB and sub-button styling with enhanced liquid glass effect */
.fab-main button,
.fab-sub-button .btn {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Advanced liquid glass effect */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        inset 1px 0 0 rgba(255, 255, 255, 0.15),
        inset -1px 0 0 rgba(0, 0, 0, 0.05);
}

/* Glass reflection overlay */
.fab-main button::before,
.fab-sub-button .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.2) 25%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 60%,
        rgba(0, 0, 0, 0.02) 80%,
        rgba(0, 0, 0, 0.05) 100%
    );
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
}

/* Shimmer animation overlay */
.fab-main button::after,
.fab-sub-button .btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 40%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 60%,
        transparent 70%
    );
    opacity: 0;
    transform: rotate(-45deg);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

/* Shimmer keyframe animation */
@keyframes shimmer {
    0% {
        opacity: 0;
        transform: rotate(-45deg) translateX(-100%);
    }
    50% {
        opacity: 0.6;
        transform: rotate(-45deg) translateX(0%);
    }
    100% {
        opacity: 0;
        transform: rotate(-45deg) translateX(100%);
    }
}

/* Ensure button content stays above overlays */
.fab-main button i,
.fab-sub-button .btn i {
    position: relative;
    z-index: 3;
}

.fab-sub-button {
    position: absolute;
    bottom: 0;
    right: 0;
    opacity: 0;
    transform: scale(0) rotate(-90deg);
    transform-origin: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 12px;
}

.fab-label {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
    pointer-events: none;
    position: relative;
    overflow: hidden;
    
    /* Enhanced glass effect for labels */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* Glass reflection for labels */
.fab-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0.1) 30%,
        transparent 60%,
        rgba(0, 0, 0, 0.05) 100%
    );
    border-radius: inherit;
    pointer-events: none;
}

/* Expanded state animations */
.fab-container.expanded .fab-sub-button {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.fab-container.expanded .fab-visit {
    transform: translate(-20px, -90px) scale(1) rotate(0deg);
    transition-delay: 0.1s;
}

.fab-container.expanded .fab-case {
    transform: translate(-80px, -40px) scale(1) rotate(0deg);
    transition-delay: 0.15s;
}

.fab-container.expanded .fab-doctor {
    transform: translate(-90px, -100px) scale(1) rotate(0deg);
    transition-delay: 0.2s;
}

.fab-container.expanded .fab-label {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.3s;
}

.fab-container.expanded .fab-icon {
    transform: rotate(45deg);
}

/* Main FAB icon animation */
.fab-icon {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Enhanced hover effects for desktop with liquid glass */
.fab-sub-button .btn:hover {
    transform: scale(1.15);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 
        0 16px 50px rgba(0, 0, 0, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        inset 1px 0 0 rgba(255, 255, 255, 0.2),
        inset -1px 0 0 rgba(0, 0, 0, 0.08);
}

.fab-main button:hover {
    transform: scale(1.1);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 
        0 16px 50px rgba(13, 110, 253, 0.3),
        0 4px 12px rgba(13, 110, 253, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        inset 1px 0 0 rgba(255, 255, 255, 0.2),
        inset -1px 0 0 rgba(0, 0, 0, 0.08);
}

/* Enhanced hover shimmer effect */
.fab-sub-button .btn:hover::after,
.fab-main button:hover::after {
    animation: shimmer 0.8s ease-in-out;
}

/* Desktop-specific sizing and positioning */
@media (min-width: 769px) {
    .fab-main button,
    .fab-sub-button .btn {
        width: 64px;
        height: 64px;
        font-size: 18px;
    }
    
    .fab-label {
        font-size: 15px;
        padding: 10px 18px;
    }
    
    .fab-container.expanded .fab-visit {
        transform: translate(-30px, -100px) scale(1) rotate(0deg);
    }
    
    .fab-container.expanded .fab-case {
        transform: translate(-90px, -50px) scale(1) rotate(0deg);
    }
    
    .fab-container.expanded .fab-doctor {
        transform: translate(-100px, -110px) scale(1) rotate(0deg);
    }
}

/* Mobile optimizations for FAB */
@media (max-width: 768px) {
    .fab-main button,
    .fab-sub-button .btn {
        width: 56px;
        height: 56px;
        font-size: 16px;
    }
    
    .fab-label {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    /* Mobile positioning for both FABs */
    .fab-container {
        bottom: 20px;
        right: 20px;
    }
    
    .fab-back-container {
        bottom: 20px;
        left: 20px;
    }
    
    /* Disable hover effects on mobile */
    .fab-sub-button .btn:hover,
    .fab-main button:hover {
        transform: none;
    }
    
    /* Touch feedback instead */
    .fab-sub-button .btn:active {
        transform: scale(0.95);
    }
    
    .fab-main button:active {
        transform: scale(0.95);
    }
}

/* Focus states for accessibility */
.fab-main button:focus,
.fab-sub-button .btn:focus {
    outline: none;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(13, 110, 253, 0.3);
}

/* Ensure FAB doesn't interfere with footer and align with back FAB */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

/* Ensure both FABs are at the same level and don't overlap */
.fab-back-container,
.fab-container {
    pointer-events: auto;
}

.fab-back-container .sticky-fab,
.fab-container .fab-main button {
    pointer-events: auto;
}


/* Calendar icons in table headers - KEEP ORIGINAL STYLING */
.table-header-centered .fas.fa-calendar-alt,
.table-header-centered .fa.fa-calendar-alt,
.table-header-centered .fas.fa-calendar,
.table-header-centered .fa.fa-calendar,
.table-header-centered .fas.fa-calendar-plus,
.table-header-centered .fa.fa-calendar-plus,
.table-header-centered .fas.fa-calendar-check,
.table-header-centered .fa.fa-calendar-check,
.table-header-centered i.fas.fa-calendar-alt,
.table-header-centered i.fa.fa-calendar-alt,
.table-header-centered i.fas.fa-calendar,
.table-header-centered i.fa.fa-calendar,
.table-header-centered i.fas.fa-calendar-plus,
.table-header-centered i.fa.fa-calendar-plus,
.table-header-centered i.fas.fa-calendar-check,
.table-header-centered i.fa.fa-calendar-check {
    background-color: transparent !important;
    color: inherit !important;
}

/* Calendar icons in navigation - KEEP ORIGINAL STYLING */
.nav-link .fas.fa-calendar-alt,
.nav-link .fa.fa-calendar-alt,
.nav-link .fas.fa-calendar,
.nav-link .fa.fa-calendar,
.nav-link .fas.fa-calendar-plus,
.nav-link .fa.fa-calendar-plus,
.nav-link .fas.fa-calendar-check,
.nav-link .fa.fa-calendar-check,
.nav-link i.fas.fa-calendar-alt,
.nav-link i.fa.fa-calendar-alt,
.nav-link i.fas.fa-calendar,
.nav-link i.fa.fa-calendar,
.nav-link i.fas.fa-calendar-plus,
.nav-link i.fa.fa-calendar-plus,
.nav-link i.fas.fa-calendar-check,
.nav-link i.fa.fa-calendar-check {
    background-color: transparent !important;
    color: inherit !important;
}



/* Heartbeat Pulse Animation Splash Screen */
.heartbeat-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 50%, #FF7F7F 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.heartbeat-splash.fade-out {
    opacity: 0;
    pointer-events: none;
}

.pulse-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 200px;
    height: 200px;
}

/* Heart Shape using CSS */
.heart-icon {
    width: 100px;
    height: 100px;
    position: relative;
    animation: heartbeat 1.5s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.heart-icon::before,
.heart-icon::after {
    content: "";
    position: absolute;
    width: 50px;
    height: 80px;
    background: white;
    border-radius: 50px 50px 0 0;
    top: 0;
}

.heart-icon::before {
    left: 50px;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
}

.heart-icon::after {
    left: 0;
    transform: rotate(45deg);
    transform-origin: 100% 100%;
}

/* Heartbeat Animation */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10% {
        transform: scale(1.2);
    }
    20% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.2);
    }
    40%, 100% {
        transform: scale(1);
    }
}

/* Pulse Ripple Effect */
.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: pulse-ripple 1.5s ease-out infinite;
}

.pulse-ring:nth-child(2) {
    animation-delay: 0.3s;
}

.pulse-ring:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes pulse-ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Loading Text */
.heartbeat-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 40px;
    text-align: center;
    animation: pulse-text 2s ease-in-out infinite;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

@keyframes pulse-text {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.heartbeat-subtext {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin-top: 10px;
    text-align: center;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

/* Mobile Optimizations for Heartbeat */
@media (max-width: 768px) {
    .pulse-container {
        width: 150px;
        height: 150px;
    }
    
    .heart-icon {
        width: 80px;
        height: 80px;
    }
    
    .heart-icon::before,
    .heart-icon::after {
        width: 40px;
        height: 64px;
    }
    
    .heart-icon::before {
        left: 40px;
    }
    
    .heartbeat-text {
        font-size: 1.25rem;
        margin-top: 30px;
    }
    
    .heartbeat-subtext {
        font-size: 0.9rem;
    }
}

/* Prevent body scroll when splash is active */
body.splash-active {
    overflow: hidden;
}

/* Mobile Sticky Footer Navigation */
.mobile-footer-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Show mobile footer navigation on mobile devices only */
    .mobile-footer-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--primary-orange);
        z-index: 1040;
        height: 78px;
        padding: 0;
        margin: 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        align-items: center;
        justify-content: space-around;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .mobile-footer-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: white;
        text-decoration: none;
        transition: all 0.2s ease;
        border: none;
        background: transparent;
        cursor: pointer;
        padding: 8px 4px;
        position: relative;
    }
    
    .mobile-footer-nav-item:hover,
    .mobile-footer-nav-item:focus {
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        text-decoration: none;
        outline: none;
    }
    
    .mobile-footer-nav-item:active {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    /* Active state indicator */
    .mobile-footer-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 3px;
        background-color: white;
        border-radius: 0 0 3px 3px;
    }
    
    .mobile-footer-nav-item i {
        font-size: 22px;
        margin-bottom: 4px;
        color: white !important;
        background-color: transparent !important;
    }
    
    .mobile-footer-nav-item span {
        font-size: 11px;
        font-weight: 500;
        color: white;
        text-align: center;
        line-height: 1.2;
    }
    
    /* Ensure menu icon changes size when toggled */
    .mobile-footer-nav-item .fa-times {
        font-size: 24px;
    }
    
    /* Add padding to main content to prevent overlap with fixed footer */
    main.flex-shrink-0 {
        padding-bottom: 90px !important;
    }
    
    /* Hide regular footer on mobile */
    .footer {
        display: none !important;
    }
    
    /* Adjust FAB buttons position to avoid overlap with mobile footer */
    .fab-container {
        bottom: 102px !important;
    }
    
    .fab-back-container {
        display: none !important;
    }
    
    /* Prevent calendar icon styling from affecting mobile footer nav */
    .mobile-footer-nav-item .fas.fa-calendar-alt,
    .mobile-footer-nav-item .fa.fa-calendar-alt,
    .mobile-footer-nav-item .fas.fa-calendar,
    .mobile-footer-nav-item .fa.fa-calendar,
    .mobile-footer-nav-item .fas.fa-calendar-check,
    .mobile-footer-nav-item .fa.fa-calendar-check,
    .mobile-footer-nav-item i.fas.fa-calendar-alt,
    .mobile-footer-nav-item i.fa.fa-calendar-alt,
    .mobile-footer-nav-item i.fas.fa-calendar,
    .mobile-footer-nav-item i.fa.fa-calendar,
    .mobile-footer-nav-item i.fas.fa-calendar-check,
    .mobile-footer-nav-item i.fa.fa-calendar-check {
        background-color: transparent !important;
        color: white !important;
    }
}
/* 
    }
}

/* Mobile responsiveness for keyboard navigation */
@media (max-width: 768px) {
    .table-keyboard-focus {
        outline-width: 3px;
        outline-offset: -3px;
    }
    
    .table-keyboard-focus::after {
        border-width: 3px;
    }
    
    /* Larger touch targets for mobile */
    table[tabindex="0"] tbody tr td {
        min-height: 44px;
    }
}

/* Focus visible for keyboard users only */
table[tabindex="0"]:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 4px;
}

/* Ensure keyboard focus doesn't interfere with other table styles */
.table-view tbody tr:hover td:not(.table-keyboard-focus) {
    background-color: #f8f9fa;
}

.table-view tbody tr:hover td.table-keyboard-focus {
    background-color: rgba(255, 107, 53, 0.15);
}

/* Keyboard navigation indicator for screen readers */
.table-keyboard-nav-active::before {
    content: 'Keyboard navigation active. Use arrow keys to navigate, Enter to activate, Escape to clear selection.';
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Visual indicator that table supports keyboard navigation */
table[data-keyboard-nav] {
    position: relative;
}

table[data-keyboard-nav]:focus::before {
    content: 'Use arrow keys to navigate';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% {
        opacity: 0;
    }
    10%, 90% {
        opacity: 1;
    }
}

/* Ensure keyboard focus works well with sticky columns */
.table-responsive table thead tr th:last-child.table-keyboard-focus,
.table-responsive table tbody tr td:last-child.table-keyboard-focus {
    z-index: 11;
}

/* Keyboard navigation help text styling */
.keyboard-nav-help {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 10px;
    text-align: center;
    font-style: italic;
}

.keyboard-nav-help kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-family: monospace;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ===== Column Resizing Styles ===== */

/* Resizable column header positioning */
.resizable {
    position: relative;
}

/* Resize handle styling */
.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
    background: transparent;
    transition: background-color 0.2s ease;
}

/* Hover state for resize handle */
.resize-handle:hover {
    background-color: rgba(255, 107, 53, 0.3);
}

/* Active state during resize */
.resize-handle:active {
    background-color: rgba(255, 107, 53, 0.5);
}

/* Visual feedback during resize operation */
.table.resizing {
    user-select: none;
    cursor: col-resize;
}

.table th.resizing-column {
    background-color: rgba(255, 107, 53, 0.15);
    transition: background-color 0.15s ease;
}

/* Resize cursor for the entire table during resize */
.table.resizing * {
    cursor: col-resize !important;
}

/* Ensure resize handle is visible on hover */
.resizable:hover .resize-handle {
    background-color: rgba(255, 107, 53, 0.2);
}

/* Add a subtle visual indicator on the resize handle */
.resize-handle::before {
    content: '';
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 20px;
    background-color: rgba(255, 107, 53, 0.4);
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.resize-handle:hover::before,
.resizable:hover .resize-handle::before {
    opacity: 1;
}

/* Disable resizing on mobile devices */
@media (max-width: 768px) {
    .resize-handle {
        display: none !important;
        pointer-events: none;
    }
    
    .resizable {
        cursor: default !important;
    }
}

/* Disable resizing on touch devices */
@media (hover: none) and (pointer: coarse) {
    .resize-handle {
        display: none !important;
        pointer-events: none;
    }
    
    .resizable {
        cursor: default !important;
    }
}

/* High contrast mode support for resize handle */
@media (prefers-contrast: high) {
    .resize-handle:hover {
        background-color: rgba(0, 0, 0, 0.3);
        border-left: 2px solid #000;
    }
    
    .resize-handle::before {
        background-color: #000;
    }
    
    .table th.resizing-column {
        background-color: rgba(0, 0, 0, 0.1);
        border: 2px solid #000;
    }
}

/* Reduced motion support for resize operations */
@media (prefers-reduced-motion: reduce) {
    .resize-handle,
    .table th.resizing-column {
        transition: none;
    }
    
    .resize-handle::before {
        transition: none;
    }
}

/* Focus state for accessibility */
.resize-handle:focus {
    outline: 2px solid var(--primary-orange);
    outline-offset: -2px;
}

.resize-handle:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: -2px;
    background-color: rgba(255, 107, 53, 0.25);
}

/* Ensure resize handle doesn't interfere with header content */
.resizable .header-text,
.resizable i {
    pointer-events: none;
}

/* Prevent text selection during resize */
.table.resizing,
.table.resizing * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== End Column Resizing Styles ===== */

/* Table Consistency Utility Classes */

/* Text alignment utilities for table cells */
.table-cell-center {
    text-align: center !important;
    vertical-align: middle !important;
}

.table-cell-left {
    text-align: left !important;
    vertical-align: middle !important;
}

/* Date and time formatting */
.table-date-primary {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
}

.table-time-secondary {
    display: block;
    font-size: 0.8rem;
    font-style: italic;
    color: #6c757d;
    line-height: 1.2;
}

/* Actions column specific styling */
.table-actions-column {
    text-align: center !important;
    vertical-align: middle !important;
    min-width: 180px;
}

/* Sorting styles */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background-color: rgba(255, 107, 53, 0.1);
}

.sort-indicator {
    margin-left: 4px;
    font-size: 0.8em;
    opacity: 0.5;
}

.sortable.sorted .sort-indicator {
    opacity: 1;
}

/* ===== Action Button Wrapping Styles ===== */

/* Button group with wrapping support */
.btn-group-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

/* Visual separation for delete buttons */
.btn-group-wrap .btn-outline-danger {
    margin-left: 8px;
}

/* Ensure buttons remain accessible and clickable */
.btn-group-wrap .btn {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    white-space: nowrap;
}

/* Ensure proper spacing between wrapped rows */
.btn-group-wrap {
    row-gap: 6px;
}

/* Mobile responsiveness for button wrapping */
@media (max-width: 768px) {
    .btn-group-wrap {
        gap: 6px;
        row-gap: 8px;
    }
    
    .btn-group-wrap .btn {
        min-width: 40px;
        min-height: 40px;
        padding: 0.5rem 0.6rem;
    }
    
    .btn-group-wrap .btn-outline-danger {
        margin-left: 6px;
    }
}

/* Tablet responsiveness */
@media (min-width: 769px) and (max-width: 1024px) {
    .btn-group-wrap {
        gap: 5px;
        row-gap: 7px;
    }
    
    .btn-group-wrap .btn {
        min-width: 38px;
        min-height: 38px;
    }
}

/* Ensure buttons don't break layout in narrow columns */
.table-actions-column .btn-group-wrap {
    max-width: 100%;
}

/* High contrast mode support for button separation */
@media (prefers-contrast: high) {
    .btn-group-wrap .btn-outline-danger {
        border: 2px solid #dc3545;
        margin-left: 10px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .btn-group-wrap .btn {
        transition: none;
    }
}

/* Focus states for accessibility */
.btn-group-wrap .btn:focus {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
    z-index: 1;
}

.btn-group-wrap .btn:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
    z-index: 1;
}

/* Ensure delete button stands out visually */
.btn-group-wrap .btn-outline-danger {
    position: relative;
}

.btn-group-wrap .btn-outline-danger::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background-color: #dee2e6;
    opacity: 0.5;
}

/* Remove separator on mobile for cleaner look */
@media (max-width: 768px) {
    .btn-group-wrap .btn-outline-danger::before {
        display: none;
    }
}

/* Ensure proper alignment in table cells */
.table-actions-column .btn-group-wrap {
    justify-content: center;
}

/* Touch-friendly spacing on mobile */
@media (hover: none) and (pointer: coarse) {
    .btn-group-wrap {
        gap: 8px;
        row-gap: 10px;
    }
    
    .btn-group-wrap .btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ===== End Action Button Wrapping Styles ===== */

/* ===== View Toggle Styles ===== */

/* Default state: hide table view, show card view */
.items-table-container {
    display: none;
}

.items-card-container {
    display: block;
}

/* When table view is active */
body[data-view="table"] .items-table-container {
    display: block;
}

body[data-view="table"] .items-card-container {
    display: none;
}

/* When card view is active */
body[data-view="card"] .items-table-container {
    display: none;
}

body[data-view="card"] .items-card-container {
    display: block;
}

/* View toggle button container */
.view-toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-toggle-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.view-toggle-btn.active {
    background: var(--primary-orange, #0d6efd);
    color: white;
    border-color: var(--primary-orange, #0d6efd);
}

.view-toggle-btn i {
    margin-right: 0.25rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Hide view toggle on mobile - only show card view */
    .view-toggle-container {
        display: none !important;
    }
}

/* ===== End View Toggle Styles ===== */
