/* Westwood field renderer (wp-admin + Hub). */
.wwf-form {
	--wwf-navy: #14293A;
	--wwf-blue: #2E7DB8;
	--wwf-line: #D9D2C1;
	--wwf-muted: #48606F;
	--wwf-bg: #fff;
	--wwf-soft: #F7F3EA;
	--wwf-error: #B42318;
	--wwf-radius: 10px;
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 18px 16px;
	color: var(--wwf-navy);
}
.wwf-field { grid-column: span 6; min-width: 0; }
.wwf-w-half { grid-column: span 3; }
.wwf-w-third { grid-column: span 2; }
@media (max-width: 640px) {
	.wwf-w-half, .wwf-w-third { grid-column: span 6; }
}
.wwf-field[hidden] { display: none; }

.wwf-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; margin: 0 0 6px; }
.wwf-req { color: var(--wwf-error); }
.wwf-badge { font-size: 11px; font-weight: 700; background: #E8F1F8; color: var(--wwf-blue); padding: 2px 8px; border-radius: 99px; }
.wwf-help { margin: 6px 0 0; font-size: 13px; color: var(--wwf-muted); }
.wwf-error { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--wwf-error); }
.wwf-field.has-error .wwf-input, .wwf-field.has-error .wwf-rte { border-color: var(--wwf-error); box-shadow: 0 0 0 3px rgba(180, 35, 24, .12); }

.wwf-input {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	font: inherit;
	font-size: 16px; /* 16px stops iOS zooming on focus. */
	color: var(--wwf-navy);
	background: var(--wwf-bg);
	border: 1.5px solid var(--wwf-line);
	border-radius: var(--wwf-radius);
	transition: border-color .15s, box-shadow .15s;
}
textarea.wwf-input { min-height: 88px; line-height: 1.5; resize: vertical; }
.wwf-input:focus { outline: none; border-color: var(--wwf-blue); box-shadow: 0 0 0 3px rgba(46, 125, 184, .18); }
.wwf-input:disabled, .wwf-input[readonly] { background: #F1EEE6; color: var(--wwf-muted); cursor: not-allowed; }
select.wwf-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--wwf-muted) 50%), linear-gradient(135deg, var(--wwf-muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }

.wwf-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 40px; padding: 8px 16px;
	font: inherit; font-weight: 700; font-size: 14px;
	color: var(--wwf-navy); background: #fff;
	border: 1.5px solid var(--wwf-line); border-radius: 99px; cursor: pointer;
}
.wwf-btn:hover { border-color: var(--wwf-navy); }
.wwf-btn:disabled { opacity: .5; cursor: not-allowed; }
.wwf-btn--quiet { border-color: transparent; background: transparent; color: var(--wwf-muted); }
.wwf-btn--add { border-style: dashed; width: 100%; }
.wwf-icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--wwf-muted); font-size: 18px; line-height: 1; cursor: pointer; }
.wwf-icon-btn:hover:not(:disabled) { background: var(--wwf-soft); color: var(--wwf-navy); }
.wwf-icon-btn:disabled { opacity: .35; cursor: default; }
.wwf-icon-btn--danger:hover:not(:disabled) { color: var(--wwf-error); background: #FDECEA; }

/* Toggle switch */
.wwf-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.wwf-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wwf-switch-track { position: relative; width: 48px; height: 28px; border-radius: 99px; background: #CFC8B8; transition: background .2s; flex: none; }
.wwf-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.wwf-switch-input:checked + .wwf-switch-track { background: var(--wwf-blue); }
.wwf-switch-input:checked + .wwf-switch-track::after { transform: translateX(20px); }
.wwf-switch-input:focus-visible + .wwf-switch-track { box-shadow: 0 0 0 3px rgba(46, 125, 184, .3); }
.wwf-switch-input:disabled + .wwf-switch-track { opacity: .5; }
.wwf-switch-label { font-weight: 600; color: var(--wwf-muted); }

/* Radio (segmented) + checkboxes */
.wwf-segmented { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.wwf-seg { position: relative; }
.wwf-seg input { position: absolute; opacity: 0; }
.wwf-seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; line-height: 1.3; border: 1.5px solid var(--wwf-line); border-radius: 12px; font-weight: 600; cursor: pointer; }
.wwf-seg input:checked + span { background: var(--wwf-navy); border-color: var(--wwf-navy); color: #fff; }
.wwf-seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(46, 125, 184, .3); }
.wwf-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; }
.wwf-check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.wwf-check input { width: 20px; height: 20px; accent-color: var(--wwf-blue); }

/* Colour */
.wwf-color-row { display: flex; gap: 10px; align-items: center; }
.wwf-color { width: 52px; height: 44px; padding: 2px; border: 1.5px solid var(--wwf-line); border-radius: var(--wwf-radius); background: #fff; }
.wwf-color-text { max-width: 160px; }

/* Rich text */
.wwf-rte { border: 1.5px solid var(--wwf-line); border-radius: var(--wwf-radius); background: #fff; overflow: hidden; }
.wwf-rte:focus-within { border-color: var(--wwf-blue); box-shadow: 0 0 0 3px rgba(46, 125, 184, .18); }
.wwf-rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--wwf-line); background: var(--wwf-soft); }
.wwf-rte-btn { min-width: 36px; height: 34px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; font: inherit; font-weight: 700; font-size: 13px; color: var(--wwf-navy); cursor: pointer; }
.wwf-rte-btn:hover { background: #fff; }
.wwf-rte-body { min-height: 160px; max-height: 60vh; overflow-y: auto; padding: 12px 14px; font-size: 16px; line-height: 1.6; outline: none; }
.wwf-rte-body > :first-child { margin-top: 0; }
.wwf-rte-body h2 { font-size: 1.35em; margin: 1em 0 .4em; }
.wwf-rte-body h3 { font-size: 1.15em; margin: 1em 0 .4em; }
.wwf-rte-body a { color: var(--wwf-blue); }

/* Media */
.wwf-media { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.wwf-media-preview:empty { display: none; }
.wwf-media-preview img { display: block; max-width: 220px; max-height: 160px; border-radius: 8px; object-fit: cover; object-position: center top; background: var(--wwf-soft); }
.wwf-media--image .wwf-media-preview img { width: 220px; height: 140px; }
.wwf-media-file { display: inline-block; padding: 10px 12px; border-radius: 8px; background: var(--wwf-soft); font-weight: 600; font-size: 14px; word-break: break-all; }
.wwf-media-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Post picker */
.wwf-picker { position: relative; }
.wwf-chips { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.wwf-chips:empty { display: none; }
.wwf-chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; border-radius: 99px; background: #E8F1F8; font-weight: 600; font-size: 14px; }
.wwf-chip-btn { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 15px; color: var(--wwf-navy); }
.wwf-chip-btn:hover { background: #fff; }
.wwf-picker-search { position: relative; }
.wwf-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--wwf-line); border-radius: var(--wwf-radius); box-shadow: 0 12px 32px rgba(20, 41, 58, .16); max-height: 280px; overflow-y: auto; }
.wwf-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.wwf-results button:hover, .wwf-results button:focus { background: var(--wwf-soft); outline: none; }
.wwf-results small { color: var(--wwf-muted); }
.wwf-results-empty { padding: 10px 12px; color: var(--wwf-muted); }

/* Repeater + group */
.wwf-rows { display: grid; gap: 12px; margin-bottom: 12px; }
.wwf-rows:empty { display: none; }
.wwf-row { border: 1.5px solid var(--wwf-line); border-radius: 12px; background: #FCFBF8; }
.wwf-row-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--wwf-line); }
.wwf-row-num { font-weight: 800; font-size: 13px; color: var(--wwf-muted); }
.wwf-row-tools { display: flex; gap: 2px; }
.wwf-row-body { padding: 14px; }
.wwf-group { padding: 14px; border: 1.5px solid var(--wwf-line); border-radius: 12px; }
.wwf-message { padding: 12px 14px; border-radius: 10px; background: var(--wwf-soft); font-size: 14px; }

/* Media modal (Hub) */
.wwf-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(20, 41, 58, .55); }
.wwf-modal-card { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px; border-radius: 16px; background: #fff; box-shadow: 0 24px 64px rgba(0,0,0,.25); }
.wwf-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.wwf-modal-head h2 { margin: 0; font-size: 20px; }
.wwf-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border: 2px dashed var(--wwf-line); border-radius: 12px; text-align: center; cursor: pointer; color: var(--wwf-muted); }
.wwf-drop strong { color: var(--wwf-navy); }
.wwf-drop.is-over, .wwf-drop:hover { border-color: var(--wwf-blue); background: #F2F8FC; }
.wwf-media-search { margin: 14px 0 8px; }
.wwf-media-status { min-height: 1.4em; color: var(--wwf-muted); font-size: 14px; }
.wwf-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.wwf-media-item { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1.5px solid transparent; border-radius: 10px; background: var(--wwf-soft); cursor: pointer; text-align: left; font: inherit; }
.wwf-media-item:hover, .wwf-media-item:focus { border-color: var(--wwf-blue); outline: none; }
.wwf-media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.wwf-media-item .wwf-media-file { aspect-ratio: 4 / 3; display: grid; place-items: center; }
.wwf-media-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wwf-progress { display: inline-block; vertical-align: middle; width: 160px; height: 8px; border-radius: 99px; background: var(--wwf-line); overflow: hidden; }
.wwf-progress-bar { display: block; height: 100%; width: 0; background: var(--wwf-blue); transition: width .2s; }
.wwf-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* wp-admin tweaks */
.wp-admin .wwf-form { padding: 6px 0; }
.wp-admin .ww-settings-group { max-width: 980px; margin: 18px 0; padding: 18px 22px; background: #fff; border: 1px solid #dcdcde; border-radius: 8px; }
.wp-admin .ww-settings-group h2 { margin-top: 0; }

/* Hidden values (row ids) take no space. */
.wwf-field--hidden { display: none; }
