/* Shared modal base */

.editor-modal {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
}

.editor-modal.is-open {
	display: flex;
}

.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.modal-panel {
	position: relative;
	width: min(480px, calc(100vw - 32px));
	max-height: calc(100vh - 64px);
	background: #fff;
	color: #1f2937;
	border-radius: 10px;
	box-shadow: 0 20px 44px rgba(0, 0, 0, 0.35);
	padding: 16px;
	display: flex;
	flex-direction: column;
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.modal-header h2 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #111827;
}

.modal-close {
	width: 28px;
	height: 28px;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: #374151;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.modal-btn {
	height: 34px;
	padding: 0 13px;
	border-radius: 7px;
	border: none;
	background: #e5e7eb;
	color: #1f2937;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.modal-btn-primary {
	background: #669934;
	color: #fff;
}

.modal-btn-danger {
	background: #dc2626;
	color: #fff;
}

.modal-subtitle {
	margin: 0 0 10px;
	font-size: 13px;
	color: #4b5563;
}

.modal-message {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.5;
	color: #374151;
}

.modal-message strong {
	color: #111827;
	font-weight: 600;
}

.modal-loading,
.modal-empty {
	padding: 16px 0;
	text-align: center;
	font-size: 13px;
	color: #6b7280;
}

.modal-error {
	font-size: 13px;
	color: #dc2626;
}

/* Per-modal overrides */

.editor-modal { z-index: 10020; }

/* Panel width overrides */
#saveVersionModal .modal-panel    { width: min(560px, calc(100vw - 32px)); padding: 14px 14px 12px; }
#collabModal .modal-panel         { width: min(400px, calc(100vw - 32px)); }
#collabPrivacyNotice .modal-panel   { width: min(380px, calc(100vw - 32px)); }
#deleteBreedModal .modal-panel    { width: min(460px, calc(100vw - 32px)); padding: 14px 14px 12px; }

/* Header margin overrides */
#detailsModal .modal-header  { margin-bottom: 12px; }
#detailsModal .modal-header h2 { font-size: 16px; }
#collabModal .modal-header   { margin-bottom: 10px; }
#collabModal .modal-header h2 { font-size: 16px; }
#galleryModal .modal-header  { margin-bottom: 4px; }
#saveVersionModal .modal-header { margin-bottom: 6px; }
#deleteBreedModal .modal-header { margin-bottom: 4px; }

/* Action spacing overrides */
#saveVersionModal .modal-actions { margin-top: 10px; }
#galleryModal .modal-actions     { margin-top: 12px; }

/* Project details modal */

#detailsModal .modal-panel {
	overflow-y: auto;
}

#detailsModal .dm-details {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 0 16px;
	font-size: 13px;
	line-height: 1.6;
	color: #1f2937;
}

#detailsModal .dm-details > span {
	padding: 8px 0;
}

#detailsModal .dm-details > span:not(.dm-label) {
	border-bottom: 1px solid #e5e7eb;
	min-width: 0;
	overflow-wrap: break-word;
}

#detailsModal .dm-details > span:not(.dm-label) p {
	margin: 0;
}

#detailsModal #dm-description {
	max-height: 120px;
	overflow-y: auto;
	padding-right: 12px;
	scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#detailsModal #dm-description::-webkit-scrollbar,
#detailsModal .dm-gallery-list::-webkit-scrollbar { width: 8px; background: transparent; }
#detailsModal #dm-description::-webkit-scrollbar-thumb,
#detailsModal .dm-gallery-list::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
#detailsModal #dm-description::-webkit-scrollbar-thumb:hover,
#detailsModal .dm-gallery-list::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.35); }

#detailsModal .dm-label {
	color: #6b7280;
	font-weight: 500;
	white-space: nowrap;
	align-self: start;
}

#detailsModal .dm-details a {
	color: #669934;
}

#detailsModal .dm-gallery-list {
	list-style: none;
	margin: 0;
	padding: 0;
	padding-right: 12px;
	max-height: 120px;
	overflow-y: auto;
	font-size: 13px;
	line-height: 1.6;
	scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#detailsModal .dm-gallery-list li {
	word-break: break-word;
}

#detailsModal .dm-gallery-list a {
	text-decoration: none;
}

/* Confirm dialog (legacy) */

/* Save Version modal */

#saveVersionModal .modal-subtitle { margin-bottom: 8px; }

#saveVersionNotes {
	display: block;
	width: 100%;
	min-height: 140px;
	max-height: 52vh;
	resize: vertical;
	border: none;
	border-radius: 8px;
	padding: 10px 11px;
	font-size: 14px;
	line-height: 1.35;
	color: #111827;
	background: #f3f4f6;
}

#saveVersionNotes:focus {
	outline: none;
}

/* Gallery modal */

.gm-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow-y: auto;
	max-height: 320px;
	min-height: 60px;
	padding: 4px 0;
}

.gm-gallery-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 6px;
	cursor: pointer;
	user-select: none;
}

.gm-gallery-item:hover {
	background: #f3f4f6;
}

.gm-gallery-item input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin: 0;
	flex: 0 0 auto;
	accent-color: #669934;
}

.gm-gallery-item span {
	font-size: 14px;
	color: #1f2937;
}

.gm-privacy-label {
	margin-left: auto;
	font-size: 11px;
	font-weight: 400;
	color: #b0b5bd;
}

/* Collaborator modal */

.cm-add-row {
	display: flex;
	gap: 8px;
	margin-bottom: 6px;
}

.cm-add-input {
	flex: 1;
	height: 34px;
	padding: 0 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
	color: #1f2937;
	background: #fff;
}

.cm-add-input:focus {
	outline: none;
	border-color: #669934;
	box-shadow: 0 0 0 1px rgba(102, 153, 52, 0.2);
}

.cm-list {
	display: flex;
	flex-direction: column;
	gap: 0;
	overflow-y: auto;
	max-height: 240px;
	min-height: 0;
}

.cm-collab-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 10px;
}

.cm-collab-name {
	font-size: 14px;
	color: #000;
}

.cm-collab-remove {
	border: none;
	background: transparent;
	color: #9ca3af;
	font-size: 16px;
	cursor: pointer;
	padding: 2px 6px;
	line-height: 1;
}

.cm-collab-remove:hover {
	color: #dc2626;
}

/* Delete Breed modal */

#deleteBreedModal .modal-message { margin-bottom: 10px; }

/* DlgView (editor JS confirm/alert) */

#dlgViewModal .modal-panel { width: min(400px, calc(100vw - 32px)); padding: 14px 14px 12px; }
#dlgViewModal .modal-header { margin-bottom: 4px; }

#dlgViewModal .dlg-body {
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.5;
	color: #374151;
}

#dlgViewModal .modal-btn-cancel {
	background: #e5e7eb;
	color: #1f2937;
}

#dlgViewModal .modal-btn-confirm {
	background: #ef4444;
	color: #fff;
}
