/* ===========================================
   REFERENCES GENERAL CSS - COMMON STYLES
   Shared styles untuk semua references list
   Bootstrap 4 Compatible
   =========================================== */

/* ===========================================
   CSS VARIABLES & ROOT STYLES
   =========================================== */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --secondary-color: #6c757d;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    
    --border-radius: 0.375rem;
    --border-radius-lg: 0.5rem;
    --border-radius-xl: 1rem;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 3rem;
}

/* Light mode support - Force light theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Override dark mode - Force light theme */
[data-theme="dark"] {
    --bg-primary: #ffffff !important;
    --bg-secondary: #f8f9fa !important;
    --text-primary: #212529 !important;
    --text-secondary: #6c757d !important;
    --border-color: #dee2e6 !important;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    --shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ===========================================
   GLOBAL STYLES
   =========================================== */
.references-wrapper,
.references-dashboard,
.admin-forms {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
    padding: var(--spacing-md);
}

/* ===========================================
   PAGE HEADER STYLES
   =========================================== */
.page-header {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.page-header h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
    font-size: var(--font-size-xl);
}

/* ===========================================
   FILTER CARD STYLES
   =========================================== */
.filter-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
}

.filter-card .card-body {
    padding: var(--spacing-md);
}

.filter-card .form-control {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.filter-card .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ===========================================
   CARD STYLES
   =========================================== */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    font-family: var(--font-family);
    margin-bottom: var(--spacing-lg);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: var(--spacing-lg);
}

.card-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--font-size-lg);
    margin: 0;
}

.card-body {
    padding: var(--spacing-lg);
    color: var(--text-primary);
}

/* ===========================================
   BUTTON STYLES
   =========================================== */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: var(--font-size-sm);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn i {
    margin-right: var(--spacing-xs);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-lg);
}

/* Button variants */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, var(--primary-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #1e7e34, var(--success-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800);
    border-color: var(--warning-color);
    color: #212529;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800, var(--warning-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    border-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, var(--danger-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-outline-secondary {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* ===========================================
   TABLE STYLES
   =========================================== */
.table {
    margin-bottom: 0;
    color: var(--text-primary);
    font-family: var(--font-family);
}

.table thead th {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--font-size-sm);
    padding: 0.6rem 0.4rem;
    vertical-align: middle;
    border-top: none;
}

.table tbody td {
    padding: 0.5rem 0.4rem;
    vertical-align: middle;
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table-responsive {
    border-radius: var(--border-radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

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

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

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

/* ===========================================
   BADGE STYLES
   =========================================== */
.badge {
    font-size: var(--font-size-sm);
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    box-shadow: none;
}

.badge-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    box-shadow: none;
}

.badge-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, var(--success-color), #1e7e34);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, var(--warning-color), #e0a800);
    color: #212529;
}

.badge-danger {
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, var(--info-color), #138496);
    color: white;
}

.badge-secondary {
    background: linear-gradient(135deg, var(--secondary-color), #545b62);
    color: white;
}

.badge-light {
    background: #f8f9fa;
    color: #212529 !important;
    border: 1px solid #dee2e6;
}

/* Badge untuk nomor urut - spacing lebih baik untuk ribuan */
td .badge-light {
    font-family: 'Roboto Mono', 'Courier New', monospace;
    letter-spacing: 0.5px;
    min-width: 45px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 0.65rem;
}

/* ===========================================
   PENDUDUK PHOTO & AVATAR STYLES
   =========================================== */
.penduduk-photo,
.beneficiary-photo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
    margin: 0 auto;
}

.penduduk-photo:hover,
.beneficiary-photo img:hover {
    transform: scale(1.1);
    border-color: #007bff;
}

.penduduk-photo-placeholder,
.beneficiary-photo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.penduduk-photo-placeholder:hover,
.beneficiary-photo-placeholder:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.penduduk-photo-placeholder i,
.beneficiary-photo-placeholder i {
    color: #6c757d;
    font-size: 1.2rem;
}

/* Beneficiary photo container */
.beneficiary-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

/* Card View Photos */
.card-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
    margin: 0 auto;
}

.card-photo:hover {
    transform: scale(1.05);
    border-color: #007bff;
}

.card-photo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #f8f9fa;
    border: 3px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.card-photo-placeholder:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.card-photo-placeholder i {
    color: #6c757d;
    font-size: 2rem;
}

/* ===========================================
   PAGINATION STYLES
   =========================================== */
.pagination {
    margin: var(--spacing-lg) 0;
}

.page-link {
    color: var(--primary-color);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
    border-radius: var(--border-radius);
    margin: 0 2px;
    transition: all 0.3s ease;
}

.page-link:hover {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ===========================================
   MODAL STYLES
   =========================================== */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    background: var(--bg-primary);
}

.modal-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: var(--spacing-lg);
}

.modal-title {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: var(--spacing-lg);
    color: var(--text-primary);
}

.modal-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    padding: var(--spacing-lg);
}

/* Delete Modal - Force Small Size */
#deleteModal .modal-dialog {
    max-width: 350px !important;
}

#deleteModal .modal-sm {
    max-width: 350px !important;
}

#deleteModal .modal-content {
    border-radius: 8px;
}

#deleteModal .modal-header {
    padding: 0.75rem 1rem !important;
}

#deleteModal .modal-body {
    padding: 1.5rem 1rem !important;
}

#deleteModal .modal-footer {
    padding: 0.75rem 1rem !important;
    border-top: 1px solid #dee2e6;
}

#deleteModal h6 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

#deleteModal small {
    font-size: 0.8rem;
}

#deleteModal .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ===========================================
   BULK ACTIONS INLINE BUTTONS
   =========================================== */
.bulk-actions-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.bulk-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.5rem;
    background: #007bff;
    color: white;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 600;
}

.bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    background: white;
    color: #6c757d;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.bulk-btn i {
    font-size: 0.85rem;
}

.bulk-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.bulk-btn:not(.disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bulk-btn-activate:not(.disabled) {
    border-color: #28a745;
    color: #28a745;
}

.bulk-btn-activate:not(.disabled):hover {
    background: #28a745;
    color: white;
}

.bulk-btn-deactivate:not(.disabled) {
    border-color: #ffc107;
    color: #ffc107;
}

.bulk-btn-deactivate:not(.disabled):hover {
    background: #ffc107;
    color: white;
}

.bulk-btn-delete:not(.disabled) {
    border-color: #dc3545;
    color: #dc3545;
}

.bulk-btn-delete:not(.disabled):hover {
    background: #dc3545;
    color: white;
}

/* ===========================================
   HEADER BUTTONS
   =========================================== */
.header-buttons-wrapper {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
}

.btn-header-action {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-header-action i {
    font-size: 0.875rem;
}

/* Export Dropdown Menu Styles */
.export-dropdown-menu {
    min-width: 200px;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
}

.export-dropdown-menu .dropdown-header {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
}

.export-dropdown-menu .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.export-dropdown-menu .dropdown-item:hover {
    background-color: var(--bg-secondary);
    padding-left: 1.25rem;
}

.export-dropdown-menu .dropdown-item i {
    width: 20px;
    font-size: 1rem;
}

.export-dropdown-menu .dropdown-item small {
    font-size: 0.75rem;
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.min-w-0 {
    min-width: 0;
}

.fw-bold {
    font-weight: 600;
}

/* ===========================================
   MOBILE RESPONSIVE (max-width: 575.98px)
   =========================================== */
@media (max-width: 575.98px) {
    /* Page spacing */
    .references-wrapper,
    .references-dashboard,
    .admin-forms {
        padding: var(--spacing-sm);
    }
    
    .page-header {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }
    
    .page-header h4 {
        font-size: var(--font-size-lg);
    }
    
    /* Remove shadows on mobile */
    .card,
    .card.shadow,
    .filter-card {
        box-shadow: none !important;
        border: 1px solid var(--border-color);
    }
    
    /* Card compact - more padding for mobile */
    .card-header {
        padding: 0.75rem 1rem !important;
    }
    
    .card-header h6 {
        font-size: 0.85rem !important;
        margin: 0 !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-footer {
        padding: 0.75rem 1rem !important;
    }
    
    /* Header buttons mobile - fixed size */
    .header-buttons-wrapper {
        gap: 0.4rem;
        flex-wrap: nowrap;
        width: 100%;
        justify-content: flex-end;
    }
    
    .btn-header-action {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
        flex: 0 0 auto !important;  /* Don't grow, auto width */
        min-width: auto !important;
        white-space: nowrap;
    }
    
    .btn-header-action i {
        font-size: 0.8rem;
        margin-right: 0.3rem !important;
    }
    
    .btn-header-action span {
        display: inline !important;
    }
    
    /* Dropdown mobile */
    .export-dropdown-menu {
        min-width: 180px !important;
        font-size: 0.8rem;
    }
    
    /* Modal mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header {
        padding: 0.75rem;
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    /* Delete Modal mobile */
    #deleteModal .modal-dialog {
        max-width: 90% !important;
        margin: 0.5rem auto;
    }
    
    #deleteModal .modal-body {
        padding: 1rem !important;
    }
    
    #deleteModal .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
    /* Table mobile - More spacing */
    .table {
        font-size: 0.8rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.6rem 0.4rem !important;
        font-size: 0.75rem;
    }
    
    /* Nama dusun mobile - compact */
    .td-name strong {
        font-size: 0.8rem !important;
        line-height: 1.1 !important;
        margin-bottom: 0.1rem !important;
    }
    
    .td-name small {
        font-size: 0.65rem !important;
        line-height: 1 !important;
        margin-top: 0.1rem !important;
    }
    
    /* First column (checkbox) */
    .table td:first-child,
    .table th:first-child {
        padding: 0.6rem 0.3rem !important;
    }
    
    /* Action column - more spacing */
    .table td:last-child,
    .table th:last-child {
        padding: 0.6rem 0.5rem !important;
    }
    
    /* Button groups mobile - more spacing */
    .table .btn-group {
        gap: 0.3rem;
        display: inline-flex !important;
    }
    
    .table .btn-group .btn {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.8rem !important;
        margin: 0 !important;
    }
    
    .table .btn-group .btn i {
        font-size: 0.85rem !important;
    }
    
    /* Badge mobile - bigger */
    .badge-sm {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Penduduk photo mobile - smaller */
    .penduduk-photo,
    .penduduk-photo-placeholder {
        width: 32px;
        height: 32px;
    }
    
    .penduduk-photo-placeholder i {
        font-size: 1rem;
    }
    
    /* Badge light mobile */
    .badge-light {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
    
    /* Badge nomor mobile - tetap readable */
    td .badge-light {
        font-size: 0.75rem;
        letter-spacing: 0.3px;
        min-width: 40px;
        padding: 0.3rem 0.5rem;
    }
    
    /* Row spacing mobile */
    .table tbody tr {
        height: auto;
        min-height: 45px;
    }
    
    /* Bulk actions mobile - more spacing */
    .bulk-actions-inline {
        gap: 0.5rem !important;
    }
    
    .bulk-count-badge {
        min-width: 24px !important;
        height: 24px !important;
        padding: 0 0.4rem !important;
        font-size: 0.7rem !important;
    }
    
    .bulk-btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.75rem !important;
        border-radius: 0.3rem;
    }
    
    .bulk-btn i {
        font-size: 0.8rem !important;
        margin-right: 0.2rem !important;
    }
    
    .bulk-btn-text {
        display: inline !important;
    }
    
    /* Pagination mobile */
    .pagination {
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .page-link {
        padding: 0.25rem 0.4rem !important;
        font-size: 0.7rem !important;
        margin: 0 1px !important;
    }
    
    /* Filter card mobile */
    .filter-card {
        margin-bottom: 0.75rem !important;
    }
    
    .filter-card .card-body {
        padding: 0.75rem !important;
    }
    
    .filter-card .form-control {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    .filter-card .form-label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    /* Page header mobile - more compact */
    .row.mb-4 {
        margin-bottom: 0.75rem !important;
    }
    
    .h3.mb-1 {
        font-size: 1.1rem !important;
        margin-bottom: 0.25rem !important;
        line-height: 1.3 !important;
    }
    
    .text-muted.small {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
    }
    
    /* Page header wrapper mobile */
    .d-flex.flex-column.flex-md-row {
        gap: 0.5rem;
    }
    
    .d-flex.flex-column.flex-md-row > div:first-child {
        flex: 1;
    }
}

/* ===========================================
   TABLET (576px - 767.98px)
   =========================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .btn-header-action {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    
    .table {
        font-size: 0.85rem;
    }
}

/* ===========================================
   DUSUN TABLE SPECIFIC STYLES
   =========================================== */
/* Nama Dusun column - compact layout */
.td-name {
    vertical-align: middle !important;
}

.td-name .text-truncate {
    line-height: 1.2 !important;
    margin-bottom: 0.1rem !important;
}

.td-name strong {
    font-size: 0.9rem;
    line-height: 1.2;
}

.td-name small.text-muted {
    font-size: 0.7rem !important;
    line-height: 1;
    display: block;
    margin-top: 0.1rem;
    color: #6c757d !important;
}

/* Jumlah RW and Penduduk columns */
.table th[width="95"],
.table th[width="100"] {
    text-align: center !important;
    padding: 0.5rem 0.75rem !important;
}

/* Badge styling for Jumlah RW and Penduduk */
.badge-info,
.badge-success {
    min-width: 45px;
    display: inline-block;
    text-align: center;
    font-weight: 600;
}

/* ===========================================
   LORONG TABLE SPECIFIC STYLES
   =========================================== */
.text-truncate-dusun {
    display: inline-block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.text-truncate-dusun .badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

/* ===========================================
   PENDUDUK TABLE SPECIFIC STYLES
   =========================================== */
.table .text-center.text-muted.small {
    color: #212529 !important;
    font-weight: 500;
}

.table td.text-center {
    padding: 0.5rem 0.25rem !important;
}

/* Compact table columns - Force override */
.table th,
.table td {
    padding: 0.5rem 0.4rem !important;
}

/* Extra compact for checkbox, no, and photo columns */
.table th[width="40"],
.table th[width="50"],
.table td:first-child,
.table td:nth-child(2),
.table td:nth-child(3) {
    padding: 0.4rem 0.2rem !important;
    text-align: center !important;
}

/* Name column - more compact */
.table .td-name {
    padding: 0.4rem 0.5rem !important;
    line-height: 1.3 !important;
}

.table .td-name strong {
    display: block;
    line-height: 1.2;
    margin-bottom: 0.1rem;
}

.table .td-name small {
    display: block;
    line-height: 1;
    font-size: 0.75rem !important;
    margin-top: 0.15rem;
}

/* NIK, KK, Dusun columns - compact */
.table .td-nik,
.table .td-kk,
.table .td-dusun {
    padding: 0.4rem 0.3rem !important;
}

/* Action column - compact */
.table td:last-child {
    padding: 0.4rem 0.3rem !important;
    text-align: center !important;
}

/* Name column text */
.td-name,
.beneficiary-name {
    color: #212529 !important;
    font-weight: 600 !important;
}

.td-nik,
.td-kk,
.td-dusun {
    color: #495057 !important;
    font-size: 0.85rem;
}

/* Text truncate for dusun */
.text-truncate-dusun {
    display: inline-block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Force table layout fixed for consistent column width */
.data-card .table {
    table-layout: fixed !important;
    width: 100% !important;
}

/* Force specific column widths */
.data-card .table th[width],
.data-card .table td {
    white-space: nowrap;
}

.data-card .table th[width="35"],
.data-card .table td:nth-child(1) {
    width: 35px !important;
    max-width: 35px !important;
}

.data-card .table th[width="40"],
.data-card .table td:nth-child(2) {
    width: 40px !important;
    max-width: 40px !important;
}

.data-card .table th[width="50"],
.data-card .table td:nth-child(3) {
    width: 50px !important;
    max-width: 50px !important;
}

.data-card .table th[width="65"],
.data-card .table td:nth-child(8) {
    width: 65px !important;
    max-width: 65px !important;
}

.data-card .table th[width="75"],
.data-card .table td:nth-child(9) {
    width: 75px !important;
    max-width: 75px !important;
}

.data-card .table th[width="105"],
.data-card .table td:nth-child(10) {
    width: 105px !important;
    max-width: 105px !important;
}

.data-card .table .td-name {
    white-space: normal !important;
    word-wrap: break-word;
    max-width: 200px;
}

/* Dusun specific columns */
.data-card .table th[width="75"],
.data-card .table td:nth-child(5),
.data-card .table th[width="85"],
.data-card .table td:nth-child(6) {
    width: auto !important;
    max-width: 85px !important;
    text-align: center !important;
}

/* Force center alignment for badge columns */
.data-card .table td.text-center {
    text-align: center !important;
    vertical-align: middle !important;
}

/* Kepala Dusun column truncate */
.td-kepala-dusun {
    max-width: 150px !important;
}

.td-kepala-dusun .text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===========================================
   DESKTOP (min-width: 768px and up)
   =========================================== */
@media (min-width: 768px) {
    /* Desktop action buttons - compact and professional */
    .table .btn-group .btn,
    .table .btn-group-sm .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.875rem !important;
        margin: 0 0.1rem;
    }
    
    .table .btn-group .btn i,
    .table .btn-group-sm .btn i {
        font-size: 0.875rem;
        margin: 0;
    }
    
    /* Action column proper width on desktop */
    .td-action,
    th:last-child {
        width: auto;
        min-width: 110px;
    }
    
    /* Compact table spacing on desktop - very tight */
    .table th,
    .table td {
        padding: 0.4rem 0.3rem !important;
    }
    
    /* Extra compact for checkbox and no columns */
    .table th[width="40"],
    .table th[width="50"],
    .table td:first-child,
    .table td:nth-child(2),
    .table td:nth-child(3) {
        padding: 0.4rem 0.2rem !important;
        text-align: center !important;
    }
    
    /* Compact action buttons */
    .table .btn-group {
        gap: 0.15rem;
        display: inline-flex;
        flex-wrap: nowrap;
    }
    
    .table .btn-group .btn,
    .table .btn-group-sm .btn {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.85rem !important;
        margin: 0 !important;
        white-space: nowrap;
    }
    
    .table .btn-group .btn i {
        font-size: 0.85rem;
        margin: 0;
    }
    
    /* Tighter NIK and KK display */
    .table .td-nik,
    .table .td-kk {
        font-size: 0.8rem !important;
    }
    
    /* Force table width control */
    .table-responsive {
        overflow-x: auto;
    }
}

/* ===========================================
   DESKTOP (min-width: 992px)
   =========================================== */
@media (min-width: 992px) {
    .bulk-btn-text {
        display: inline !important;
    }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===========================================
   END OF GENERAL CSS
   =========================================== */

