/**
 * "Summarize this article" popup — bottom-right widget styling.
 *
 * Overrides Bootstrap's centered-dialog modal defaults so this behaves like
 * a corner chat widget: fixed to the bottom-right, no dark backdrop (see
 * ai-summarize.js — Modal is created with backdrop:false), slides/fades in
 * from the corner instead of dropping from the top.
 */

.mac-ai-summary-modal {
	/* Bootstrap's .modal container spans the whole viewport to host the
	   backdrop; with no backdrop we don't want it eating clicks anywhere
	   except the dialog itself. */
	pointer-events: none;
}

.mac-ai-summary-modal .mac-ai-summary-dialog {
	pointer-events: auto;
	position: fixed;
	right: 24px;
	bottom: 24px;
	left: auto;
	margin: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	max-height: min(600px, calc(100vh - 48px));
	/* Make the dialog itself the flex column so max-height actually clamps
	   it — .modal-content's height:100% below needs a real flex parent to
	   resolve against, a percentage height on a block-level parent with no
	   explicit height does nothing. */
	display: flex;
	flex-direction: column;
}

/* Entrance animation: rise + fade from the corner instead of Bootstrap's
   default "drop from above" transform. !important because Bootstrap's own
   ".modal.fade .modal-dialog" / ".modal.show .modal-dialog" rules have
   higher selector specificity than ours and would otherwise win. */
.mac-ai-summary-modal .mac-ai-summary-dialog {
	transition: transform 0.25s ease-out, opacity 0.25s ease-out !important;
	transform: translateY(24px) !important;
	opacity: 0;
}
.mac-ai-summary-modal.show .mac-ai-summary-dialog {
	transform: translateY(0) !important;
	opacity: 1;
}

.mac-ai-summary-modal .modal-content {
	/* flex:1 1 auto (not height:100%) + min-height:0 is what actually lets
	   this shrink to fit the dialog's clamped max-height instead of growing
	   to its content's natural size — flex items default to
	   min-height:auto, which silently blocks shrinking/scrolling. */
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	border: none;
}

.mac-ai-summary-modal .modal-header {
	flex: 0 0 auto;
	background: #fddb66;
	border-bottom: 1px solid #e6e6f0;
	padding: 14px 18px;
}

.mac-ai-summary-modal .modal-title {
	font-size: 1rem;
	font-weight: 600;
}

.mac-ai-summary-modal .mac-ai-summary-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 18px;
}

.mac-ai-mode-choices .mac-ai-mode-btn:hover {
        background-color: #fbde76;
    border-color: #000000;
    font-weight: 700;
}


/* Mode chooser buttons */
.mac-ai-mode-choices .mac-ai-mode-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	text-align: left;
	padding: 12px 16px;
	border-radius: 10px;
	font-size: 0.95rem;
}

/* Loading state */
.mac-ai-summary-loading .spinner-border {
	width: 2rem;
	height: 2rem;
}

/* Back link */
.mac-ai-back-btn {
	font-size: 0.85rem;
	text-decoration: none;
}

/* Takeaways / stats list */
.mac-ai-summary-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.mac-ai-summary-list li {
	position: relative;
	padding-left: 26px;
	font-size: 0.92rem;
	line-height: 1.45;
}
.mac-ai-summary-list li::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2e2e2e;

}

/* FAQ list */
.mac-ai-faq-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.mac-ai-faq-item {
	padding-bottom: 12px;
	border-bottom: 1px solid #edeef5;
}
.mac-ai-faq-item:last-child {
	border-bottom: none;
	padding-bottom: 0;
}
.mac-ai-faq-item .mac-ai-faq-question {
	font-size: 0.92rem;
	margin-bottom: 4px;
}
.mac-ai-faq-item .mac-ai-faq-answer {
	font-size: 0.88rem;
	color: #555;
	line-height: 1.45;
}

/* Small screens: full-width bottom sheet instead of a floating corner card */
@media (max-width: 576px) {
	.mac-ai-summary-modal .mac-ai-summary-dialog {
		right: 12px;
		left: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
		max-height: min(520px, calc(100vh - 24px));
	}
}

/* Floating re-open button — appears once the popup is closed, sits in the
   same corner it collapses to. Hidden by default; JS toggles ".show" on
   the popup's hidden.bs.modal / shown.bs.modal events. */
.mac-ai-summary-fab {
	display: none;
	align-items: center;
	justify-content: center;
	position: fixed;
	right: 24px;
	bottom: 100px;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 1px solid #e6e6f0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	z-index: 1040; /* below Bootstrap's modal (1055) so it never fights it visually */
	animation: macAiFabPop 0.2s ease-out;
}
.mac-ai-summary-fab.show {
	display: flex;
}
.mac-ai-summary-fab img {
	width: 28px;
	height: 28px;
}
@keyframes macAiFabPop {
	from { transform: scale(0.6); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

@media (max-width: 576px) {
	.mac-ai-summary-fab {
		right: 16px;
		bottom: 16px;
	}
}
