/* ================================================
   BenhNhan Page Styles - Redesigned
   Clean, modern, user-friendly
   ================================================ */

/* Card Header */
.page-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    flex-wrap: wrap;
}

.page-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.page-card-actions .ant-btn {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
    border-radius: var(--radius) !important;
    font-weight: 500 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.page-card-actions .ant-btn-primary {
    background: var(--medical-primary) !important;
    border-color: var(--medical-primary) !important;
}

.page-card-actions .ant-btn-primary:hover {
    background: var(--medical-primary-dark) !important;
    border-color: var(--medical-primary-dark) !important;
}

/* ============ REDESIGNED MODERN FILTER BAR ============ */
.patient-filter-container {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 12px;
    box-shadow: 0 2px 12px -2px rgba(15, 23, 42, 0.04), 0 1px 4px -1px rgba(15, 23, 42, 0.02);
    border: 1px solid #e2e8f0;
    transition: all 0.25s ease;
}

.patient-filter-container:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.06);
}

.patient-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.patient-filter-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap !important;
    flex-shrink: 0;
}

.patient-filter-title span {
    white-space: nowrap !important;
    word-break: keep-all !important;
    font-weight: 600;
    display: inline-block;
}

.filter-title-badge {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(2, 132, 199, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0ea5e9;
    flex-shrink: 0;
}

.filter-title-badge svg {
    width: 14px;
    height: 14px;
}

.patient-filter-count {
    font-size: 12px;
    font-weight: 600;
    color: #0284c7;
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.patient-filter-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-filter-toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-filter-toggle-pill svg {
    color: #0284c7;
    transition: transform 0.2s ease;
}

.btn-filter-toggle-pill:hover {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
}

.btn-filter-toggle-pill.is-collapsed {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.15);
}

.patient-filter-container.filter-collapsed {
    margin-bottom: 4px !important;
    padding-bottom: 6px !important;
}

.patient-filter-container.filter-collapsed .patient-filter-header {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.count-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
}

/* ============ FILTER CONTROLS GRID ============ */
.dm-filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.dm-filter-item {
    min-width: 0;
    flex: 1 1 170px;
}

.dm-filter-search {
    flex: 1.3 1 220px;
}

/* Prefix search icon */
.filter-prefix-icon {
    width: 16px;
    height: 16px;
    color: #94a3b8;
    margin-right: 6px;
    transition: color 0.2s ease;
}

.dm-search-input.ant-input-affix-wrapper:hover .filter-prefix-icon,
.dm-search-input.ant-input-affix-wrapper-focused .filter-prefix-icon {
    color: #0ea5e9;
}

/* Search input */
.dm-search-input {
    width: 100% !important;
}

.dm-search-input.ant-input-affix-wrapper {
    height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    padding: 0 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

.dm-search-input.ant-input-affix-wrapper .ant-input {
    height: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 13px !important;
    padding: 0 !important;
    color: #0f172a !important;
}

.dm-search-input.ant-input-affix-wrapper:hover {
    border-color: #0ea5e9 !important;
    background: #f8fafc !important;
}

.dm-search-input.ant-input-affix-wrapper-focused,
.dm-search-input.ant-input-affix-wrapper:focus-within {
    border-color: #0ea5e9 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

input.ant-input.dm-search-input {
    height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    color: #0f172a !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

input.ant-input.dm-search-input:hover {
    border-color: #0ea5e9 !important;
    background: #f8fafc !important;
}

input.ant-input.dm-search-input:focus {
    border-color: #0ea5e9 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
    outline: none !important;
}

/* Select Component (.ant-select) */
.dm-filter-item .ant-select {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100%;
}

.dm-filter-item .ant-select .ant-select-selector {
    height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

.dm-filter-item .ant-select-selection-item,
.dm-filter-item .ant-select-selection-placeholder {
    line-height: 34px !important;
    font-size: 13px !important;
    color: #0f172a !important;
    font-weight: 400;
}

.dm-filter-item .ant-select-selection-placeholder {
    color: #94a3b8 !important;
}

.dm-filter-item .ant-select:hover .ant-select-selector {
    border-color: #0ea5e9 !important;
    background: #f8fafc !important;
}

.dm-filter-item .ant-select-focused .ant-select-selector,
.dm-filter-item .ant-select-open .ant-select-selector {
    border-color: #0ea5e9 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

/* DatePicker Component (.ant-picker) */
.dm-filter-item .ant-picker {
    height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    padding: 0 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
    width: 100%;
}

.dm-filter-item .ant-picker-input {
    display: flex !important;
    align-items: center !important;
    width: 100%;
}

.dm-filter-item .ant-picker-input > input {
    height: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 13px !important;
    line-height: normal !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: #0f172a !important;
}

.dm-filter-item .ant-picker-input > input::placeholder {
    color: #94a3b8 !important;
}

.dm-filter-item .ant-picker:hover {
    border-color: #0ea5e9 !important;
    background: #f8fafc !important;
}

.dm-filter-item .ant-picker-focused,
.dm-filter-item .ant-picker:focus-within {
    border-color: #0ea5e9 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15) !important;
}

/* Filter actions (Lọc / Đặt lại / Xóa đã chọn) */
.dm-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.dm-filter-actions .ant-btn {
    height: 36px !important;
    padding: 0 16px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.2s ease !important;
}

.dm-filter-btn-search {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3) !important;
}

.dm-filter-btn-search:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4) !important;
    transform: translateY(-1px);
}

.dm-filter-btn-clear {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important;
}

.dm-filter-btn-clear:hover {
    border-color: #0ea5e9 !important;
    color: #0ea5e9 !important;
    background: #f0f9ff !important;
}

.dm-filter-btn-delete {
    background: rgba(239, 68, 68, 0.08) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    color: #dc2626 !important;
}

.dm-filter-btn-delete:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: white !important;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.3) !important;
}

/* ============ ACTIVE FILTER CHIPS ============ */
.patient-filter-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.patient-filter-chips-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-right: 2px;
}

.patient-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 20px;
    font-size: 12px;
    color: #0369a1;
    font-weight: 500;
    animation: chipIn 0.2s ease;
    transition: all 0.15s ease;
}

.patient-filter-chip svg {
    width: 13px;
    height: 13px;
    color: #0284c7;
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.patient-filter-chip-remove {
    cursor: pointer;
    opacity: 0.65;
    transition: all 0.15s ease;
    padding: 1px 4px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.patient-filter-chip-remove:hover {
    opacity: 1;
    background: rgba(2, 132, 199, 0.2);
    color: #0284c7;
}

.patient-filter-clear-all {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    margin-left: 4px;
}

.patient-filter-clear-all:hover {
    color: #ef4444;
    background: #fef2f2;
}

.patient-filter-chip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.patient-filter-chip-icon svg {
    width: 12px;
    height: 12px;
}

.patient-filter-chip-remove {
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.15s ease;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.patient-filter-chip-remove:hover {
    opacity: 1;
    background: rgba(14, 165, 233, 0.2);
}

/* ============ TABLE ============ */
.patient-table-wrapper {
    background: var(--medical-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--medical-border);
}

.patient-table .ant-table {
    background: var(--medical-surface) !important;
    font-size: 13px !important;
}

.patient-table .ant-table-thead > tr > th {
    background: #f8fafc !important;
    color: var(--medical-text) !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--medical-border) !important;
}

.patient-table .ant-table-thead > tr > th::before {
    display: none !important;
}

.patient-table .ant-table-tbody > tr > td {
    border-bottom: 1px solid var(--medical-border-light) !important;
    padding: 12px 14px !important;
    color: var(--medical-text) !important;
    vertical-align: middle !important;
    background: var(--medical-surface) !important;
    transition: background 0.15s ease;
}

.patient-table .ant-table-tbody > tr:hover > td {
    background: var(--medical-surface-hover) !important;
}

.patient-table .ant-table-tbody > tr:last-child > td {
    border-bottom: none !important;
}

/* Custom Medical Pagination Bar */
.custom-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: #ffffff;
    border: none;
    border-top: 1px solid var(--medical-border-light);
    border-radius: 0;
    font-size: 13px;
    color: #475569;
    box-shadow: none;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.pagination-info {
    font-weight: 500;
    color: #64748b;
}

.pagination-info strong {
    color: #0284c7;
    font-weight: 700;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease-in-out;
}

.pag-btn:hover:not(:disabled) {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.pag-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f1f5f9;
}

.pag-page-input {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 6px;
    font-weight: 600;
    color: #334155;
}

.pag-page-input input {
    width: 60px;
    height: 32px;
    text-align: center;
    padding: 0 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-weight: 700;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border 0.15s ease-in-out;
}

.pag-page-input input:focus {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.pagination-pagesize {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #64748b;
}

.pagination-pagesize select {
    height: 32px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    outline: none;
}

.pagination-pagesize select:focus {
    border-color: #0284c7;
}



/* Row hover actions */
.patient-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.patient-table tr:hover .patient-row-actions {
    opacity: 1;
}

/* Selection Column */
.patient-table .ant-table-selection-column,
.patient-table .ant-table-thead > tr > th.ant-table-selection-column,
.patient-table .ant-table-tbody > tr > td.ant-table-selection-column {
    width: 40px !important;
    min-width: 40px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

/* Summary bar */
.patient-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--medical-border);
}

.patient-summary-text {
    font-size: 12px;
    color: var(--medical-text-muted);
}

.patient-summary-count {
    font-weight: 600;
    color: var(--medical-primary);
}

/* Empty state */
.patient-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    background: var(--medical-surface);
}

.patient-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.patient-empty-icon svg {
    width: 32px;
    height: 32px;
    color: var(--medical-primary);
}

.patient-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--medical-text);
    margin-bottom: 4px;
}

.patient-empty-desc {
    font-size: 13px;
    color: var(--medical-text-muted);
    max-width: 300px;
}

/* ============ MODALS ============ */
.patient-modal-add .ant-modal,
.form-edit-modal .ant-modal {
    max-width: 920px !important;
    width: 920px !important;
    top: 24px !important;
}

@media (max-width: 960px) {
    .patient-modal-add .ant-modal,
    .form-edit-modal .ant-modal,
    .patient-modal-import .ant-modal {
        width: calc(100vw - 24px) !important;
        max-width: 100vw !important;
        margin: 12px auto !important;
        top: 12px !important;
    }

    .patient-modal-add .ant-modal-body,
    .form-edit-modal .ant-modal-body,
    .patient-modal-import .ant-modal-body {
        padding: 14px !important;
        max-height: calc(88vh - 110px) !important;
    }

    .patient-form-grid {
        grid-template-columns: 1fr !important;
    }

    .patient-section-card {
        padding: 12px 14px !important;
        margin-bottom: 12px !important;
    }
}

.patient-modal-add .ant-modal-content,
.form-edit-modal .ant-modal-content {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15) !important;
}

.patient-modal-add .ant-modal-header,
.form-edit-modal .ant-modal-header {
    flex-shrink: 0;
    padding: 16px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.patient-modal-add .ant-modal-title,
.form-edit-modal .ant-modal-title {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

.patient-modal-add .ant-modal-body,
.form-edit-modal .ant-modal-body {
    flex: 1 1 auto;
    overflow-y: auto !important;
    max-height: calc(88vh - 130px) !important;
    padding: 20px 24px !important;
    background: #f8fafc;
}

.patient-modal-add .ant-modal-footer,
.form-edit-modal .ant-modal-footer {
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 14px 24px !important;
}

/* Form Section Card Styling */
.patient-section-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.patient-section-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #0284c7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.patient-section-caption {
    font-size: 11.5px;
    font-weight: 400;
    color: #64748b;
    text-transform: none;
    letter-spacing: normal;
}

.patient-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 20px;
}

.patient-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.patient-field-full {
    grid-column: 1 / -1;
}

.patient-field-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
}

.patient-required {
    color: #ef4444;
    font-weight: bold;
}

.patient-radio-control {
    display: flex;
    align-items: center;
    height: 36px;
}

.patient-modal-import .ant-modal {
    max-width: 96vw;
    width: 700px !important;
}

.patient-modal-import .ant-modal-content {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
}

.patient-modal-import .ant-modal-body {
    flex: 1 1 auto;
    overflow-y: auto !important;
    max-height: calc(88vh - 120px) !important;
    padding: 18px 24px !important;
}

.patient-import-body {
    padding: 16px;
}

.patient-import-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.patient-import-item {
    flex: 1 1 200px;
    min-width: 180px;
    margin-bottom: 8px;
}

/* ============ CONTEXT MENU ============ */
.patient-context-menu {
    border-radius: var(--radius) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid var(--medical-border) !important;
    padding: 4px !important;
    background: var(--medical-surface);
    min-width: 180px;
    animation: contextMenuIn 0.15s ease;
}

@keyframes contextMenuIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    padding: 10px 14px !important;
    border-radius: var(--radius-sm) !important;
    font-size: 13px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s ease;
}

.context-menu-item:hover {
    background: var(--sidebar-hover) !important;
}

.context-menu-item svg {
    width: 16px;
    height: 16px;
    color: var(--medical-text-muted);
}

.context-menu-item:hover svg {
    color: var(--medical-primary);
}

.context-menu-divider {
    height: 1px;
    background: var(--medical-border);
    margin: 4px 0;
}

.context-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

.context-menu-item-danger svg {
    color: var(--medical-danger) !important;
}

.context-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

/* ============ TABLE STYLES ============ */
.patient-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.patient-badge-primary {
    background: rgba(14, 165, 233, 0.1);
    color: var(--medical-primary);
}

.patient-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--medical-success);
}

.patient-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--medical-warning);
}

.patient-badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--medical-danger);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .patient-filter-row {
        gap: 10px;
    }

    .patient-search-wrapper {
        flex: 1 1 100%;
    }

    .patient-filter-dropdown,
    .patient-filter-date {
        flex: 1 1 calc(50% - 10px);
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    .patient-filter-container {
        padding: 10px 12px;
        margin-bottom: 8px;
    }

    .patient-filter-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        padding-bottom: 6px;
    }

    .patient-filter-title {
        font-size: 12.5px;
    }

    .patient-filter-count {
        font-size: 11px;
        padding: 2px 8px;
    }

    .dm-filter-bar {
        gap: 8px;
    }

    .dm-filter-item {
        flex: 1 1 100%;
        width: 100%;
    }

    .dm-filter-search {
        flex: 1 1 100%;
    }

    .dm-filter-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .dm-filter-actions .ant-btn {
        width: 100%;
        justify-content: center;
    }

    .page-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .page-card-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .page-card-actions .btn-unify {
        width: 100% !important;
        justify-content: center !important;
        padding: 0 8px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        height: 38px !important;
        border-radius: 8px !important;
    }

    .patient-table-wrapper {
        border-radius: 8px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border: 1px solid var(--medical-border);
    }

    .patient-table {
        width: 100% !important;
    }

    .patient-table .ant-table-container,
    .patient-table .ant-table-content,
    .patient-table .ant-table-body {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .custom-pagination-bar {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 10px !important;
    }

    .pagination-info {
        font-size: 11.5px !important;
        text-align: center !important;
    }

    .pagination-controls {
        width: 100% !important;
        justify-content: center !important;
    }

    .pagination-pagesize {
        font-size: 11.5px !important;
    }
}

@media (max-width: 480px) {
    .page-card-actions {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .dm-filter-actions {
        grid-template-columns: 1fr !important;
    }

    .patient-modal-add .ant-modal {
        max-width: 100vw;
        margin: 0;
        top: 0 !important;
    }

    .patient-modal-add .ant-modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
}

/* ============ PATIENT IMAGE MANAGEMENT MODAL ============ */
.patient-modal-anh .ant-modal-content {
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

.patient-modal-anh .ant-modal-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 14px 20px;
}

.patient-modal-anh .ant-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.patient-anh-modal-body {
    padding: 16px 20px;
}

.patient-anh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.patient-anh-info {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.patient-anh-tag {
    font-size: 12px;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.patient-anh-tag strong {
    color: #0284c7;
}

.patient-anh-add-btn {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    height: 34px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    color: white !important;
}

/* Form Panel inside Modal */
.patient-anh-form-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
}

.form-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #0ea5e9;
    margin-bottom: 12px;
}

.form-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.form-panel-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-panel-field.full-width {
    grid-column: 1 / -1;
}

.form-panel-field label {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

.upload-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    background: #ffffff;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-input-control {
    font-size: 12px;
}

.form-panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.btn-cancel {
    height: 32px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
}

.btn-save {
    height: 32px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    border: none !important;
    color: white !important;
}

/* Image Cards Grid */
.patient-anh-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.anh-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.anh-card:hover {
    border-color: #0ea5e9;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
    transform: translateY(-2px);
}

.anh-card-media {
    position: relative;
    background: #f1f5f9;
    height: 140px;
    overflow: hidden;
}

.no-img-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
}

.anh-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.anh-card-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.anh-filename {
    font-size: 12.5px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anh-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #64748b;
}

.status-done {
    color: #10b981;
    font-weight: 600;
}

.status-pending {
    color: #f59e0b;
    font-weight: 600;
}

.anh-ghichu {
    font-size: 11.5px;
    color: #475569;
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anh-card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 6px;
}

.patient-anh-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.patient-anh-empty svg {
    width: 48px;
    height: 48px;
    color: #cbd5e1;
    margin-bottom: 8px;
}

/* Fix select popup dropdown width and option text overflow */
.ant-select-dropdown {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    max-width: 90vw !important;
}

.ant-select-dropdown .rc-virtual-list,
.ant-select-dropdown .rc-virtual-list-holder,
.ant-select-dropdown .rc-virtual-list-holder-inner,
.ant-select-dropdown .ant-select-item {
    width: 100% !important;
    box-sizing: border-box !important;
}

.ant-select-item-option-content {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.4 !important;
    font-size: 13px !important;
    width: 100% !important;
}


/* ==========================================================================
   MOBILE COMPANY SELECT & PICKER MODAL ENHANCEMENT
   ========================================================================== */
.dm-filter-company {
    position: relative;
}

.desktop-only-select {
    display: block;
    width: 100%;
}

.mobile-only-picker-btn {
    display: none;
    width: 100%;
    height: 38px;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 0 10px;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-only-picker-btn:active {
    background: #f8fafc;
    border-color: #0284c7;
}

.mobile-picker-content {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

.mobile-picker-text {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-picker-text.placeholder {
    color: #94a3b8;
}

.mobile-picker-text.selected {
    color: #0f172a;
    font-weight: 600;
}

.mobile-picker-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #64748b;
    background: #f1f5f9;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.mobile-picker-clear:active {
    background: #e2e8f0;
    color: #ef4444;
}

@media (max-width: 768px) {
    .desktop-only-select {
        display: none !important;
    }
    .mobile-only-picker-btn {
        display: flex !important;
    }
}

/* Company Picker Modal / Bottom Sheet Drawer */
.company-picker-modal-wrap .ant-modal-content {
    border-radius: 12px !important;
    overflow: hidden;
}

.company-picker-container {
    padding: 4px 0 8px 0;
}

.company-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #0284c7;
    border-radius: 8px;
    padding: 4px 10px;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
}

.company-search-icon {
    color: #0284c7;
    flex-shrink: 0;
}

.company-native-input {
    border: none;
    outline: none;
    font-size: 15px;
    width: 100%;
    height: 36px;
    color: #0f172a;
    background: transparent;
    -webkit-appearance: none;
}

.company-clear-search-btn {
    border: none;
    background: #e2e8f0;
    color: #475569;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.company-search-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px 6px 4px;
    font-size: 12.5px;
    color: #64748b;
}

.company-search-summary .btn-clear-selection {
    border: none;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.company-list-scroll {
    max-height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 2px 8px 2px;
    -webkit-overflow-scrolling: touch;
}

.company-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.company-picker-item:active {
    background: #f0f9ff;
    border-color: #0284c7;
    transform: scale(0.99);
}

.company-picker-item.active {
    background: #e0f2fe;
    border-color: #0284c7;
}

.company-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.company-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f0f9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0284c7;
    flex-shrink: 0;
}

.company-item-icon.all-icon {
    background: #f1f5f9;
    color: #475569;
}

.company-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow: hidden;
}

.company-item-name {
    font-size: 13.5px;
    color: #0f172a;
    font-weight: 500;
    line-height: 1.35;
    word-break: break-word;
}

.company-picker-item.active .company-item-name {
    font-weight: 700;
    color: #0369a1;
}

.company-item-code {
    font-size: 11.5px;
    color: #64748b;
}

.company-check-badge {
    color: #0284c7;
    margin-left: 8px;
    flex-shrink: 0;
}

.company-empty-state {
    text-align: center;
    padding: 30px 10px;
    color: #64748b;
}

.company-empty-state svg {
    margin-bottom: 8px;
}

/* ==========================================================================
   PDF VIEWER MODAL & CANVAS ENHANCEMENTS
   ========================================================================== */
.pdf-preview-modal-wrap .ant-modal {
    max-width: 1200px;
}

.pdf-modal-container {
    display: flex;
    flex-direction: column;
}

.pdf-top-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.pdf-status-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.pdf-badge-count {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 700;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
}

.pdf-badge-ready {
    background: #dcfce7;
    color: #15803d;
    font-weight: 600;
    font-size: 11.5px;
    padding: 2px 7px;
    border-radius: 4px;
}

.pdf-actions-buttons-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.pdf-actions-buttons-group .ant-btn {
    font-size: 12.5px;
    font-weight: 600;
    height: 34px;
    padding: 0 12px;
    border-radius: 6px;
}

.pdf-zoom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    background: #f8fafc;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.pdf-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pdf-zoom-btn:active {
    background: #f1f5f9;
    border-color: #0284c7;
    color: #0284c7;
}

.pdf-canvas-container {
    width: 100%;
    max-height: 72vh;
    min-height: 350px;
    overflow-y: auto;
    overflow-x: auto;
    background: #475569;
    padding: 16px 8px;
    border-radius: 8px;
    text-align: center;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .pdf-preview-modal-wrap .ant-modal {
        width: 98% !important;
        margin: 6px auto !important;
    }
    .pdf-top-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .pdf-actions-buttons-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .pdf-actions-buttons-group .ant-btn {
        width: 100%;
        justify-content: center;
        height: 38px;
    }
    .pdf-canvas-container {
        max-height: 65vh;
        padding: 10px 4px;
    }
}
