/*
 * Diálogos do mDocs (.mdocs-dialog): adicionar/editar documento e ações em lote.
 * Usado no painel e no botão de envio do site; todo seletor é restrito ao diálogo.
 */
.mdocs-dialog {
	--d-border: #dcdcde;
	--d-border-strong: #c3c4c7;
	--d-muted: #646970;
	--d-text: #1d2327;
	--d-bg: #fff;
	--d-bg-soft: #f6f7f7;
	--d-accent: var(--wp-admin-theme-color, #2271b1);
	--d-accent-soft: #f0f6fc;
	--d-radius: 8px;
	color: var(--d-text);
	font-size: 14px;
}
.mdocs-dialog .modal-dialog { max-width: min(1080px, calc(100vw - 32px)); margin: 32px auto; }
.mdocs-dialog .modal-content {
	position: relative;
	overflow: hidden;
	border: 0;
	border-radius: var(--d-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.mdocs-dialog .mdocs-dialog-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--d-muted);
	cursor: pointer;
}
.mdocs-dialog .mdocs-dialog-close:hover { background: var(--d-bg-soft); color: var(--d-text); }
.mdocs-dialog .mdocs-dialog-close:focus-visible,
.mdocs-dialog .mdocs-dropzone:focus-within,
.mdocs-dialog .button:focus-visible { outline: 2px solid var(--d-accent); outline-offset: 2px; }
.mdocs-dialog .mdocs-dialog-close .dashicons { width: 24px; height: 24px; font-size: 24px; }

/* Cabeçalho */
.mdocs-dialog .mdocs-dialog-header { padding: 22px 64px 16px 28px; border-bottom: 1px solid var(--d-border); }
.mdocs-dialog .mdocs-dialog-header h2 { margin: 0; padding: 0; border: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.mdocs-dialog .mdocs-dialog-header h2 small { display: block; margin-top: 2px; color: var(--d-muted); font-size: 13px; font-weight: 400; }
.mdocs-dialog .mdocs-dialog-subtitle { margin: 6px 0 0; color: var(--d-muted); font-size: 13px; }

/* Corpo: coluna principal + lateral */
.mdocs-dialog .mdocs-dialog-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	max-height: calc(100vh - 230px);
	overflow-y: auto;
}
.mdocs-dialog .mdocs-dialog-main { padding: 24px 28px; }
.mdocs-dialog .mdocs-dialog-side { padding: 8px 24px 24px; border-left: 1px solid var(--d-border); background: var(--d-bg-soft); }
.mdocs-dialog .mdocs-dialog-section { padding: 16px 0 4px; border-bottom: 1px solid var(--d-border); }
.mdocs-dialog .mdocs-dialog-section:last-child { border-bottom: 0; }
.mdocs-dialog .mdocs-dialog-section h3 {
	margin: 0 0 12px;
	color: var(--d-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}

/* Campos */
.mdocs-dialog .mdocs-field { margin: 0 0 16px; }
.mdocs-dialog .mdocs-field-label { display: block; margin: 0 0 6px; padding: 0; font-size: 13px; font-weight: 600; text-align: left; }
.mdocs-dialog .mdocs-required { color: #b32d2e; }
.mdocs-dialog .mdocs-field-help { margin: 6px 0 0; color: var(--d-muted); font-size: 12px; }
.mdocs-dialog .mdocs-field-help:empty { display: none; }
.mdocs-dialog .form-control,
.mdocs-dialog select,
.mdocs-dialog input[type="text"] {
	width: 100%;
	height: auto;
	min-height: 36px;
	padding: 6px 10px;
	border: 1px solid var(--d-border-strong);
	border-radius: 4px;
	background-color: var(--d-bg);
	box-shadow: none;
	color: var(--d-text);
	font-size: 14px;
	line-height: 1.4;
}
.mdocs-dialog select:not([multiple]) {
	padding-right: 32px;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M5 6l5 5 5-5 2 1-7 7-7-7z' fill='%23555'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px top 55%;
	background-size: 16px 16px;
	text-overflow: ellipsis;
}
.mdocs-dialog select[multiple] { min-height: 96px; }
.mdocs-dialog .form-control:focus,
.mdocs-dialog select:focus,
.mdocs-dialog input[type="text"]:focus { border-color: var(--d-accent); box-shadow: 0 0 0 1px var(--d-accent); outline: 0; }
.mdocs-dialog .mdocs-field-main-name input { font-size: 16px; }

/* Caixas de seleção como linha "interruptor" (rótulo à esquerda, caixa à direita) */
.mdocs-dialog .mdocs-field-show-social-apps,
.mdocs-dialog .mdocs-field-downloadable-by-non-members {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}
.mdocs-dialog .mdocs-field-show-social-apps .mdocs-field-label,
.mdocs-dialog .mdocs-field-downloadable-by-non-members .mdocs-field-label { margin: 0; font-weight: 400; }
.mdocs-dialog input[type="checkbox"] {
	width: 18px;
	height: 18px;
	min-height: 0;
	margin: 0;
	padding: 0;
	transform: none !important;
	accent-color: var(--d-accent);
}

/* Área de arquivo */
.mdocs-dialog .mdocs-dropzone {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 150px;
	padding: 24px;
	border: 2px dashed var(--d-border-strong);
	border-radius: var(--d-radius);
	background: var(--d-bg-soft);
	color: var(--d-muted);
	text-align: center;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}
.mdocs-dialog .mdocs-dropzone:hover,
.mdocs-dialog .mdocs-dropzone.is-dragover { border-color: var(--d-accent); background: var(--d-accent-soft); }
.mdocs-dialog .mdocs-dropzone.has-file { border-style: solid; border-color: var(--d-accent); background: var(--d-accent-soft); }
.mdocs-dialog .mdocs-dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mdocs-dialog .mdocs-dropzone-icon { width: 36px; height: 36px; color: var(--d-accent); font-size: 36px; }
.mdocs-dialog .mdocs-dropzone-text strong { color: var(--d-accent); }
.mdocs-dialog .mdocs-dropzone-file { color: var(--d-text); font-weight: 600; word-break: break-all; }
.mdocs-dialog .mdocs-dropzone-file:empty { display: none; }

/* Colaboradores */
.mdocs-dialog .mdocs-contributors-container { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.mdocs-dialog .mdocs-contributors-container .btn,
.mdocs-dialog .mdocs-contributors-container button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 10px;
	border: 1px solid var(--d-border-strong);
	border-radius: 999px;
	background: var(--d-bg);
	color: var(--d-text);
	font-size: 12px;
	line-height: 1.6;
}
.mdocs-dialog .mdocs-contributors-container button:empty { display: none; }
.mdocs-dialog .mdocs-contributors { margin: 0; font-size: 12px; }
.mdocs-dialog .mdocs-user-search-list { margin-top: 4px; border-color: var(--d-border-strong); border-radius: 4px; }

/* Editor de descrição */
.mdocs-dialog .mdocs-field-description .wp-editor-wrap { border-radius: 4px; }
.mdocs-dialog .mdocs-field-description iframe { min-height: 180px; height: 220px !important; }
.mdocs-dialog .mdocs-field-description textarea.wp-editor-area { height: 220px !important; }

/* Rodapé fixo */
.mdocs-dialog .mdocs-dialog-footer {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 14px 28px;
	border-top: 1px solid var(--d-border);
	background: var(--d-bg);
}
.mdocs-dialog .mdocs-dialog-footer .button {
	min-height: 36px;
	padding: 0 16px;
	border-radius: 4px;
	font-size: 14px;
	line-height: 34px;
	cursor: pointer;
}
.mdocs-dialog .mdocs-dialog-footer .button:not(.button-primary) { border: 1px solid var(--d-border-strong); background: var(--d-bg); color: var(--d-text); }
.mdocs-dialog .mdocs-dialog-footer .button-primary { border: 1px solid var(--d-accent); background: var(--d-accent); color: #fff; }
.mdocs-dialog .mdocs-dialog-footer .button-primary:hover { filter: brightness(.92); }
.mdocs-dialog .mdocs-dialog-footer .button-primary[disabled] { opacity: .6; cursor: progress; }

@media (max-width: 860px) {
	.mdocs-dialog .modal-dialog { margin: 0; max-width: 100vw; }
	.mdocs-dialog .modal-content { min-height: 100vh; border-radius: 0; }
	.mdocs-dialog .mdocs-dialog-grid { grid-template-columns: minmax(0, 1fr); max-height: none; }
	.mdocs-dialog .mdocs-dialog-side { border-left: 0; border-top: 1px solid var(--d-border); }
	.mdocs-dialog .mdocs-dialog-header, .mdocs-dialog .mdocs-dialog-main { padding-left: 16px; padding-right: 16px; }
	.mdocs-dialog .mdocs-dialog-footer { position: sticky; bottom: 0; padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
	.mdocs-dialog.fade .modal-dialog, .mdocs-dialog .mdocs-dropzone { transition: none; }
}

/* ===== Ações em lote ===== */
.mdocs-dialog-batch .modal-dialog { max-width: min(1400px, calc(100vw - 64px)); }
.mdocs-dialog-batch .mdocs-batch-body { max-height: calc(100vh - 230px); overflow-y: auto; padding: 20px 28px; }
.mdocs-dialog-batch .mdocs-batch-summary { margin: 0 0 16px; color: var(--d-muted); }
.mdocs-dialog-batch .mdocs-batch-empty { margin: 24px 0; color: var(--d-muted); text-align: center; }
.mdocs-dialog-batch .mdocs-dialog-footer .button-danger { border-color: #b32d2e; background: #b32d2e; }
.mdocs-dialog-batch .mdocs-dialog-footer .button-danger:hover { background: #8a2424; }

.mdocs-batch-applyall {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 16px;
	align-items: flex-end;
	margin: 0 0 20px;
	padding: 14px 16px;
	border: 1px solid var(--d-border);
	border-radius: var(--d-radius);
	background: var(--d-bg-soft);
}
.mdocs-batch-applyall legend {
	float: left;
	width: 100%;
	margin: 0 0 2px;
	padding: 0;
	border: 0;
	color: var(--d-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}
.mdocs-batch-applyall label { display: flex; flex-direction: column; gap: 4px; min-width: 160px; margin: 0; font-size: 12px; font-weight: 600; }
.mdocs-batch-applyall select { min-width: 160px; }
.mdocs-batch-applyall select.is-applied { border-color: var(--d-accent); box-shadow: 0 0 0 1px var(--d-accent); }

.mdocs-batch-table-wrap { overflow-x: auto; border: 1px solid var(--d-border); border-radius: var(--d-radius); }
.mdocs-batch-table { width: 100%; min-width: 1240px; margin: 0; border-collapse: collapse; font-size: 13px; }
.mdocs-batch-table th {
	position: sticky;
	top: 0;
	z-index: 1;
	padding: 10px 8px;
	border-bottom: 1px solid var(--d-border-strong);
	background: var(--d-bg);
	font-size: 12px;
	font-weight: 600;
	text-align: left;
	vertical-align: bottom;
}
.mdocs-batch-table td { padding: 10px 8px; border-top: 1px solid var(--d-border); vertical-align: top; }
.mdocs-batch-table tbody tr:nth-child(even) td { background: #fbfbfc; }
.mdocs-batch-table tr.is-changed td { background: var(--d-accent-soft) !important; }
.mdocs-batch-table .col-name { min-width: 240px; }
.mdocs-batch-table .col-version { width: 80px; min-width: 72px; }
.mdocs-batch-table .col-date { width: 150px; min-width: 150px; }
.mdocs-batch-table .col-folder { min-width: 150px; }
.mdocs-batch-table .col-status { min-width: 130px; }
.mdocs-batch-table .col-check { width: 84px; text-align: center; white-space: nowrap; }
.mdocs-batch-table td.col-check { padding-top: 18px; }
.mdocs-batch-table .col-downloads { width: 96px; min-width: 96px; }
.mdocs-batch-table .col-contributors { min-width: 220px; }
.mdocs-batch-table .form-control { min-height: 34px; font-size: 13px; }
.mdocs-batch-filename { display: block; margin-top: 4px; color: var(--d-muted); font-size: 12px; word-break: break-all; }
.mdocs-batch-table .mdocs-contributors-container { margin: 6px 0 0; }

.mdocs-batch-list { margin: 0; padding: 0; border: 1px solid var(--d-border); border-radius: var(--d-radius); list-style: none; }
.mdocs-batch-list li + li { border-top: 1px solid var(--d-border); }
.mdocs-batch-list label { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 14px; font-weight: 400; cursor: pointer; }
.mdocs-batch-list label:hover { background: var(--d-bg-soft); }
.mdocs-batch-list-icon img { width: 24px; height: auto; margin: 0 !important; }
.mdocs-batch-list-text { display: flex; flex-direction: column; min-width: 0; }
.mdocs-batch-list-text small { color: var(--d-muted); word-break: break-all; }
.mdocs-batch-list li:has(input:not(:checked)) .mdocs-batch-list-text { opacity: .55; text-decoration: line-through; }

.mdocs-batch-warning {
	margin: 0 0 16px;
	padding: 12px 14px;
	border-left: 4px solid #b32d2e;
	border-radius: 4px;
	background: #fcf0f1;
	color: #1d2327;
}

/* Acima do menu lateral e da barra do admin do WP (z-index 9990 / 99999) */
.mdocs-dialog.modal { z-index: 100050; }
body.modal-open .modal-backdrop { z-index: 100040; }
