/* DrChrono Patient Search - Custom Styles */

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Loading Animations */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.loading-pulse {
    animation: pulse 1.5s infinite;
}

/* App Loading Badge */
.app-loading-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    animation: subtle-pulse 2s ease-in-out infinite;
}

@keyframes subtle-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
        transform: scale(1.02);
    }
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-flex;
    align-items: center;
    margin-right: 0.5rem;
}

.loading-dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 2px;
    background-color: white;
    border-radius: 50%;
    animation: loading-dots-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loading-dots-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Fade out animation for loading indicator */
@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

.fade-out-scale {
    animation: fadeOutScale 0.3s ease-out forwards;
}

/* Global Styles */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

/* Cards and Shadows */
.card {
    border: none;
    border-radius: 10px;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

/* Search Input */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Search Results Table */
.table th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Patient Detail Modal */
.modal-content {
    border-radius: 10px;
    overflow: hidden;
    border: none;
}

.modal-header {
    border-bottom: none;
    border-radius: 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0;
}

/* Modal size for patient details */
.modal-xl {
    max-width: 95%;
    height: 90vh;
}

.modal-xl .modal-content {
    height: 90vh;
}

.modal-xl .modal-body {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* Appointments Section */
#appointmentsSection {
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

#appointmentsSection h6 {
    color: #495057;
    font-weight: 600;
}

/* Print button styling in appointments section */
#appointmentsSection .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

#appointmentsSection .btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}


/* Appointment Status Badges */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Appointment Table Styling */
.table-responsive {
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.table td {
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Row highlighting for different appointment statuses */
.table-danger {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.table-dark {
    background-color: rgba(33, 37, 41, 0.1) !important;
}

/* Appointment Row Styling */
.appointment-row {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.appointment-row:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

/* When appointment has a color from API, enhance the hover effect */
.appointment-row[style*="border-left"]:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateX(3px);
}

.appointment-row.table-danger {
    background: linear-gradient(135deg, #ffebee 0%, #fce4ec 100%);
    border-left-color: #f44336;
}

.appointment-row.table-danger:hover {
    background: linear-gradient(135deg, #ffcdd2 0%, #f8bbd9 100%);
    border-left-color: #d32f2f;
}

.appointment-row.table-warning {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3c4 100%);
    border-left-color: #ff9800;
}

.appointment-row.table-warning:hover {
    background: linear-gradient(135deg, #ffecb3 0%, #ffe082 100%);
    border-left-color: #f57c00;
}

/* Button group styling in appointment rows */
.appointment-row .btn-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
}

.appointment-row .btn-group .btn {
    border-radius: 4px;
    margin: 0;
    transition: all 0.2s ease;
    flex: 0 0 auto;
    min-width: 32px;
    padding: 0.25rem 0.5rem;
}

.appointment-row .btn-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Ensure button groups don't wrap */
.appointment-row .btn-group {
    white-space: nowrap;
}

/* Appointment Details Dropdown Animation */
#appointmentsList tr[id^="details-row-"] {
    transition: all 0.3s ease;
    overflow: hidden;
    background-color: #f8f9fa;
}

#appointmentsList tr[id^="details-row-"] td {
    padding: 0;
    border-top: none;
    background-color: #f8f9fa;
}

#appointmentsList tr[id^="details-row-"] .card {
    margin: 0;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: #f8f9fa;
}

/* Appointment Details Content Styling */
#appointmentsList tr[id^="details-row-"] .card-body {
    background-color: #f8f9fa;
    padding: 1.5rem;
}

#appointmentsList tr[id^="details-row-"] .card-header {
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

/* Card styling within appointment details */
#appointmentsList tr[id^="details-row-"] .card {
    border: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

#appointmentsList tr[id^="details-row-"] .card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#appointmentsList tr[id^="details-row-"] .card-header {
    border-radius: 0.375rem 0.375rem 0 0;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
}

#appointmentsList tr[id^="details-row-"] .card-body {
    padding: 1rem;
}

/* Specific card header colors */
#appointmentsList tr[id^="details-row-"] .card-header.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
}

#appointmentsList tr[id^="details-row-"] .card-header.bg-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%) !important;
}

#appointmentsList tr[id^="details-row-"] .card-header.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ffca2c 100%) !important;
    color: #000 !important;
}

#appointmentsList tr[id^="details-row-"] .card-header.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #3dd5f3 100%) !important;
}

/* Appointment count styling */
#appointmentCount {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Checkbox styling for Show Canceled & Rescheduled */
.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Empty state styling */
.text-center.py-4 {
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
}

/* Date/Time column styling */
.table td:first-child {
    min-width: 100px;
}

/* Notes column styling */
.table td:last-child {
    max-width: 200px;
    word-wrap: break-word;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Badges */
.badge {
    font-size: 0.8rem;
    padding: 0.5em 0.75em;
}

/* Gender Badge Colors */
.badge.bg-primary {
    background-color: #0d6efd !important;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
}

.badge.bg-success {
    background-color: #198754 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Code Elements */
code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #d63384;
}

/* Button Styles */
.btn {
    border-radius: 6px;
    font-weight: 500;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 8px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
}

/* Mobile-specific search form improvements */
@media (max-width: 991.98px) {
    /* Search form mobile styling */
    #searchForm {
        align-items: stretch !important;
    }
    
    #searchForm .col-12:first-child {
        margin-bottom: 1rem;
    }
    
    /* Better mobile placeholder text */
    #searchInput::placeholder {
        font-size: 0.9rem;
    }
    
    /* Mobile help text positioning */
    .search-help-text {
        position: static !important;
        margin-top: 0.5rem !important;
        font-size: 0.8rem;
        color: #6c757d;
    }
    
    /* Ensure button has good touch target on mobile */
    #searchBtn {
        min-height: 48px;
        font-size: 1rem;
    }
    
    /* Adjust card padding for mobile */
    .card-body {
        padding-bottom: 0.5rem !important;
    }
}

/* Tablet and small desktop adjustments */
@media (min-width: 992px) and (max-width: 1199.98px) {
    #searchInput::placeholder {
        font-size: 0.95rem;
    }
}

/* Enhanced help text styling for all screen sizes */
.search-help-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
    line-height: 1.4;
}

@media (min-width: 992px) {
    .search-help-text {
        position: absolute;
        top: 100%;
        left: 0;
    }
}

/* Patient Modal Mobile Responsiveness - 2 Column Layout */
@media (max-width: 575.98px) {
    /* Ultra-mobile optimizations */
    .patient-info-section {
        padding: 0 0.25rem;
        margin-bottom: 1rem;
    }
    
    .patient-section-title {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        padding: 0.25rem 0;
        border-bottom: 1px solid #dee2e6;
    }
    
    .patient-section-title i {
        font-size: 0.75rem;
    }
    
    /* Compact table layout for mobile 2-column */
    .patient-info-table {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }
    
    .patient-info-table td {
        padding: 0.25rem 0.1rem;
        border: none;
        vertical-align: top;
    }
    
    .patient-info-table td:first-child {
        font-weight: 600;
        width: 25%;
        padding-right: 0.25rem;
        color: #495057;
        font-size: 0.65rem;
        line-height: 1.3;
    }
    
    .patient-info-table td:last-child {
        word-break: break-word;
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    /* Specific field optimizations */
    .patient-email {
        word-break: break-all;
        font-size: 0.65rem;
    }
    
    .patient-code {
        font-size: 0.6rem;
        padding: 0.1rem 0.2rem;
        background-color: #f8f9fa;
        border-radius: 2px;
    }
    
    .patient-phone {
        font-size: 0.7rem;
    }
    
    .badge {
        font-size: 0.6rem;
        padding: 0.2em 0.4em;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Small mobile/large phone optimizations */
    .patient-info-section {
        padding: 0 0.5rem;
        margin-bottom: 1.25rem;
    }
    
    .patient-section-title {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .patient-info-table {
        font-size: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .patient-info-table td {
        padding: 0.3rem 0.2rem;
    }
    
    .patient-info-table td:first-child {
        width: 25%;
        font-size: 0.7rem;
    }
    
    .patient-info-table td:last-child {
        font-size: 0.75rem;
    }
    
    .patient-email {
        font-size: 0.7rem;
    }
    
    .patient-code {
        font-size: 0.65rem;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Tablet 2-column layout */
    .patient-info-section {
        padding: 0 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .patient-section-title {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .patient-info-table {
        font-size: 0.85rem;
        margin-bottom: 1.25rem;
    }
    
    .patient-info-table td {
        padding: 0.4rem 0.3rem;
    }
    
    .patient-info-table td:first-child {
        width: 25%;
        font-size: 0.8rem;
    }
    
    .patient-email {
        font-size: 0.8rem;
        word-break: break-word;
    }
    
    .patient-code {
        font-size: 0.75rem;
    }
}

/* General mobile modal adjustments */
@media (max-width: 991.98px) {
    /* Modal adjustments for mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        height: calc(100vh - 1rem);
        overflow-y: auto;
    }
    
    .modal-body {
        padding: 1rem 0.75rem;
        overflow-y: auto;
        max-height: calc(100vh - 8rem);
    }
    
    /* Patient details row spacing */
    .patient-details-row {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    .patient-details-row .col-6 {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Appointments Table Mobile Responsiveness */
@media (max-width: 991.98px) {
    /* Appointments table container */
    .appointments-table-container {
        font-size: 0.85rem;
    }
    
    /* Date column mobile adjustments */
    .appointment-date-info {
        min-width: 120px;
    }
    
    .appointment-date-info .fw-bold {
        font-size: 0.9rem;
        line-height: 1.2;
    }
    
    /* Status column mobile adjustments */
    .appointment-status-badge {
        font-size: 0.75rem;
        padding: 0.25em 0.5em;
    }
    
    .appointment-reason-mobile {
        font-size: 0.75rem;
        line-height: 1.2;
        display: block;
        margin-top: 0.25rem;
    }
    
    /* Action buttons mobile optimization */
    .appointment-actions {
        flex-direction: column;
        gap: 2px;
    }
    
    .appointment-action-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 4px;
    }
    
    .appointment-action-btn i {
        font-size: 0.9rem;
    }
    
    /* Ensure table cells have proper padding on mobile */
    .appointments-table td {
        padding: 0.75rem 0.5rem;
        vertical-align: middle;
    }
    
    /* Hide overflow and add proper text truncation */
    .appointments-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablet and medium screen adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .patient-info-table {
        font-size: 0.95rem;
    }
    
    .appointment-action-btn {
        min-width: 40px;
        min-height: 32px;
        padding: 0.3rem 0.5rem;
    }
    
    .appointments-table-container {
        font-size: 0.9rem;
    }
}

/* Large screen enhancements */
@media (min-width: 992px) {
    /* Patient details optimal spacing */
    .patient-details-row {
        margin-bottom: 1rem;
    }
    
    .patient-info-section {
        padding: 0 1rem;
        margin-bottom: 0;
    }
    
    .patient-section-title {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        color: #495057;
    }
    
    .patient-info-table {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .patient-info-table td {
        padding: 0.5rem 0.5rem;
    }
    
    .patient-info-table td:first-child {
        width: 35%;
        font-weight: 400;
        color: #495057;
    }
    
    .patient-email {
        font-size: 1rem;
        word-break: break-word;
    }
    
    .patient-code {
        font-size: 0.9rem;
        padding: 0.2rem 0.4rem;
    }
    
    .patient-phone {
        font-size: 1rem;
    }
    
    /* Action buttons hover effects */
    .appointment-action-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    /* Appointments table optimal layout */
    .appointments-table td {
        padding: 1rem 0.75rem;
    }
}

/* Touch-friendly improvements for all screen sizes */
.appointment-action-btn {
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 500;
}

.appointment-action-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Patient modal header responsiveness */
@media (max-width: 575.98px) {
    .modal-header {
        padding: 1rem 1rem 0.5rem;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-title {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .modal-header .btn-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
}

/* HCFA Section Mobile Responsiveness */
@media (max-width: 575.98px) {
    /* Main HCFA section spacing */
    .hcfa-section-row {
        margin-top: 1rem !important;
        margin-bottom: 0;
    }
    
    .hcfa-main-card {
        border-radius: 6px;
    }
    
    .hcfa-card-header {
        padding: 0.5rem 0.75rem;
    }
    
    .hcfa-header-title {
        font-size: 0.9rem;
    }
    
    .hcfa-card-body {
        padding: 0.75rem;
    }
    
    /* Options container with reduced gap */
    .hcfa-options-container {
        gap: 0.0rem !important;
    }
    
    /* Individual option cards */
    .hcfa-option-card {
        border-radius: 4px;
        margin-bottom: 0 !important;
    }
    
    .hcfa-option-body {
        padding: 0.0rem !important;
    }
    
    .hcfa-option-title {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .hcfa-option-title i {
        font-size: 0.8rem;
    }
    
    /* Button groups on mobile */
    .hcfa-btn-group {
        margin-top: 0.25rem;
    }
    
    .hcfa-btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
        min-height: 36px;
    }
    
    .hcfa-btn i {
        font-size: 0.75rem;
    }
    
    /* Info text at bottom */
    .hcfa-info-text {
        margin-top: 0.75rem !important;
    }
    
    .hcfa-info-text small {
        font-size: 0.75rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Small tablet HCFA adjustments */
    .hcfa-section-row {
        margin-top: 1.5rem !important;
    }
    
    .hcfa-card-body {
        padding: 1rem;
    }
    
    .hcfa-options-container {
        gap: 0.75rem !important;
    }
    
    .hcfa-option-body {
        padding: 0.75rem !important;
    }
    
    .hcfa-option-title {
        font-size: 0.9rem;
    }
    
    .hcfa-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
    
    .hcfa-info-text {
        margin-top: 1rem !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Tablet HCFA adjustments */
    .hcfa-section-row {
        margin-top: 2rem !important;
    }
    
    .hcfa-options-container {
        gap: 1rem !important;
    }
    
    .hcfa-option-body {
        padding: 1rem !important;
    }
    
    .hcfa-info-text {
        margin-top: 1rem !important;
    }
}

@media (min-width: 992px) {
    /* Desktop HCFA styling */
    .hcfa-section-row {
        margin-top: 2rem !important;
    }
    
    .hcfa-options-container {
        gap: 0.0rem !important;
    }
    
    .hcfa-option-body {
        padding: 0.5rem !important;
    }
    
    .hcfa-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .hcfa-info-text {
        margin-top: 1rem !important;
    }
}

/* Patient Modal Download Buttons Mobile Responsiveness */
@media (max-width: 575.98px) {
    /* Ultra-mobile layout */
    .appointments-header-container {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    
    .appointments-title-section {
        text-align: center;
    }
    
    .appointments-title {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
    
    .appointments-controls {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    
    .download-buttons-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        max-width: 280px;
    }
    
    .download-btn {
        width: 100%;
        min-height: 40px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
    
    .download-btn i {
        font-size: 0.85rem;
        margin-right: 0.5rem;
        flex-shrink: 0;
    }
    
    .download-btn .btn-text {
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    .appointments-filter-check {
        margin-bottom: 0;
        text-align: center;
    }
    
    .appointments-filter-check label {
        font-size: 0.8rem;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Small tablet layout */
    .appointments-header-container {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    
    .appointments-title-section {
        text-align: center;
    }
    
    .appointments-controls {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }
    
    .download-buttons-container {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        width: 100%;
    }
    
    .download-btn {
        flex: 1;
        min-width: 140px;
        max-width: 180px;
        min-height: 38px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
    }
    
    .download-btn .btn-text {
        font-size: 0.75rem;
        line-height: 1.2;
        text-align: center;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Tablet layout */
    .appointments-header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .appointments-controls {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-end;
    }
    
    .download-buttons-container {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    
    .download-btn {
        min-height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .download-btn .btn-text {
        font-size: 0.8rem;
    }
}

@media (min-width: 992px) {
    /* Desktop layout - original design */
    .appointments-header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .appointments-controls {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    .download-buttons-container {
        display: flex;
        gap: 0.75rem;
    }
    
    .download-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
        transition: all 0.2s ease;
    }
    
    .download-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .download-btn .btn-text {
        font-size: 0.875rem;
    }
    
    .appointments-filter-check {
        margin-left: 0.5rem;
    }
}

/* Custom Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Search Result Highlighting */
.search-highlight {
    background-color: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

/* Status Indicators */
.status-online {
    color: #198754;
}

.status-offline {
    color: #dc3545;
}

/* Icon Styles */
.fas, .far {
    width: 1.2em;
    text-align: center;
}

/* Table Enhancements */
.table > :not(caption) > * > * {
    padding: 0.25rem 0.25rem;
}

.table-dark th {
    background-color: #495057;
    border-color: #495057;
}

/* Form Enhancements */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-text {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error States */
.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 0.875rem;
}

/* Success States */
.is-valid {
    border-color: #198754;
}

.valid-feedback {
    color: #198754;
    font-size: 0.875rem;
}

/* Custom Scrollbar */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Clinical Notes Styling */
.clinical-note-content {
    white-space: pre-wrap;
    line-height: 1.6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.clinical-note-content b,
.clinical-note-content strong {
    color: #2c5aa0;
    font-weight: 600;
}

.clinical-note-content i,
.clinical-note-content em {
    color: #6c757d;
    font-style: italic;
}

.clinical-note-content p {
    margin-bottom: 1rem;
}

.clinical-note-content br {
    line-height: 2;
}

/* Patient Modal Tabs Styling */
.patient-modal-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem !important;
}

.patient-modal-tabs .nav-link {
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    background: transparent;
}

.patient-modal-tabs .nav-link:hover {
    color: #0d6efd;
    border-bottom-color: rgba(13, 110, 253, 0.3);
    background: rgba(13, 110, 253, 0.05);
}

.patient-modal-tabs .nav-link.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
    background: transparent;
    font-weight: 600;
}

.patient-modal-tabs .nav-link i {
    font-size: 0.9rem;
}

/* Tab content styling */
.tab-content {
    animation: fadeIn 0.3s ease-in-out;
}

/* Visualization tab placeholder styling */
#visualization .fa-chart-bar {
    opacity: 0.3;
}

#visualization .alert-info {
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(13, 202, 240, 0.2);
}

/* Mobile responsiveness for tabs */
@media (max-width: 575.98px) {
    .patient-modal-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .patient-modal-tabs .nav-link i {
        font-size: 0.8rem;
        margin-right: 0.25rem !important;
    }
    
    .patient-modal-tabs {
        margin-bottom: 1rem !important;
    }
    
    #visualization h4 {
        font-size: 1.1rem;
    }
    
    #visualization .alert-info {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
    }
    
    #visualization .fa-chart-bar {
        font-size: 3rem !important;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .patient-modal-tabs .nav-link {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    #visualization .fa-chart-bar {
        font-size: 4rem !important;
    }
}

/* Visualization Tab Styling */
.visualization-toolbar {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.appointment-nav-container {
    position: relative;
    padding: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    cursor: grab;
}

.appointment-nav-container:active {
    cursor: grabbing;
}

.appointment-nav-container::-webkit-scrollbar {
    height: 8px;
}

.appointment-nav-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.appointment-nav-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.appointment-nav-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.appointment-date-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
    border: 3px solid transparent;
    background: var(--appointment-color, #6c757d);
    color: white;
    transition: all 0.3s ease;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    min-width: 180px;
    text-align: left;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.appointment-date-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.appointment-date-btn.active {
    border-color: white;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-3px) scale(1.05);
}

.appointment-date-btn.active::before {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #28a745;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.4);
}

.appointment-btn-date {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.appointment-btn-reason {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
    line-height: 1.2;
}

.appointment-btn-type {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0.7;
}

/* Clinical Note Display Wrapper with Section Navigation */
.clinical-note-display-wrapper {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.section-nav-sidebar {
    min-width: 180px;
    max-width: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: sticky;
    top: 1rem;
    align-self: flex-start;
    max-height: 500px;
}

.section-nav-title {
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 0.25rem;
}

.section-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.875rem;
    text-align: left;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.section-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(5px);
}

.section-nav-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateX(8px) scale(1.05);
    font-weight: 600;
}

.section-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.soap-content-container {
    flex: 1;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    min-height: 400px;
    max-height: 700px;
    overflow-y: auto;
    /* scroll-behavior controlled by JavaScript for better control */
}

.soap-content-container .clinical-note-content {
    line-height: 1.8;
    font-size: 0.95rem;
    white-space: pre-wrap; /* Preserve whitespace and line breaks */
    word-wrap: break-word;
}

/* Style for plain content without sections */
.clinical-note-plain {
    white-space: pre-wrap;
    line-height: 1.8;
    font-size: 0.95rem;
}

/* Section areas with colored backgrounds */
.section-area {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
    white-space: pre-wrap;
    line-height: 1.8;
}

.section-area[data-section="HPI"] {
    border-left-color: #667eea;
}

.section-area[data-section="Physical Exam"] {
    border-left-color: #28a745;
}

.section-area[data-section="Images"] {
    border-left-color: #ffc107;
}

.section-area[data-section="PDMP"] {
    border-left-color: #17a2b8;
}

.section-area[data-section="Assessment"] {
    border-left-color: #dc3545;
}

.section-area[data-section="Plan"] {
    border-left-color: #6f42c1;
}

.section-header-marker {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.section-header-marker strong {
    color: #333;
}

.soap-content-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px 8px 0 0;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

.soap-content-header h5 {
    margin: 0;
    font-weight: 600;
}

.soap-content-header .appointment-info {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.soap-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.soap-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Mobile adjustments for visualization */
@media (max-width: 767.98px) {
    .visualization-toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    #refreshSoapNotesBtn {
        width: 100%;
    }
    
    .appointment-nav-container {
        width: 100%;
    }
    
    .appointment-date-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
    
    .soap-content-container {
        padding: 1rem;
        max-height: 700px;
    }
    
    .soap-content-header {
        padding: 0.75rem 1rem;
        margin: -1rem -1rem 1rem -1rem;
    }
}