/**
 * HRIS Hadir PJT 1 — Module Master Struktur Organisasi & Hierarchical Treeview
 * 100% Identical Table, Multi-Select Filter, Row Actions & Navigation Styling with Master Locations
 */

/* =========================================================================
   CLEAN MODERN UNDERLINE TAB NAVIGATION (100% Matching Locations Module)
   ========================================================================= */
.location-tabs-nav-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-bottom: 1px solid #E2E8F0 !important;
    display: flex !important;
    width: 100% !important;
    margin-bottom: 24px !important;
}

.custom-location-tabs {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    margin-bottom: -1px !important;
    padding: 0 !important;
    border: none !important;
}

.custom-location-tabs .nav-item {
    margin: 0 !important;
}

.custom-location-tabs .nav-link,
.custom-location-tabs .nav-link:focus,
.custom-location-tabs .nav-link:active,
.custom-location-tabs .nav-link.active,
.nav-pills.custom-location-tabs .nav-link.active,
.nav-pills .custom-location-tabs .nav-link.active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-bottom: 2.5px solid transparent !important;
    border-radius: 0 !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    position: relative !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
}

.custom-location-tabs .nav-link ion-icon {
    font-size: 18px !important;
    color: #64748B !important;
    transition: color 0.2s ease !important;
}

.custom-location-tabs .nav-link:hover {
    color: #1877F2 !important;
}

.custom-location-tabs .nav-link:hover ion-icon {
    color: #1877F2 !important;
}

.custom-location-tabs .nav-link.active,
.custom-location-tabs .nav-link.active:focus,
.custom-location-tabs .nav-link.active:hover {
    color: #1877F2 !important;
    font-weight: 700 !important;
    border-bottom: 2.5px solid #1877F2 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.custom-location-tabs .nav-link.active ion-icon {
    color: #1877F2 !important;
}

/* Quick Metrics */
.metrics-slider-container {
    margin-bottom: 24px;
}
.stat-card-hover {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.stat-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

/* Search input */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    font-size: 16px;
    color: #94a3b8;
    pointer-events: none;
}
.search-input-control {
    width: 100%;
    height: 38px;
    padding: 8px 36px 8px 36px;
    font-size: 12.5px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
}
.search-input-control:focus {
    background: #ffffff;
    border-color: #1877F2;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
    outline: none;
}
.search-clear-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

/* Table Toolbar Buttons */
.btn-toolbar-filter {
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 14px;
    border-color: #e2e8f0;
    color: #475569;
    background: #ffffff;
    transition: all 0.15s;
}
.btn-toolbar-filter:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}
.btn-toolbar-filter.has-active-filter {
    border-color: #1877F2 !important;
    background: #EFF6FF !important;
    color: #1877F2 !important;
}

/* =========================================================================
   COMPACT ACTIVE FILTER CHIPS (Inline, Subtle & Clean)
   ========================================================================= */
.active-filter-chip {
    background: #F0F7FF !important;
    border: 1px solid #D0E3FF !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    color: #1D4ED8 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    height: 28px !important;
}

.active-filter-chip strong {
    font-weight: 600 !important;
}

.active-filter-chip .chip-remove {
    cursor: pointer;
    color: #93C5FD;
    font-size: 14px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: color 0.15s ease;
}

.active-filter-chip .chip-remove:hover {
    color: #EF4444;
}

/* =========================================================================
   MULTI-SELECT CHIP STYLING FOR FILTER MODAL (Identical to Locations)
   ========================================================================= */
.btn-chip-select {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: #F8FAFC !important;
    color: #475569 !important;
    border: 1px solid #CBD5E1 !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
    user-select: none !important;
}

.btn-chip-select:hover {
    background: #F1F5F9 !important;
    color: #1E293B !important;
    border-color: #94A3B8 !important;
}

.btn-chip-select .chip-check-icon {
    display: none !important;
    font-size: 14px !important;
    margin: 0 !important;
}

.btn-check:checked + .btn-chip-select {
    background: #EFF6FF !important;
    color: #1D4ED8 !important;
    border-color: #3B82F6 !important;
    font-weight: 600 !important;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15) !important;
}

.btn-check:checked + .btn-chip-select .chip-check-icon {
    display: inline-flex !important;
}

/* Segmented Control in Modals */
.segmented-control-group {
    background: #F1F5F9 !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 8px !important;
    gap: 4px;
}

.btn-segmented {
    border: none !important;
    background: transparent !important;
    color: #64748B !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    transition: all 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
}

.btn-segmented:hover {
    color: #1E293B !important;
}

.btn-check:checked + .btn-segmented {
    background: #FFFFFF !important;
    color: #1D4ED8 !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.btn-check:checked + .btn-segmented.text-danger {
    color: #DC2626 !important;
}

.btn-check:checked + .btn-segmented.text-success {
    color: #059669 !important;
}

/* =========================================================================
   ENTERPRISE DATA TABLE (100% Matching Locations Table)
   ========================================================================= */
.location-data-table th {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 12px 14px;
    border-bottom: 1.5px solid #e2e8f0;
}
.location-data-table td {
    padding: 13px 14px;
    font-size: 13px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}
.location-data-table tr:hover td {
    background-color: #f8fafc;
}
.location-data-table th.sortable {
    cursor: pointer;
    user-select: none;
}
.location-data-table th.sortable:hover {
    color: #1877F2;
}
.sort-icon {
    font-size: 13px;
    vertical-align: -1.5px;
    margin-left: 3px;
    color: #94a3b8;
}
th.sortable:hover .sort-icon {
    color: #1877F2;
}

/* Hover Primary text link */
.hover-primary {
    transition: color 0.15s ease;
}
.hover-primary:hover {
    color: #1877F2 !important;
}

/* =========================================================================
   STANDARDIZED INLINE ROW ACTION BUTTONS & GROUP (8px Spacing Standard)
   ========================================================================= */
.btn-row-action-group {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important; /* Standarisasi Jarak Rapi 8px */
    justify-content: flex-end !important;
}

.btn-row-action {
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 7px !important;
    font-size: 15px !important;
    border: 1px solid #E2E8F0 !important;
    background: #ffffff !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: #475569 !important;
    flex-shrink: 0 !important;
}
.btn-row-action:hover {
    background: #F1F5F9 !important;
    border-color: #CBD5E1 !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08) !important;
}

/* Status Badges */
.badge-status-active {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 2.5px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
}
.badge-status-inactive {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 2.5px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-group-pill {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

/* =========================================================================
   FLOATING BULK ACTION BAR (Identical to Locations)
   ========================================================================= */
.bulk-action-floating-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    background: #ffffff;
    border: 1.5px solid #1877F2;
    border-radius: 14px;
    padding: 4px 8px;
    box-shadow: 0 10px 30px rgba(24, 119, 242, 0.2) !important;
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
    from { transform: translate(-50%, 40px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Mobile Card Item */
.mobile-card-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    transition: all 0.15s ease;
}
.mobile-card-item:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

/* =========================================================================
   HIERARCHICAL TREEVIEW LIST (Exact Screenshot Match)
   ========================================================================= */
.org-tree-list-container {
    min-height: 480px;
    max-height: 720px;
    overflow-y: auto;
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tree-item-group {
    position: relative;
}

/* Each Tree Row */
.tree-row {
    padding: 7px 10px 7px 0;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
    margin-bottom: 2px;
    min-height: 38px;
}

.tree-row:hover {
    background-color: #f1f5f9;
}

.tree-row.selected {
    background-color: #e0f2fe !important;
}

.tree-row.highlight-match {
    background-color: #fef08a !important;
    animation: matchPulse 1.5s infinite;
}

@keyframes matchPulse {
    0% { background-color: #fef08a; }
    50% { background-color: #fde047; }
    100% { background-color: #fef08a; }
}

/* Caret Button (▾ / ▸) */
.tree-caret-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #1e293b;
    transition: transform 0.15s ease;
    margin-right: 4px;
    flex-shrink: 0;
}

.tree-caret-btn.empty {
    visibility: hidden;
    cursor: default;
}

.tree-caret-btn:hover:not(.empty) {
    color: #1877F2;
    transform: scale(1.15);
}

/* Yellow/Gold Folder Outline Icon */
.tree-folder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 17px;
    color: #eab308; /* Golden Yellow */
    margin-right: 8px;
    flex-shrink: 0;
}

/* Organization Title */
.tree-node-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

/* Status Badge: Soft Green Pill */
.tree-status-badge {
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    flex-shrink: 0;
}

.tree-status-badge.active {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.tree-status-badge.inactive {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Level indicator pill (optional subtle tag) */
.tree-level-tag {
    font-size: 10px;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

/* Children Wrapper */
.tree-children-wrapper {
    transition: all 0.2s ease;
}

.tree-children-wrapper.collapsed {
    display: none;
}

/* Hover Action Buttons */
.tree-row-actions {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tree-row:hover .tree-row-actions {
    opacity: 1;
}

/* Custom form inputs */
.custom-input {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 13px;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.15s;
}
.custom-input:focus {
    background: #ffffff;
    border-color: #1877F2;
    box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
    outline: none;
}

/* =========================================================================
   EXPORT TOOLS GROUP (Print, CSV, Excel - Solid White Background Standard)
   ========================================================================= */
.export-btn-group {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    margin-right: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    display: inline-flex !important;
    align-items: center !important;
}

.btn-export-tool {
    background: #FFFFFF !important;
    background-color: #FFFFFF !important;
    border: none !important;
    border-right: 1px solid #E2E8F0 !important;
    border-radius: 0 !important;
    padding: 8px 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    transition: all 0.15s ease !important;
    cursor: pointer !important;
    line-height: 1 !important;
}

.btn-export-tool:last-child {
    border-right: none !important;
}

.btn-export-tool:hover {
    background: #F8FAFC !important;
    background-color: #F8FAFC !important;
    color: #1877F2 !important;
}

.btn-export-tool:active {
    background: #EFF6FF !important;
    background-color: #EFF6FF !important;
}

.btn-export-tool .export-icon {
    font-size: 16px !important;
    margin: 0 !important;
}

.btn-export-tool .export-btn-label {
    font-size: 12.5px !important;
    font-weight: 600 !important;
}
/* =========================================================================
   STANDARDIZED RESPONSIVE TABLE (Applied to all enterprise data tables)
   ========================================================================= */

/* Force table to not break layout on smaller screens */
.location-data-table {
    table-layout: auto !important;
    width: 100% !important;
    min-width: 900px !important; /* Ensures horizontal scroll on narrow viewports */
}

/* Prevent text wrapping in key columns */
.location-data-table td,
.location-data-table th {
    white-space: nowrap !important;
}

/* Allow wrapping only in name/description columns that need it */
.location-data-table td.cell-wrap,
.location-data-table th.cell-wrap {
    white-space: normal !important;
    min-width: 200px;
}

/* Ensure table-responsive container works correctly */
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Subtle scrollbar for the table container */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}