/* =====================================================================
 * Direktori Kakitangan — gaya laman awam
 * Ikon: SVG sebaris melalui CSS mask (ikut warna teks; tiada fon ikon tambahan).
 * ===================================================================== */

.rw-directory {
	--rw-border: #e3e6ea;
	--rw-muted: #6b7280;
	--rw-surface: #ffffff;
	--rw-soft: #f6f7f9;
	--rw-accent: #1a5fb4;
	--rw-accent-soft: #e8f0fb;
	--rw-radius: 12px;
}

/* Pembaca skrin sahaja */
.rw-directory .rw-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Ikon ---------- */
.rw-directory .rw-ico {
	display: inline-block; flex: none; width: 1.1em; height: 1.1em; vertical-align: -.18em;
	background-color: currentColor; opacity: 1;
	-webkit-mask: var(--rw-i) no-repeat center / contain; mask: var(--rw-i) no-repeat center / contain;
}
.rw-ico-org    { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Cpath d='M9 22v-4h6v4M8 6h.01M16 6h.01M12 6h.01M12 10h.01M12 14h.01M16 10h.01M16 14h.01M8 10h.01M8 14h.01'/%3E%3C/svg%3E"); }
.rw-ico-sub    { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4v7a4 4 0 0 0 4 4h12'/%3E%3Cpath d='m15 10 5 5-5 5'/%3E%3C/svg%3E"); }
.rw-ico-search { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.rw-ico-chev   { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E"); }
.rw-ico-back   { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M11 18l-6-6 6-6'/%3E%3C/svg%3E"); }
.rw-ico-pin    { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E"); }
.rw-ico-phone  { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2'/%3E%3C/svg%3E"); }
.rw-ico-fax    { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3h10v6M7 18H5a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2'/%3E%3Crect x='7' y='14' width='10' height='7' rx='1'/%3E%3C/svg%3E"); }
.rw-ico-mail   { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E"); }
.rw-ico-ext    { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6M11 13l9-9M15 4h5v5'/%3E%3C/svg%3E"); }

/* ---------- Bar carian ---------- */
.rw-directory .rw-search-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin: 0 0 20px; }
.rw-directory .rw-search-form select#searchOrg,
.rw-directory .rw-search-form input#searchStaff {
	width: 100% !important; height: 42px; margin: 0 !important; padding: 0 12px;
	border: 1px solid #cfd4da; border-radius: 8px; background: var(--rw-surface); font: inherit; font-size: .95em; color: inherit; box-sizing: border-box;
}
.rw-directory .rw-search-form select#searchOrg { flex: 1 1 100%; width: 100% !important; min-width: 0; } /* baris penuh: nama organisasi panjang kelihatan */
.rw-directory .rw-search-field { position: relative; flex: 1 1 240px; min-width: 0; }
.rw-directory .rw-search-field .rw-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--rw-muted); }
.rw-directory .rw-search-form input#searchStaff { padding-left: 38px; }
.rw-directory .rw-search-form select#searchOrg:focus,
.rw-directory .rw-search-form input#searchStaff:focus { outline: 2px solid var(--rw-accent); outline-offset: 1px; border-color: var(--rw-accent); }
.rw-directory .rw-search-form #search_division { height: 42px; padding: 0 24px; border-radius: 8px; flex: none; cursor: pointer; }

/* ---------- Breadcrumb ---------- */
.rw-directory .rw-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 8px; font-size: .88em; color: var(--rw-muted); }
.rw-directory .rw-crumbs a { color: inherit; text-decoration: none; }
.rw-directory .rw-crumbs a:hover { color: var(--rw-accent); text-decoration: underline; }
.rw-directory .rw-crumbs [aria-current] { color: inherit; font-weight: 600; opacity: .9; }
.rw-directory .rw-crumb-sep { width: .9em; height: .9em; opacity: .6; }

/* ---------- Kad organisasi ---------- */
.rw-directory .rw-card.detail_add {
	background: var(--rw-surface); border: 1px solid var(--rw-border); border-radius: var(--rw-radius);
	padding: 16px 20px; margin: 0 0 16px;
}
.rw-directory .rw-card-head { display: flex; align-items: center; gap: 12px; }
.rw-directory .rw-card-icon {
	width: 42px; height: 42px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center;
	background: var(--rw-accent-soft); color: var(--rw-accent); font-size: 1.15em;
}
.rw-directory .rw-card-icon .rw-ico { vertical-align: 0; }
.rw-directory .rw-card-title { margin: 0; font-size: 1.2em; line-height: 1.3; font-weight: 600; }
.rw-directory .rw-card-meta { margin: 2px 0 0; font-size: .88em; color: var(--rw-muted); }
.rw-directory .rw-card-contact {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 24px;
	margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rw-border); font-size: .95em; line-height: 1.5;
}
.rw-directory .rw-ci { display: flex; gap: 10px; align-items: flex-start; }
.rw-directory .rw-ci > .rw-ico { margin-top: .2em; color: var(--rw-muted); }
.rw-directory .rw-ci-pin { grid-column: 1 / -1; } /* alamat: satu baris penuh */
.rw-directory .rw-card-contact a { color: var(--rw-accent); text-decoration: none; }
.rw-directory .rw-card-contact a:hover { text-decoration: underline; }
.rw-directory .rw-map { font-size: .9em; display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.rw-directory .rw-map .rw-ico { width: .9em; height: .9em; }
.rw-directory .rw-units { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.rw-directory .rw-chip {
	display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--rw-border);
	border-radius: 999px; font-size: .85em; color: inherit; text-decoration: none; background: var(--rw-soft);
}
.rw-directory .rw-chip:hover { border-color: var(--rw-accent); color: var(--rw-accent); }
.rw-directory .rw-chip .rw-ico { width: .95em; height: .95em; opacity: .7; }

/* Tajuk kumpulan dalam hasil carian (tanpa maklumat hubungan) */
.rw-directory .detail_add:not(.rw-card) {
	background: var(--rw-soft); border: 1px solid var(--rw-border); border-radius: 10px; padding: 10px 16px; margin: 18px 0 8px;
}

/* ---------- Senarai kakitangan: kad (mod foto) ---------- */
.rw-directory .rw-people { background: var(--rw-surface); border: 1px solid var(--rw-border); border-radius: var(--rw-radius); overflow: hidden; margin: 0 0 16px; }
.rw-directory a.rw-person {
	display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: inherit; text-decoration: none;
	border-bottom: 1px solid var(--rw-border); transition: background-color .12s;
}
.rw-directory a.rw-person:last-child { border-bottom: 0; }
.rw-directory a.rw-person:hover, .rw-directory a.rw-person:focus-visible { background: var(--rw-soft); }
.rw-directory a.rw-person:focus-visible { outline: 2px solid var(--rw-accent); outline-offset: -2px; }
.rw-directory .rw-person-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rw-directory .rw-person-name { font-weight: 600; line-height: 1.35; }
.rw-directory .rw-person-title { font-size: .9em; color: var(--rw-muted); line-height: 1.4; }
.rw-directory a.rw-person > .rw-ico-chev { color: var(--rw-muted); opacity: .7; }
.rw-directory a.rw-person:hover > .rw-ico-chev { color: var(--rw-accent); opacity: 1; }

/* Avatar: foto atau inisial berwarna */
.rw-directory .rw-avatar {
	width: 44px; height: 44px; border-radius: 50%; flex: none; overflow: hidden;
	display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .9em; letter-spacing: .02em;
}
.rw-directory .rw-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rw-directory .rw-av-0 { background: #e3eefc; color: #0c447c; }
.rw-directory .rw-av-1 { background: #e1f5ee; color: #085041; }
.rw-directory .rw-av-2 { background: #faeeda; color: #633806; }
.rw-directory .rw-av-3 { background: #eeedfe; color: #3c3489; }
.rw-directory .rw-av-4 { background: #fbeaf0; color: #72243e; }
.rw-directory .rw-av-5 { background: #eaf3de; color: #27500a; }

/* ---------- Senarai kakitangan: jadual (mod senarai) ---------- */
.rw-directory table.rw-table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: .95em; }
.rw-directory table.rw-table thead th {
	text-align: left; font-size: .85em; font-weight: 600; color: var(--rw-muted); text-transform: none;
	padding: 10px 12px; border-bottom: 2px solid var(--rw-border); background: transparent;
}
.rw-directory table.rw-table td { padding: 10px 12px; border-bottom: 1px solid var(--rw-border); vertical-align: top; height: auto; }
.rw-directory table.rw-table tbody tr:hover td { background: var(--rw-soft); }
.rw-directory table.rw-table .rw-col-no { width: 3em; color: var(--rw-muted); }
.rw-directory table.rw-table td a { color: var(--rw-accent); text-decoration: none; }
.rw-directory table.rw-table td a:hover { text-decoration: underline; }

/* ---------- Pautan Kembali ---------- */
.rw-directory .rw-back-wrap { margin: 20px 0 0; }
.rw-directory a.rw-back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--rw-accent); text-decoration: none; font-weight: 500; }
.rw-directory a.rw-back-link:hover { text-decoration: underline; }

/* ---------- Pokok direktori ---------- */
.rw-directory #basic td { padding: 10px 8px; }
.rw-directory #basic tr:hover { background-color: var(--rw-soft); }
.rw-directory #basic a { color: inherit; }
.rw-directory #basic a:hover { color: var(--rw-accent); }

/* ---------- Telefon bimbit ---------- */
@media (max-width: 600px) {
	.rw-directory .rw-search-form #search_division { flex: 1 1 100%; }
	.rw-directory .rw-card.detail_add { padding: 14px 16px; }
	.rw-directory .rw-card-contact { grid-template-columns: 1fr; }
	.rw-directory a.rw-person { padding: 10px 12px; gap: 12px; }
	.rw-directory .rw-avatar { width: 40px; height: 40px; }
}

/* Organisasi tanpa kakitangan (cth. hanya ada unit): jangan papar kotak senarai kosong */
.rw-directory .rw-people:empty { display: none; }
.rw-directory table.rw-table:has(tbody:empty) { display: none; }

/* Avatar besar di halaman butiran (tiada foto) */
.rw-directory .rw-avatar.rw-avatar-lg { width: 200px; height: 200px; border-radius: 12px; font-size: 3.4em; font-weight: 600; letter-spacing: .04em; }
@media (max-width: 600px) { .rw-directory .rw-avatar.rw-avatar-lg { width: 150px; height: 150px; font-size: 2.6em; } }
/* Maklumat kakitangan di halaman butiran */
.rw-directory .rw-detail-info { border-collapse: collapse; }
.rw-directory .rw-detail-info th { color: var(--rw-muted); font-weight: 500; padding: 6px 16px 6px 0; }
.rw-directory .rw-detail-info td { padding: 6px 8px 6px 0; }
.rw-directory .rw-detail-info a { color: var(--rw-accent); text-decoration: none; }
.rw-directory .rw-detail-info a:hover { text-decoration: underline; }

/* Mod senarai: emel & telefon tidak dipecah; jadual boleh ditatal ke sisi di skrin sempit */
.rw-directory table.rw-table td:nth-child(4), .rw-directory table.rw-table td:nth-child(5) { white-space: nowrap; }
.rw-directory table.rw-table td:nth-child(2) { min-width: 12em; }

/* Petunjuk sedang memuat selepas organisasi dipilih */
.rw-directory .rw-search-form.rw-loading { opacity: .6; pointer-events: none; }

/* Emel: domain pada label; butang Salin */
.rw-directory .rw-email-domain { font-weight: 400; color: var(--rw-muted); font-size: .9em; white-space: nowrap; }
.rw-directory button.rw-copy {
	display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 10px; height: auto;
	font: inherit; font-size: .8em; line-height: 1.6; color: var(--rw-accent); background: var(--rw-accent-soft);
	border: 1px solid transparent; border-radius: 999px; cursor: pointer; vertical-align: middle;
}
.rw-directory button.rw-copy:hover { border-color: var(--rw-accent); }
.rw-directory button.rw-copy.is-done { color: #085041; background: #e1f5ee; }
.rw-directory button.rw-copy .rw-ico { width: .95em; height: .95em; }
.rw-ico-copy { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15V5a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E"); }

/* Foto lalai yang ditetapkan admin (cth. logo): muat penuh dalam bulatan, tidak dipotong */
.rw-directory .rw-avatar.rw-avatar-default { background: #fff; border: 1px solid var(--rw-border); }
.rw-directory .rw-avatar.rw-avatar-default img { object-fit: contain; padding: 3px; box-sizing: border-box; }
.rw-directory .rw-detail-photo.rw-detail-default { object-fit: contain; background: #fff; border: 1px solid var(--rw-border); padding: 8px; box-sizing: border-box; }

/* Butang Cetak / PDF */
.rw-ico-print { --rw-i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9V3h12v6'/%3E%3Crect x='3' y='9' width='18' height='8' rx='2'/%3E%3Cpath d='M6 14h12v7H6z'/%3E%3C/svg%3E"); }
.rw-directory .rw-print-row { display: flex; justify-content: flex-end; margin: 10px 0 8px; }
.rw-directory .rw-print-btn {
	display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: .9em;
	border: 1px solid var(--rw-border); border-radius: 6px; background: #fff; color: var(--rw-accent); text-decoration: none;
}
.rw-directory .rw-print-btn:hover { background: var(--rw-accent-soft); }
.rw-directory .rw-print-btn:focus-visible { outline: 2px solid var(--rw-accent); outline-offset: 2px; }
