/* =========================================================
   OEME S3 Document Picker – Modal Styles
   ========================================================= */

/* ── Prevent body scroll when modal is open ─────────────── */
.oeme-s3-body--no-scroll {
	overflow: hidden;
}

/* ── Trigger button ──────────────────────────────────────── */
.oeme-s3-picker-wrapper {
	display: inline-block;
}

.oeme-s3-picker-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	background-color: #0053a0;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease;
	line-height: 1.4;
	font-family: inherit;
}

.oeme-s3-picker-btn:hover {
	background-color: #003f7c;
}

.oeme-s3-picker-btn:active {
	transform: scale(0.98);
}

.oeme-s3-picker-btn__icon {
	display: flex;
	align-items: center;
}

/* ── Modal backdrop ──────────────────────────────────────── */
.oeme-s3-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	align-items: center;
	justify-content: center;
}

.oeme-s3-modal--open {
	display: flex;
}

.oeme-s3-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
}

/* ── Modal dialog ────────────────────────────────────────── */
.oeme-s3-modal__dialog {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 12px;
	width: min(600px, calc(100vw - 32px));
	max-height: min(80vh, 700px);
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.12);
	overflow: hidden;
	animation: oeme-modal-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes oeme-modal-in {
	from {
		opacity: 0;
		transform: scale(0.92) translateY(12px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

/* ── Modal header ────────────────────────────────────────── */
.oeme-s3-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid #e8eaed;
	flex-shrink: 0;
	background: #f8f9fa;
}

.oeme-s3-modal__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: #1a1a2e;
	line-height: 1.3;
}

.oeme-s3-modal__header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* Download All link */
.oeme-s3-modal__download-all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	background: #0053a0;
	color: #fff !important;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none !important;
	transition: background-color 0.15s ease;
	white-space: nowrap;
}

.oeme-s3-modal__download-all:hover {
	background: #003f7c;
	text-decoration: none !important;
}

.oeme-s3-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: none;
	background: transparent;
	border-radius: 50%;
	cursor: pointer;
	color: #5f6368;
	transition: background-color 0.15s ease, color 0.15s ease;
	flex-shrink: 0;
	padding: 0;
}

.oeme-s3-modal__close:hover {
	background-color: #e8eaed;
	color: #202124;
}

/* ── Modal body ──────────────────────────────────────────── */
.oeme-s3-modal__body {
	overflow-y: auto;
	padding: 16px 24px 24px;
	flex: 1;
}

/* ── Loading state ───────────────────────────────────────── */
.oeme-s3-modal__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 40px 0;
	color: #5f6368;
	font-size: 15px;
}

.oeme-s3-spinner {
	width: 22px;
	height: 22px;
	border: 3px solid #e8eaed;
	border-top-color: #0053a0;
	border-radius: 50%;
	animation: oeme-spin 0.75s linear infinite;
	flex-shrink: 0;
}

@keyframes oeme-spin {
	to { transform: rotate(360deg); }
}

/* ── Document list ───────────────────────────────────────── */
.oeme-s3-modal__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.oeme-s3-modal__item {
	margin: 0;
	padding: 0;
}

.oeme-s3-modal__doc-link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 14px;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
	border: 1px solid #e8eaed;
	background: #fff;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.oeme-s3-modal__doc-link:hover {
	border-color: #0053a0;
	background: #f0f5ff;
	box-shadow: 0 2px 8px rgba(0, 83, 160, 0.1);
	text-decoration: none;
	color: inherit;
}

/* File type badge */
.oeme-s3-modal__doc-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	border-radius: 8px;
	color: #fff;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.5px;
	flex-shrink: 0;
}

/* File info */
.oeme-s3-modal__doc-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.oeme-s3-modal__doc-name {
	font-size: 14px;
	font-weight: 500;
	color: #202124;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.4;
}

.oeme-s3-modal__doc-size {
	font-size: 12px;
	color: #80868b;
	line-height: 1.3;
}

/* Arrow icon */
.oeme-s3-modal__doc-arrow {
	display: flex;
	align-items: center;
	color: #80868b;
	flex-shrink: 0;
	transition: color 0.15s ease, transform 0.15s ease;
}

.oeme-s3-modal__doc-link:hover .oeme-s3-modal__doc-arrow {
	color: #0053a0;
	transform: translate(2px, -2px);
}

/* ── Empty / error states ────────────────────────────────── */
.oeme-s3-modal__empty,
.oeme-s3-modal__error {
	text-align: center;
	padding: 36px 16px;
	font-size: 15px;
	margin: 0;
	line-height: 1.6;
}

.oeme-s3-modal__empty {
	color: #80868b;
}

.oeme-s3-modal__error {
	color: #c62828;
	background: #fff5f5;
	border-radius: 8px;
	border: 1px solid #fde0e0;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
	.oeme-s3-modal__dialog {
		border-radius: 12px 12px 0 0;
		width: 100%;
		max-height: 85vh;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		animation: oeme-modal-in-mobile 0.25s ease both;
	}

	@keyframes oeme-modal-in-mobile {
		from {
			opacity: 0;
			transform: translateY(100%);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	.oeme-s3-modal {
		align-items: flex-end;
	}

	.oeme-s3-modal__doc-badge {
		min-width: 38px;
		height: 38px;
		font-size: 9px;
	}
}
