/*
 * Shared component styles for the public AI resource pages
 * (Bank Usage, Benefit Analysis, Enhanced Prompts, Customer Personas, and
 * the Standard Prompt Library). All shared elements use the unified
 * `iba-ai-*` prefix so a single stylesheet drives every page. Design tokens,
 * reset, and the back link live in shared.css, which each page also links.
 *
 * Grid comes in two shapes:
 *   .iba-ai-grid     — flat card grid (Benefit Analysis, Customer Personas)
 *   .iba-ai-grouped  — stacked groups, each with its own .iba-ai-cards grid
 *                      (Bank Usage, Enhanced Prompts, Standard Prompt Library)
 */

/* Header */

.iba-ai-header {
	background: var(--iba-navy);
	color: #ffffff;
	padding: 36px 24px 32px;
}

.iba-ai-header-inner {
	max-width: 1200px;
	margin: 0 auto;
}

.iba-ai-header h1 {
	margin: 0 0 8px;
	font-size: 28px;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.iba-ai-header p {
	margin: 0;
	font-size: 15px;
	color: #c9d7e2;
	line-height: 1.55;
}

/* Page shell */

.iba-ai-page {
	padding: 32px 24px 64px;
}

.iba-ai-wrap {
	max-width: 1200px;
	margin: 0 auto;
}

/* Intro + disclaimer */

.iba-ai-intro {
	margin-bottom: 28px;
}

.iba-ai-intro p {
	font-size: 15px;
	line-height: 1.6;
	color: var(--iba-text-muted);
}

.iba-ai-disclaimer {
	font-size: 13px;
	line-height: 1.55;
	color: var(--iba-text-muted);
	background: var(--iba-blue-light);
	border: 1px solid var(--iba-border);
	border-radius: var(--iba-radius);
	padding: 12px 16px;
	margin: 14px 0 0;
}

/* Controls */

.iba-ai-controls {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.iba-ai-search-field {
	position: relative;
	flex: 1 1 320px;
	min-width: 240px;
}

.iba-ai-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--iba-text-muted);
	pointer-events: none;
}

/* Search input + filter select are styled by their (now unified) ids;
   each page is a standalone document, so the ids do not collide. */
#iba-ai-search {
	width: 100%;
	padding: 12px 14px 12px 40px;
	font-size: 15px;
	border: 1px solid var(--iba-border);
	border-radius: var(--iba-radius);
	background: var(--iba-bg);
	color: var(--iba-text);
}

#iba-ai-search:focus {
	outline: none;
	border-color: var(--iba-blue);
	box-shadow: 0 0 0 3px rgba(59, 109, 148, 0.15);
}

#iba-ai-department-filter,
#iba-ai-category-filter {
	flex: 0 1 260px;
	min-width: 200px;
	padding: 12px 14px;
	font-size: 15px;
	border: 1px solid var(--iba-border);
	border-radius: var(--iba-radius);
	background: var(--iba-bg);
	color: var(--iba-text);
	cursor: pointer;
}

#iba-ai-department-filter:focus,
#iba-ai-category-filter:focus {
	outline: none;
	border-color: var(--iba-blue);
	box-shadow: 0 0 0 3px rgba(59, 109, 148, 0.15);
}

.iba-ai-result-count {
	font-size: 13px;
	color: var(--iba-text-muted);
	margin: 14px 2px 18px;
}

/* Grid + groups */

.iba-ai-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
}

.iba-ai-grouped {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.iba-ai-group-heading {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--iba-navy);
	margin: 0 0 14px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--iba-border);
}

.iba-ai-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
}

/* Cards */

.iba-ai-card {
	background: var(--iba-bg);
	border: 1px solid var(--iba-border);
	border-radius: var(--iba-radius);
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.iba-ai-card:hover {
	box-shadow: 0 4px 14px rgba(31, 58, 82, 0.1);
	transform: translateY(-1px);
}

.iba-ai-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.iba-ai-card-tag {
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--iba-blue);
	background: var(--iba-blue-light);
	border-radius: 4px;
	padding: 3px 8px;
	align-self: flex-start;
}

.iba-ai-ttv-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	color: #1f7a4d;
	background: #e7f5ec;
	border-radius: 4px;
	padding: 3px 8px;
	white-space: nowrap;
	flex-shrink: 0;
}

.iba-ai-card h4 {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--iba-navy-dark);
	line-height: 1.35;
}

.iba-ai-card p {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--iba-text-muted);
	flex-grow: 1;
}

/* Opt-in 3-line clamp for card previews (Bank Usage, Benefit Analysis) */
.iba-ai-clamp-3 {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.iba-ai-view-btn {
	align-self: flex-start;
	margin-top: 4px;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #ffffff;
	background: var(--iba-navy);
	border: none;
	border-radius: 6px;
	cursor: pointer;
}

.iba-ai-view-btn:hover {
	background: var(--iba-navy-dark);
}

.iba-ai-view-btn:focus-visible {
	outline: 2px solid var(--iba-blue);
	outline-offset: 2px;
}

.iba-ai-empty {
	text-align: center;
	color: var(--iba-text-muted);
	padding: 48px 0;
	font-size: 15px;
}

/* Modal */

.iba-ai-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(22, 41, 59, 0.55);
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 5vh 16px;
	z-index: 9999;
	overflow-y: auto;
}

.iba-ai-modal-overlay[hidden] {
	display: none;
}

.iba-ai-modal {
	background: #ffffff;
	border-radius: 10px;
	max-width: 680px;
	width: 100%;
	padding: 32px;
	position: relative;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* Wider variant for content-heavy modals (e.g. Enhanced Prompts), so the
   longer sections wrap onto fewer lines and the dialog fits the viewport. */
.iba-ai-modal-wide {
	max-width: 1100px;
}

.iba-ai-modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 32px;
	height: 32px;
	border: none;
	background: var(--iba-blue-light);
	color: var(--iba-navy);
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.iba-ai-modal-close:hover {
	background: var(--iba-border);
}

.iba-ai-modal-close:focus-visible {
	outline: 2px solid var(--iba-blue);
	outline-offset: 2px;
}

.iba-ai-modal-tag {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--iba-blue);
	margin: 0 0 6px;
	padding-right: 40px;
}

.iba-ai-modal-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-right: 40px;
	margin-bottom: 6px;
}

.iba-ai-modal-category {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--iba-blue);
	margin: 0;
}

.iba-ai-modal-ttv {
	font-size: 11px;
	font-weight: 700;
	color: #1f7a4d;
	background: #e7f5ec;
	border-radius: 4px;
	padding: 3px 8px;
}

.iba-ai-modal h3 {
	margin: 0 0 20px;
	font-size: 22px;
	font-weight: 700;
	color: var(--iba-navy-dark);
	padding-right: 40px;
	line-height: 1.3;
}

.iba-ai-modal-section {
	margin-bottom: 22px;
}

.iba-ai-modal-section:last-child {
	margin-bottom: 0;
}

.iba-ai-modal-section h4 {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--iba-text-muted);
}

.iba-ai-modal-section p {
	margin: 0;
	font-size: 15px;
	line-height: 1.6;
	color: var(--iba-text);
}

.iba-ai-modal-quote {
	margin: 0;
	padding: 14px 16px;
	background: #f6f8fa;
	border: 1px solid var(--iba-border);
	border-left: 3px solid var(--iba-blue);
	border-radius: 6px;
	font-size: 15px;
	line-height: 1.7;
	color: var(--iba-text);
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 400px;
	overflow-y: auto;
}

.iba-ai-modal-steps {
	margin: 0;
	padding-left: 20px;
	font-size: 15px;
	line-height: 1.7;
	color: var(--iba-text);
}

.iba-ai-modal-steps li {
	margin-bottom: 4px;
}

.iba-ai-modal-prompt-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.iba-ai-modal-prompt-header h4 {
	margin: 0;
}

.iba-ai-copy-btn {
	font-size: 12px;
	font-weight: 600;
	color: var(--iba-navy);
	background: var(--iba-blue-light);
	border: 1px solid var(--iba-border);
	border-radius: 6px;
	padding: 5px 12px;
	cursor: pointer;
}

.iba-ai-copy-btn:hover {
	background: var(--iba-border);
}

.iba-ai-copy-btn:focus-visible {
	outline: 2px solid var(--iba-blue);
	outline-offset: 2px;
}

.iba-ai-copy-btn.iba-ai-copied {
	background: #1f7a4d;
	border-color: #1f7a4d;
	color: #fff;
}

.iba-ai-modal-prompt {
	background: #f6f8fa;
	border: 1px solid var(--iba-border);
	border-radius: 6px;
	padding: 14px 16px;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 13px;
	line-height: 1.6;
	color: var(--iba-text);
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 320px;
	overflow-y: auto;
	margin: 0;
}

#iba-ai-modal-notes-wrap[hidden] {
	display: none;
}

/* Footer */

.iba-ai-footer {
	max-width: 1200px;
	margin: 40px auto 0;
	padding-top: 20px;
	border-top: 1px solid var(--iba-border);
	font-size: 12px;
	color: var(--iba-text-muted);
	text-align: center;
}

/* Mobile */

@media (max-width: 600px) {
	.iba-ai-controls {
		flex-direction: column;
	}
	.iba-ai-search-field,
	#iba-ai-department-filter,
	#iba-ai-category-filter {
		flex: 1 1 auto;
		min-width: 0;
	}
	.iba-ai-modal {
		padding: 24px 18px;
	}
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
	.iba-ai-card {
		transition: none;
	}
}
