/* =============================================================================
   IzeChat — Call Records.
   -----------------------------------------------------------------------------
   Everything is namespaced under .ize-cl (root) / .ize-cls (the bottom sheet and
   snackbar, which portal to <body> and therefore cannot live inside .ize-cl).
   Nothing here can reach another page.

   WHY A NEW NAMESPACE RATHER THAN EDITING THE OLD `.ize-call-*` RULES
   The previous list still exists in stylesheet/style.css. Reusing its class
   names would have meant fighting its specificity from a file that loads
   earlier, on every single rule. A clean namespace means the old block is
   simply unused by this page and no override is needed anywhere.

   DARK MODE: WoWonder signals dark by injecting <link id="night-mode-css"> and
   IzeChat additionally stamps body.dark_active from $wo['dark_active'] (see
   container.phtml). All four selectors are listed because :has() is unavailable
   on older Android WebViews and body.dark is the legacy class some surfaces
   still use.

   BRAND: --main / --main-rgb come from layout/style.phtml (admin-configurable),
   with the IzeChat blue as the fallback so this file is still correct if the
   page is ever rendered without that block.
   ========================================================================== */

.ize-cl {
	--cl-card:    #ffffff;
	--cl-line:    #ececec;
	--cl-text:    #16181c;
	--cl-muted:   #6b7280;
	--cl-soft:    #f4f5f7;
	--cl-softer:  #fafbfc;
	--cl-brand:   var(--main, #2d6cff);
	--cl-brandbg: rgba(var(--main-rgb, 45, 108, 255), .12);
	--cl-ok:      #0f9d6f;
	--cl-okbg:    #e6f6ee;
	--cl-danger:  #e02b3f;
	--cl-dangerbg:rgba(224, 43, 63, .10);
	--cl-in:      #3897f0;
	--cl-shadow:  0 1px 2px rgba(16, 24, 40, .05);

	color: var(--cl-text);
	/* Clear the bottom navigation bar AND, inside the Android shell, the system
	   navigation bar underneath it (--ize-safe-bottom is injected natively). */
	padding-bottom: calc(24px + var(--ize-safe-bottom, 0px));
}

html:has(#night-mode-css) .ize-cl,
html.ize-dark .ize-cl,
body.dark_active .ize-cl,
body.dark .ize-cl {
	--cl-card:    #1c2126;
	--cl-line:    rgba(255, 255, 255, .085);
	--cl-text:    #e9edf1;
	--cl-muted:   #93a1ad;
	--cl-soft:    #232a31;
	--cl-softer:  #1f252b;
	--cl-ok:      #5fd18d;
	--cl-okbg:    #1f3a29;
	--cl-danger:  #ff6b7d;
	--cl-dangerbg:rgba(255, 107, 125, .14);
	--cl-in:      #64b5f6;
	--cl-shadow:  0 1px 2px rgba(0, 0, 0, .3);
}

/* =============================================================================
   HEADER
   ========================================================================== */
.ize-cl-head {
	display: flex; align-items: center; gap: 8px;
	padding: 2px 0 12px;
}
.ize-cl-titles { flex: 1 1 auto; min-width: 0; }
.ize-cl-title {
	margin: 0; font-size: 26px; font-weight: 800;
	letter-spacing: -.02em; line-height: 1.15; color: var(--cl-text);
}
.ize-cl-sub {
	margin: 2px 0 0; font-size: 12.5px; color: var(--cl-muted);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ize-cl-headbtns { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }

.ize-cl-iconbtn {
	-webkit-appearance: none; appearance: none;
	width: 38px; height: 38px; flex: 0 0 auto;
	border: 0; border-radius: 50%; padding: 0;
	background: var(--cl-soft); color: var(--cl-text);
	display: inline-flex; align-items: center; justify-content: center;
	cursor: pointer; transition: transform .12s ease, background .15s ease;
}
.ize-cl-iconbtn:hover  { background: var(--cl-line); }
.ize-cl-iconbtn:active { transform: scale(.92); }
.ize-cl-iconbtn:focus-visible { outline: 2px solid var(--cl-brand); outline-offset: 2px; }
.ize-cl-iconbtn.is-on { background: var(--cl-brandbg); color: var(--cl-brand); }

/* The [hidden] attribute is only a UA rule of `display:none`, so ANY explicit
   display on the element wins over it. Every flex/inline-flex control in this
   file therefore restates it, or hiding one would silently do nothing. */
.ize-cl [hidden],
.ize-cls [hidden] { display: none !important; }

/* Recordings keeps its label where there is room; the icon alone is enough on a
   phone, where three labelled buttons would wrap the title. */
.ize-cl-reclabel { display: none; }
@media (min-width: 560px) {
	.ize-cl-rec { width: auto; border-radius: 19px; padding: 0 14px; gap: 7px; }
	.ize-cl-reclabel { display: inline; font-size: 13.5px; font-weight: 600; }
}

/* =============================================================================
   SEARCH
   Collapsed to zero height rather than display:none so opening it animates and
   the input can be focused in the same frame it becomes visible.
   ========================================================================== */
.ize-cl-searchwrap {
	max-height: 0; overflow: hidden; opacity: 0;
	transition: max-height .22s ease, opacity .18s ease, margin .22s ease;
	margin: 0;
}
.ize-cl-searchwrap.is-open { max-height: 60px; opacity: 1; margin: 0 0 12px; }
.ize-cl-searchbox { position: relative; }
.ize-cl-input {
	width: 100%; height: 42px; padding: 0 38px 0 38px;
	border: 1px solid var(--cl-line); border-radius: 21px;
	background: var(--cl-soft); color: var(--cl-text);
	font-size: 15px; outline: none;
}
.ize-cl-input:focus { border-color: var(--cl-brand); }
.ize-cl-searchic {
	position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
	color: var(--cl-muted); pointer-events: none; display: inline-flex;
}
.ize-cl-searchclear {
	position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
	width: 28px; height: 28px; border: 0; border-radius: 50%; padding: 0;
	background: transparent; color: var(--cl-muted);
	display: none; align-items: center; justify-content: center; cursor: pointer;
}
.ize-cl-searchclear.is-on { display: inline-flex; }

/* =============================================================================
   FAVOURITES STRIP
   ========================================================================== */
.ize-cl-favs { margin: 0 0 14px; }
.ize-cl-favs[hidden] { display: none; }
.ize-cl-favs-h {
	display: flex; align-items: center; gap: 6px;
	font-size: 12px; font-weight: 700; letter-spacing: .06em;
	text-transform: uppercase; color: var(--cl-muted); margin: 0 0 8px;
}
.ize-cl-favs-h svg { color: #f5a623; }
.ize-cl-favs-strip {
	display: flex; gap: 14px; overflow-x: auto;
	padding: 2px 2px 4px; margin: 0 -2px;
	-webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ize-cl-favs-strip::-webkit-scrollbar { display: none; }

.ize-cl-fav {
	-webkit-appearance: none; appearance: none; border: 0; background: none;
	padding: 0; flex: 0 0 auto; width: 64px; cursor: pointer;
	display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ize-cl-fav-av {
	position: relative; width: 54px; height: 54px; border-radius: 50%;
	padding: 2px; background: linear-gradient(135deg, #f5a623, var(--cl-brand));
	transition: transform .12s ease;
}
.ize-cl-fav:active .ize-cl-fav-av { transform: scale(.93); }
.ize-cl-fav-av img {
	width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
	display: block; border: 2px solid var(--cl-card);
}
.ize-cl-fav-name {
	font-size: 11.5px; font-weight: 600; color: var(--cl-text);
	max-width: 64px; text-align: center;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* =============================================================================
   FILTER CHIPS
   ========================================================================== */
.ize-cl-chips {
	display: flex; gap: 8px; overflow-x: auto;
	padding: 2px 2px 12px; margin: 0 -2px;
	-webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ize-cl-chips::-webkit-scrollbar { display: none; }
.ize-cl-chip {
	-webkit-appearance: none; appearance: none;
	flex: 0 0 auto; height: 34px; padding: 0 15px;
	border: 1px solid var(--cl-line); border-radius: 17px;
	background: var(--cl-card); color: var(--cl-muted);
	font-size: 13.5px; font-weight: 600; cursor: pointer;
	display: inline-flex; align-items: center; gap: 6px;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.ize-cl-chip:active { transform: scale(.96); }
.ize-cl-chip.is-on {
	background: var(--cl-brandbg); color: var(--cl-brand);
	border-color: transparent;
}
.ize-cl-chip-n {
	font-size: 11.5px; font-weight: 700; opacity: .8;
	padding: 1px 6px; border-radius: 9px; background: rgba(0, 0, 0, .06);
}
.ize-cl-chip.is-on .ize-cl-chip-n { background: rgba(var(--main-rgb, 45, 108, 255), .16); }
html:has(#night-mode-css) .ize-cl-chip-n,
html.ize-dark .ize-cl-chip-n,
body.dark_active .ize-cl-chip-n,
body.dark .ize-cl-chip-n { background: rgba(255, 255, 255, .1); }

/* =============================================================================
   THE LIST
   ========================================================================== */
.ize-cl-card {
	background: var(--cl-card); border-radius: 16px;
	box-shadow: var(--cl-shadow); overflow: hidden;
}
.ize-cl-list { padding: 4px 0; }

.ize-cl-row {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 14px; position: relative;
	transition: background .15s ease, opacity .2s ease, transform .2s ease;
}
/* Separators are drawn per row and suppressed on the FIRST VISIBLE one, which
   ize-calls.js stamps with .is-first. An adjacent-sibling rule (`row + row`)
   cannot do this: a filtered-out or deleted row still counts as the sibling, so
   the first row actually on screen would keep a stray line above it. */
.ize-cl-row::before {
	content: ""; position: absolute; left: 70px; right: 0; top: 0;
	height: 1px; background: var(--cl-line);
}
.ize-cl-row.is-first::before { display: none; }

/* Filtered out by search or a chip — distinct from [hidden], which means the
   user deleted the row and it is waiting out its Undo window. */
.ize-cl-row.is-filtered { display: none; }
.ize-cl-row:hover  { background: var(--cl-softer); }
.ize-cl-row.is-sel { background: var(--cl-brandbg); }

/* Leaving the list: collapse rather than vanish, so the rows below do not jump
   the moment the user's finger is still on the screen. */
.ize-cl-row.is-going {
	opacity: 0; transform: translateX(-14px);
	pointer-events: none;
}
.ize-cl-row[hidden] { display: none; }

.ize-cl-av { position: relative; flex: 0 0 auto; display: block; text-decoration: none; }
.ize-cl-av img {
	width: 46px; height: 46px; border-radius: 50%; object-fit: cover; display: block;
	background: var(--cl-soft);
}
.ize-cl-favdot {
	position: absolute; right: -2px; bottom: -2px;
	width: 17px; height: 17px; border-radius: 50%;
	background: #f5a623; color: #fff;
	display: inline-flex; align-items: center; justify-content: center;
	border: 2px solid var(--cl-card);
}

.ize-cl-main {
	-webkit-appearance: none; appearance: none;
	border: 0; background: none; padding: 0; margin: 0; font: inherit;
	flex: 1 1 auto; min-width: 0; text-align: left; cursor: pointer;
	display: block;
}
.ize-cl-name {
	display: block; font-size: 15px; font-weight: 600; color: var(--cl-text);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ize-cl-row.is-missed .ize-cl-name { color: var(--cl-danger); }
.ize-cl-meta {
	display: flex; align-items: center; gap: 5px; margin-top: 2px;
	font-size: 12.5px; color: var(--cl-muted); min-width: 0;
}
.ize-cl-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ize-cl-dir { display: inline-flex; flex: 0 0 auto; }
.ize-cl-dir-out { color: var(--cl-ok); }
.ize-cl-dir-in  { color: var(--cl-in); }
.ize-cl-row.is-missed .ize-cl-dir { color: var(--cl-danger); }
.ize-cl-dot { opacity: .5; flex: 0 0 auto; }
.ize-cl-dur { flex: 0 0 auto; }

.ize-cl-pill {
	flex: 0 0 auto; font-size: 10.5px; font-weight: 700; line-height: 1;
	padding: 3px 7px; border-radius: 8px;
	background: var(--cl-dangerbg); color: var(--cl-danger);
	text-transform: uppercase; letter-spacing: .04em;
}
.ize-cl-row.is-blocked .ize-cl-av img { filter: grayscale(1); opacity: .7; }

.ize-cl-act {
	flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
}
.ize-cl-when {
	font-size: 12px; color: var(--cl-muted); white-space: nowrap;
	display: none;
}
@media (min-width: 420px) { .ize-cl-when { display: inline; } }
.ize-cl-btns { display: inline-flex; align-items: center; gap: 6px; }

.ize-cl-btn {
	-webkit-appearance: none; appearance: none;
	width: 36px; height: 36px; flex: 0 0 auto;
	border: 0; border-radius: 50%; padding: 0; margin: 0; font: inherit;
	display: inline-flex; align-items: center; justify-content: center;
	cursor: pointer; transition: transform .12s ease, background .15s ease;
}
.ize-cl-btn:active { transform: scale(.9); }
.ize-cl-btn:focus-visible { outline: 2px solid var(--cl-brand); outline-offset: 2px; }
.ize-cl-redial { background: var(--cl-okbg); color: var(--cl-ok); }
.ize-cl-redial:hover { filter: brightness(.96); }
.ize-cl-more { background: transparent; color: var(--cl-muted); }
.ize-cl-more:hover { background: var(--cl-soft); color: var(--cl-text); }

/* =============================================================================
   LOAD MORE / EMPTY / NO-RESULTS
   ========================================================================== */
.ize-cl-more-wrap { padding: 12px 14px 14px; text-align: center; }
.ize-cl-loadmore {
	-webkit-appearance: none; appearance: none;
	min-width: 150px; height: 38px; padding: 0 18px;
	border: 1px solid var(--cl-line); border-radius: 19px;
	background: var(--cl-card); color: var(--cl-text);
	font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ize-cl-loadmore[disabled] { opacity: .55; cursor: default; }
.ize-cl-more-wrap[hidden] { display: none; }

.ize-cl-empty {
	text-align: center; padding: 46px 20px; color: var(--cl-muted);
}
.ize-cl-empty svg { color: var(--cl-line); margin-bottom: 10px; }
.ize-cl-empty h3 {
	margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--cl-text);
}
.ize-cl-empty p { margin: 0 auto; max-width: 340px; font-size: 13.5px; line-height: 1.55; }
.ize-cl-empty[hidden] { display: none; }

/* =============================================================================
   BOTTOM SHEET  (portals to <body>, so it is namespaced .ize-cls, not .ize-cl)
   Material 3 modal bottom sheet: 28dp top corners, 32×4dp handle, 56dp rows.
   ========================================================================== */
.ize-cls {
	--cls-surface:  #ffffff;
	--cls-ink:      #1c1e21;
	--cls-ink-2:    #65676b;
	--cls-hair:     rgba(0, 0, 0, .10);
	--cls-handle:   rgba(0, 0, 0, .22);
	--cls-press:    rgba(0, 0, 0, .06);
	--cls-danger:   #e02b3f;
	--cls-dangerbg: rgba(224, 43, 63, .10);
	--cls-brand:    var(--main, #2d6cff);
	--cls-brandbg:  rgba(var(--main-rgb, 45, 108, 255), .12);
	--cls-scrim:    rgba(0, 0, 0, .40);
	--cls-shadow:   0 -2px 20px rgba(17, 24, 39, .14);
}
html:has(#night-mode-css) .ize-cls,
html.ize-dark .ize-cls,
body.dark_active .ize-cls,
body.dark .ize-cls {
	--cls-surface:  #212121;
	--cls-ink:      #e4e6eb;
	--cls-ink-2:    #b0b3b8;
	--cls-hair:     rgba(255, 255, 255, .12);
	--cls-handle:   rgba(255, 255, 255, .28);
	--cls-press:    rgba(255, 255, 255, .08);
	--cls-danger:   #ff6b7d;
	--cls-dangerbg: rgba(255, 107, 125, .14);
	--cls-scrim:    rgba(0, 0, 0, .60);
	--cls-shadow:   0 -2px 22px rgba(0, 0, 0, .55);
}

.ize-cls-scrim {
	position: fixed; inset: 0; z-index: 10600;
	background: var(--cls-scrim);
	opacity: 0; transition: opacity .2s ease;
	-webkit-tap-highlight-color: transparent;
}
.ize-cls-scrim.is-open { opacity: 1; }

.ize-cls-sheet {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 10601;
	background: var(--cls-surface); color: var(--cls-ink);
	border-radius: 28px 28px 0 0;
	box-shadow: var(--cls-shadow);
	padding-bottom: calc(10px + var(--ize-safe-bottom, 0px));
	max-height: 86vh; max-height: 86dvh;
	display: flex; flex-direction: column;
	transform: translateY(101%);
	transition: transform .26s cubic-bezier(.2, .8, .2, 1);
	will-change: transform;
}
.ize-cls-sheet.is-open { transform: translateY(0); }

@media (min-width: 720px) {
	/* Desktop gets a centred card, not a full-width tray glued to the bottom. */
	.ize-cls-sheet {
		left: 50%; bottom: 24px; right: auto;
		width: 420px; transform: translate(-50%, calc(100% + 40px));
		border-radius: 20px;
	}
	.ize-cls-sheet.is-open { transform: translate(-50%, 0); }
	.ize-cls-handle { display: none; }
}

.ize-cls-handle {
	width: 32px; height: 4px; border-radius: 2px;
	background: var(--cls-handle);
	margin: 10px auto 4px; flex: 0 0 auto;
}

.ize-cls-head {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 20px 14px; flex: 0 0 auto;
}
.ize-cls-head img {
	width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
	flex: 0 0 auto; background: var(--cls-press);
}
.ize-cls-head-t { min-width: 0; flex: 1 1 auto; }
.ize-cls-head-n {
	font-size: 16px; font-weight: 700; color: var(--cls-ink);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ize-cls-head-s {
	font-size: 12.5px; color: var(--cls-ink-2); margin-top: 1px;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ize-cls-body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; }

.ize-cls-item {
	-webkit-appearance: none; appearance: none;
	display: flex; align-items: center; gap: 16px; width: 100%;
	min-height: 56px; padding: 0 20px; border: 0; margin: 0;
	background: transparent; color: var(--cls-ink);
	font: inherit; font-size: 15px; text-align: left; cursor: pointer;
	text-decoration: none;
}
.ize-cls-item:active { background: var(--cls-press); }
.ize-cls-item:focus-visible { outline: 2px solid var(--cls-brand); outline-offset: -2px; }
.ize-cls-item svg { flex: 0 0 auto; color: var(--cls-ink-2); }
.ize-cls-item.is-danger { color: var(--cls-danger); }
.ize-cls-item.is-danger svg { color: var(--cls-danger); }
.ize-cls-item.is-star svg { color: #f5a623; }
.ize-cls-sep { height: 1px; background: var(--cls-hair); margin: 8px 20px; }

/* ---- second-step confirm --------------------------------------------------
   An in-sheet confirm instead of window.confirm(): the native WebView dialog is
   a different visual language, it cannot be styled for dark mode, and on some
   Android builds it can be dismissed by the back gesture without an answer. */
.ize-cls-confirm { padding: 4px 20px 12px; }
.ize-cls-confirm h4 {
	margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--cls-ink);
}
.ize-cls-confirm p {
	margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: var(--cls-ink-2);
}
.ize-cls-confirm-btns { display: flex; gap: 10px; }
.ize-cls-cbtn {
	-webkit-appearance: none; appearance: none;
	flex: 1 1 0; height: 44px; border: 0; border-radius: 22px;
	font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
	background: var(--cls-press); color: var(--cls-ink);
}
.ize-cls-cbtn.is-danger { background: var(--cls-danger); color: #fff; }
.ize-cls-cbtn:active { transform: scale(.97); }

/* =============================================================================
   UNDO SNACKBAR
   ========================================================================== */
.ize-cls-snack {
	position: fixed; z-index: 10650;
	left: 12px; right: 12px;
	bottom: calc(58px + var(--ize-safe-bottom, 0px));
	display: flex; align-items: center; gap: 12px;
	padding: 12px 8px 12px 16px; border-radius: 12px;
	background: #303030; color: #fff;
	font-size: 14px; box-shadow: 0 4px 18px rgba(0, 0, 0, .3);
	transform: translateY(140%); opacity: 0;
	transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}
.ize-cls-snack.is-open { transform: translateY(0); opacity: 1; }
.ize-cls-snack-t { flex: 1 1 auto; min-width: 0; }
.ize-cls-undo {
	-webkit-appearance: none; appearance: none;
	flex: 0 0 auto; border: 0; background: transparent;
	color: #ffcf6b; font: inherit; font-weight: 700; font-size: 14px;
	padding: 6px 12px; border-radius: 8px; cursor: pointer;
	text-transform: uppercase; letter-spacing: .04em;
}
.ize-cls-undo:active { background: rgba(255, 255, 255, .12); }
@media (min-width: 720px) {
	.ize-cls-snack { left: auto; right: 24px; width: 380px; bottom: 24px; }
}

/* =============================================================================
   MOTION / ACCESSIBILITY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.ize-cl-row,
	.ize-cls-sheet,
	.ize-cls-scrim,
	.ize-cls-snack,
	.ize-cl-searchwrap { transition: none; }
}

@media (max-width: 380px) {
	.ize-cl-title { font-size: 23px; }
	.ize-cl-row { padding: 10px 11px; gap: 10px; }
	.ize-cl-row::before { left: 63px; }
	.ize-cl-av img { width: 42px; height: 42px; }
}
