/**
 * Frontend Documents Shortcode Styles
 * Sintacs Astero CFO Plugin
 */

.sintacs-cfo-documents-frontend {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.sintacs-cfo-dropzone {
	border: 2px dashed #c3c4c7;
	border-radius: 8px;
	padding: 30px;
	text-align: center;
	background: #fdfdfd;
	transition: border-color 0.2s, background 0.2s;
	margin-bottom: 15px;
}

.sintacs-cfo-dropzone.uploading {
	border-color: #2271b1;
	background: #f0f6fc;
}

.sintacs-cfo-dropzone.dragover {
	border-color: #2271b1;
	background: #f0f6fc;
}

.sintacs-cfo-dropzone-icon {
	font-size: 32px;
	margin-bottom: 10px;
}

.sintacs-cfo-upload-progress {
	height: 6px;
	background: #e2e4e7;
	border-radius: 999px;
	overflow: hidden;
	display: none;
}

.sintacs-cfo-upload-progress.active {
	display: block;
	margin-bottom: 10px;
}

.sintacs-cfo-upload-progress .progress-bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #2271b1, #4ab0f7);
	transition: width 0.2s ease;
}

.sintacs-cfo-upload-feedback {
	margin-top: 8px;
	font-size: 13px;
}

.sintacs-cfo-upload-feedback.success {
	color: #198754;
}

.sintacs-cfo-upload-feedback.error {
	color: #b32d2e;
}

.sintacs-cfo-upload-fallback {
	display: none;
	margin-top: 15px;
}

.sintacs-cfo-stats {
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	padding: 20px;
	border-radius: 8px;
	margin: 20px 0;
}

.sintacs-cfo-stats-compact {
	padding: 12px 16px;
	margin: 10px 0;
}

.sintacs-cfo-stats-compact h3 {
	margin: 0 0 6px 0;
	font-size: 18px;
}

.sintacs-stats-inline {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.sintacs-stat-item {
	color: #666;
	font-size: 14px;
}

.sintacs-stat-divider {
	color: #ccc;
}

.sintacs-clear-memory-btn {
	background: #dc3545;
	color: #fff;
	border: none;
	padding: 4px 12px;
	border-radius: 4px;
	font-size: 12px;
	cursor: pointer;
	margin-left: 8px;
	transition: background 0.2s;
}

.sintacs-clear-memory-btn:hover {
	background: #c82333;
}

.sintacs-clear-memory-btn:disabled {
	background: #6c757d;
	cursor: not-allowed;
}

.sintacs-cfo-stats h3 {
	margin-top: 0;
	color: #333;
}

.sintacs-cfo-stats p {
	margin: 8px 0;
	color: #666;
}

.sintacs-cfo-table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 20px 0;
}

.sintacs-cfo-documents-table {
	width: 100%;
	min-width: 600px;
	border-collapse: collapse;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	border-radius: 8px;
}

.sintacs-cfo-documents-table th,
.sintacs-cfo-documents-table td {
	white-space: nowrap;
}

.sintacs-cfo-documents-table .col-filename {
	white-space: normal;
	word-break: break-word;
	min-width: 150px;
	max-width: 250px;
}

.sintacs-cfo-documents-table .col-actions {
	min-width: 180px;
}

.sintacs-cfo-documents-table thead {
	background: #f5f5f5;
}

.sintacs-cfo-documents-table th {
	padding: 12px;
	text-align: left;
	font-weight: 600;
	color: var(--mwai-backgroundAiColor);
	border: 2px solid #fafafa;
	position: relative;
}

.sintacs-refresh-inline {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 2px 6px;
	margin-left: 8px;
	border-radius: 4px;
	vertical-align: middle;
	color: #2271b1;
	transition: background 0.2s, color 0.2s;
}

.sintacs-refresh-inline:hover {
	background: #f0f0f1;
	color: #135e96;
}

.sintacs-refresh-inline .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
}

.sintacs-cfo-documents-table td {
	padding: 12px;
	border: 1px solid #fafafa;
}

.sintacs-cfo-documents-table tbody tr:hover {
	background: #fafafa;
}

.sintacs-mime-badge {
	display: inline-block;
	background: #e8f4f8;
	color: #0073aa;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
}

.sintacs-delete-btn {
	background: #dc3545;
	color: #fff;
	border: none;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

.sintacs-delete-btn:hover {
	background: #c82333;
}

.sintacs-delete-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.sintacs-refresh-btn {
	background: #0073aa;
	color: #fff;
	border: none;
	padding: 8px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	margin-bottom: 15px;
}

.sintacs-refresh-btn:hover {
	background: #005a87;
}

.sintacs-empty-notice {
	padding: 30px;
	text-align: center;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	color: #666;
	margin-bottom: 15px;
}

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.spin {
	display: inline-block;
	animation: spin 1s linear infinite;
}

/* Upload in progress state */
.sintacs-cfo-documents-frontend.uploading-in-progress .sintacs-cfo-dropzone {
	pointer-events: none;
	opacity: 0.6;
	cursor: not-allowed;
}

.sintacs-cfo-documents-frontend.uploading-in-progress .sintacs-cfo-dropzone-content {
	opacity: 0.5;
}

.sintacs-cfo-documents-frontend.uploading-in-progress .delete-document,
.sintacs-cfo-documents-frontend.uploading-in-progress #sintacs-cfo-upload-browse {
	pointer-events: none;
	opacity: 0.5;
	cursor: not-allowed;
}

.sintacs-cfo-documents-frontend.uploading-in-progress .sintacs-cfo-upload-fallback {
	pointer-events: none;
	opacity: 0.5;
}

.sintacs-document-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.sintacs-document-actions .button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 12px;
	border-radius: 4px;
	font-size: 13px;
	cursor: pointer;
	border: 1px solid #c3c4c7;
	background: #f6f7f7;
	color: #2c3338;
	text-decoration: none;
	line-height: 1.4;
}

.sintacs-document-actions .button:hover {
	background: #f0f0f1;
	border-color: #8c8f94;
	color: #1d2327;
}

.sintacs-document-actions .button .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 1;
}

.sintacs-document-actions .delete-document {
	background: #d63638;
	border-color: #d63638;
	color: #fff;
}

.sintacs-document-actions .delete-document:hover {
	background: #b32d2e;
	border-color: #b32d2e;
	color: #fff;
}

.sintacs-toggle-metadata {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.sintacs-toggle-metadata:hover {
	background: #135e96;
	border-color: #135e96;
	color: #fff;
}

.document-debug-row td {
	background: #f9f9f9;
	padding: 15px 20px;
}

.sintacs-debug-panel {
	font-size: 13px;
}

.sintacs-debug-panel dl {
	display: grid;
	grid-template-columns: 150px 1fr;
	gap: 8px;
	margin: 10px 0 0;
}

.sintacs-debug-panel dt {
	font-weight: 600;
	color: #50575e;
}

.sintacs-debug-panel dd {
	margin: 0;
	color: #2c3338;
}

.sintacs-debug-panel code {
	font-size: 11px;
	word-break: break-all;
}

.sintacs-add-to-chat {
	background: #00a32a !important;
	border-color: #00a32a !important;
	color: #fff !important;
}

.sintacs-add-to-chat:hover {
	background: #008a20 !important;
	border-color: #008a20 !important;
	color: #fff !important;
}

.sintacs-add-to-chat.active {
	background: #d63638 !important;
	border-color: #d63638 !important;
}

.sintacs-add-to-chat.active:hover {
	background: #b32d2e !important;
	border-color: #b32d2e !important;
}

.sintacs-selected-docs-container {
	position: fixed;
	bottom: 80px;
	right: 20px;
	z-index: 99999;
	max-width: 300px;
	pointer-events: none;
}

.sintacs-selected-docs-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: flex-end;
	pointer-events: auto;
}

.sintacs-doc-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #2271b1;
	color: #fff;
	padding: 6px 10px;
	border-radius: 16px;
	font-size: 12px;
	max-width: 200px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sintacs-doc-pill-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 150px;
}

.sintacs-doc-pill-remove {
	background: rgba(255,255,255,0.3);
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 0;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	line-height: 1;
	transition: background 0.2s;
}

.sintacs-doc-pill-remove:hover {
	background: rgba(255,255,255,0.5);
}

.sintacs-selected-docs-label {
	font-size: 11px;
	color: #666;
	text-align: right;
	margin-bottom: 4px;
	pointer-events: auto;
}

#sintacs-cfo-upload-browse {
	font-size: 1rem;
}

/* AI Engine Chatbot */
.mwai-chatbot-container .mwai-input-submit,
.mwai-discussions-container .mwai-header button {
	font-size: 1rem;
}

/* Chat Upload Notification (hidden list mode) */
.sintacs-chat-notification {
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 14px;
	margin-top: 10px;
	display: flex;
	align-items: center;
	gap: 8px;
	animation: sintacs-notification-slide-in 0.3s ease-out;
}

.sintacs-chat-notification--info {
	background: #e8f4fc;
	border: 1px solid #b8daff;
	color: #004085;
}

.sintacs-chat-notification--success {
	background: #d4edda;
	border: 1px solid #c3e6cb;
	color: #155724;
}

.sintacs-chat-notification--error {
	background: #f8d7da;
	border: 1px solid #f5c6cb;
	color: #721c24;
}

.sintacs-chat-notification--fade-out {
	animation: sintacs-notification-fade-out 0.5s ease-out forwards;
}

@keyframes sintacs-notification-slide-in {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes sintacs-notification-fade-out {
	from {
		opacity: 1;
		transform: translateY(0);
	}
	to {
		opacity: 0;
		transform: translateY(-10px);
	}
}