/**
 * Styles for Backoffice Internal Messaging.
 */

:root {
	--bo-primary: #6366f1;
	--bo-primary-hover: #4f46e5;
	--bo-primary-light: #e0e7ff;
	--bo-success: #10b981;
	--bo-danger: #ef4444;
	--bo-danger-hover: #dc2626;
	--bo-warning: #f59e0b;
	--bo-bg-card: #ffffff;
	--bo-bg-app: #f8fafc;
	--bo-text-main: #1e293b;
	--bo-text-muted: #64748b;
	--bo-border: #e2e8f0;
	--bo-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--bo-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
	--bo-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
	--bo-radius: 12px;
	--bo-radius-sm: 6px;
	--bo-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.bo-messaging-wrap {
	margin: 20px 20px 0 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.bo-messaging-container {
	display: flex;
	gap: 20px;
	margin-top: 20px;
	min-height: 600px;
	align-items: stretch;
}

/* Sidebar Styling */
.bo-messaging-sidebar {
	width: 260px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.bo-btn-compose {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: linear-gradient(135deg, var(--bo-primary) 0%, #4f46e5 100%) !important;
	border-color: transparent !important;
	color: #fff !important;
	border-radius: var(--bo-radius) !important;
	font-weight: 600 !important;
	text-shadow: none !important;
	height: 46px !important;
	line-height: 44px !important;
	font-size: 14px !important;
	box-shadow: var(--bo-shadow-md) !important;
	transition: var(--bo-transition) !important;
	cursor: pointer;
}

.bo-btn-compose:hover {
	transform: translateY(-1px);
	box-shadow: var(--bo-shadow-lg) !important;
	background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
}

.bo-btn-compose .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 18px;
}

.bo-messaging-nav {
	background: var(--bo-bg-card);
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius);
	padding: 8px;
	margin: 0;
	list-style: none;
	box-shadow: var(--bo-shadow-sm);
}

.bo-messaging-nav li {
	margin-bottom: 4px;
}

.bo-messaging-nav li:last-child {
	margin-bottom: 0;
}

.bo-messaging-nav a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	color: var(--bo-text-main);
	text-decoration: none;
	border-radius: var(--bo-radius-sm);
	font-weight: 500;
	transition: var(--bo-transition);
	position: relative;
}

.bo-messaging-nav a:focus {
	box-shadow: none;
}

.bo-messaging-nav li.active a,
.bo-messaging-nav a:hover {
	background: var(--bo-primary-light);
	color: var(--bo-primary-hover);
}

.bo-messaging-nav li.active a {
	font-weight: 600;
}

.bo-unread-badge {
	position: absolute;
	right: 12px;
	background: var(--bo-danger);
	color: white;
	font-size: 11px;
	font-weight: bold;
	padding: 2px 7px;
	border-radius: 10px;
	line-height: 1;
}

/* Content Area */
.bo-messaging-content {
	flex-grow: 1;
	background: var(--bo-bg-card);
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius);
	box-shadow: var(--bo-shadow-sm);
	padding: 24px;
	position: relative;
	min-width: 0; /* Prevents flex items from overflowing */
}

/* Panel Titles & Headers */
.bo-view-panel {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.bo-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid var(--bo-border);
	padding-bottom: 16px;
	margin-bottom: 20px;
	gap: 15px;
}

.bo-panel-title {
	font-size: 20px;
	font-weight: 700;
	margin: 0;
	color: var(--bo-text-main);
}

.bo-panel-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

#bo-search {
	border-radius: var(--bo-radius-sm);
	border: 1px solid var(--bo-border);
	padding: 6px 12px;
	font-size: 13px;
	width: 220px;
	transition: var(--bo-transition);
}

#bo-search:focus {
	border-color: var(--bo-primary);
	box-shadow: 0 0 0 2px var(--bo-primary-light);
	outline: none;
}

#bo-btn-refresh {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 32px;
	width: 32px;
	padding: 0 !important;
	border-radius: var(--bo-radius-sm);
	cursor: pointer;
}

/* Messages Table */
.bo-messages-list-wrapper {
	overflow-x: auto;
}

.bo-messages-table {
	border: none !important;
	box-shadow: none !important;
}

.bo-messages-table thead th {
	background: #f8fafc;
	font-weight: 600;
	color: var(--bo-text-muted);
	border-bottom: 1px solid var(--bo-border) !important;
	padding: 12px 8px !important;
}

.bo-messages-table tbody tr {
	cursor: pointer;
	transition: var(--bo-transition);
}

.bo-messages-table tbody tr:hover {
	background-color: var(--bo-primary-light) !important;
}

.bo-messages-table td {
	padding: 14px 8px !important;
	vertical-align: middle !important;
	color: var(--bo-text-main);
}

.bo-messages-table tr.unread td {
	font-weight: 700;
	color: #000;
}

.bo-messages-table tr.unread .column-subject::before {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	background-color: var(--bo-primary);
	border-radius: 50%;
	margin-right: 8px;
}

.bo-messages-table .column-sender {
	width: 25%;
}

.bo-messages-table .column-date {
	width: 20%;
	color: var(--bo-text-muted);
	font-size: 12px;
}

.bo-messages-table .column-actions {
	width: 60px;
	text-align: right;
}

.bo-messages-table .column-subject {
	display: flex;
	align-items: center;
	gap: 6px;
}

.bo-messages-table .subject-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bo-messages-table .subject-preview {
	font-weight: normal;
	color: var(--bo-text-muted);
	margin-left: 8px;
}

.bo-attachment-icon {
	color: var(--bo-text-muted);
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.bo-row-action-delete {
	background: transparent;
	border: none;
	color: var(--bo-text-muted);
	cursor: pointer;
	padding: 4px;
	border-radius: 4px;
	display: inline-flex;
	align-items: center;
	transition: var(--bo-transition);
}

.bo-row-action-delete:hover {
	color: var(--bo-danger);
	background: #fee2e2;
}

/* Empty State / Spinner */
.no-items {
	color: var(--bo-text-muted);
}

/* Pagination */
.bo-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin-top: 20px;
	padding-top: 15px;
	border-top: 1px solid var(--bo-border);
}

.bo-pagination button {
	padding: 5px 12px !important;
	min-height: 30px !important;
	border-radius: var(--bo-radius-sm) !important;
}

/* Message Read Pane */
.bo-read-actions {
	display: flex;
	gap: 8px;
}

.bo-btn-back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 12px !important;
	height: 32px !important;
	line-height: 30px !important;
	border-radius: var(--bo-radius-sm) !important;
}

.bo-message-details {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.bo-message-subject {
	font-size: 22px;
	font-weight: 700;
	margin: 0;
	color: var(--bo-text-main);
	line-height: 1.3;
}

.bo-message-meta {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #f8fafc;
	padding: 12px 16px;
	border-radius: var(--bo-radius-sm);
	border: 1px solid var(--bo-border);
}

.bo-meta-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--bo-primary-light);
	color: var(--bo-primary-hover);
	display: flex;
	align-items: center;
	justify-content: center;
}

.bo-meta-avatar .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.bo-meta-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 13px;
	color: var(--bo-text-main);
}

.bo-meta-date {
	font-size: 11px;
	color: var(--bo-text-muted);
	margin-top: 2px;
}

.bo-message-body {
	font-size: 14px;
	line-height: 1.6;
	color: var(--bo-text-main);
	padding: 10px 4px;
	white-space: pre-wrap;
	border-bottom: 1px solid var(--bo-border);
	padding-bottom: 20px;
}

/* Attachments Area */
.bo-message-attachments-section {
	margin-top: 15px;
}

.bo-message-attachments-section h3 {
	font-size: 15px;
	font-weight: 600;
	color: var(--bo-text-main);
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.bo-message-attachments-section h3 .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.bo-attachments-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 12px;
}

.bo-attachment-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius-sm);
	background: #ffffff;
	text-decoration: none !important;
	color: var(--bo-text-main) !important;
	transition: var(--bo-transition);
}

.bo-attachment-card:hover {
	border-color: var(--bo-primary);
	background: var(--bo-primary-light);
	transform: translateY(-1px);
	box-shadow: var(--bo-shadow-sm);
}

.bo-attachment-icon-box {
	font-size: 24px;
	color: var(--bo-primary);
	display: flex;
	align-items: center;
}

.bo-attachment-icon-box .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.bo-attachment-info {
	display: flex;
	flex-direction: column;
	min-width: 0; /* Handles text clipping */
}

.bo-attachment-name {
	font-weight: 600;
	font-size: 12px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bo-attachment-size {
	font-size: 10px;
	color: var(--bo-text-muted);
}

/* Compose Pane Styling */
#bo-compose-form table {
	border-collapse: collapse;
}

#bo-compose-form td,
#bo-compose-form th {
	padding: 15px 10px !important;
}

.bo-select2 {
	padding: 6px !important;
	border-radius: var(--bo-radius-sm);
	height: auto !important;
	font-size: 14px !important;
}

#bo-field-subject {
	border-radius: var(--bo-radius-sm);
	padding: 8px 12px;
	font-size: 14px;
}

#bo-field-message {
	border-radius: var(--bo-radius-sm);
	padding: 12px;
	font-size: 14px;
	line-height: 1.5;
	resize: vertical;
}

.required {
	color: var(--bo-danger);
}

/* Drag & Drop File Upload Area */
.bo-dragdrop-zone {
	border: 2px dashed var(--bo-border);
	background: #f8fafc;
	border-radius: var(--bo-radius);
	padding: 30px 20px;
	text-align: center;
	cursor: pointer;
	transition: var(--bo-transition);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.bo-dragdrop-zone:hover,
.bo-dragdrop-zone.dragover {
	border-color: var(--bo-primary);
	background: var(--bo-primary-light);
	color: var(--bo-primary-hover);
}

.bo-dragdrop-zone .dashicons {
	font-size: 38px;
	width: 38px;
	height: 38px;
	color: var(--bo-text-muted);
	transition: var(--bo-transition);
}

.bo-dragdrop-zone:hover .dashicons,
.bo-dragdrop-zone.dragover .dashicons {
	color: var(--bo-primary);
	transform: translateY(-2px);
}

.bo-dragdrop-zone p {
	font-weight: 600;
	margin: 0;
	font-size: 14px;
}

.bo-dragdrop-info {
	font-size: 11px;
	color: var(--bo-text-muted);
}

/* Selected Files Listing */
.bo-selected-files {
	margin-top: 15px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bo-selected-file-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	background: #f1f5f9;
	border-radius: var(--bo-radius-sm);
	font-size: 12px;
	animation: slideIn 0.2s ease-out;
}

.bo-selected-file-info {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
}

.bo-file-remove {
	background: none;
	border: none;
	color: var(--bo-text-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2px;
	border-radius: 50%;
	transition: var(--bo-transition);
}

.bo-file-remove:hover {
	color: var(--bo-danger);
	background: #fee2e2;
}

/* File Upload Progress Bar */
.bo-upload-progress-container {
	margin-top: 15px;
	background: var(--bo-border);
	border-radius: 10px;
	height: 16px;
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bo-progress-bar {
	background: linear-gradient(90deg, var(--bo-primary) 0%, #3b82f6 100%);
	height: 100%;
	width: 0;
	position: absolute;
	left: 0;
	top: 0;
	transition: width 0.1s ease-out;
}

.bo-progress-text {
	position: relative;
	font-size: 10px;
	font-weight: bold;
	color: #1e293b;
	z-index: 2;
}

/* Alert notices formatting */
.bo-alert {
	padding: 12px 16px;
	border-radius: var(--bo-radius-sm);
	margin-bottom: 20px;
	font-weight: 500;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	animation: fadeIn 0.3s ease-out;
}

.bo-alert-success {
	background: #d1fae5;
	color: #065f46;
	border-left: 4px solid #10b981;
}

.bo-alert-error {
	background: #fee2e2;
	color: #991b1b;
	border-left: 4px solid #ef4444;
}

.bo-alert-close {
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	font-size: 16px;
	font-weight: bold;
	padding: 0 4px;
}

/* Animations */
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
	from { opacity: 0; transform: translateX(-10px); }
	to { opacity: 1; transform: translateX(0); }
}

/* Multi-recipients Styling */
.bo-recipients-container {
	max-width: 500px;
	background: #f8fafc;
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius);
	padding: 12px;
}

#bo-recipient-search {
	border-radius: var(--bo-radius-sm);
	border: 1px solid var(--bo-border);
	padding: 8px 12px;
	font-size: 13px;
	width: 100%;
	box-sizing: border-box;
}

#bo-recipient-search:focus {
	border-color: var(--bo-primary);
	box-shadow: 0 0 0 2px var(--bo-primary-light);
	outline: none;
}

.bo-recipients-actions {
	display: flex;
	gap: 6px;
	margin-top: 8px;
}

.bo-recipients-list {
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius-sm);
	max-height: 160px;
	overflow-y: auto;
	padding: 8px;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 8px;
}

.bo-recipient-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: var(--bo-radius-sm);
	cursor: pointer;
	transition: var(--bo-transition);
	margin: 0;
	line-height: 1.4;
}

.bo-recipient-item:hover {
	background: var(--bo-primary-light);
}

.bo-recipient-checkbox {
	margin: 0 !important;
}

.bo-recipient-name {
	font-weight: 600;
	font-size: 13px;
	color: var(--bo-text-main);
}

.bo-recipient-email {
	font-size: 11px;
	color: var(--bo-text-muted);
}

/* Glassmorphic Login Form Styles */
.bo-login-container {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 40px 20px;
	background: #f1f5f9;
	border-radius: var(--bo-radius);
	margin: 30px auto;
	max-width: 450px;
	box-shadow: var(--bo-shadow-md);
}

.bo-login-form {
	background: #ffffff;
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius);
	padding: 30px;
	width: 100%;
	box-sizing: border-box;
	box-shadow: var(--bo-shadow-sm);
}

.bo-login-header {
	text-align: center;
	margin-bottom: 25px;
}

.bo-login-header .dashicons {
	font-size: 40px;
	width: 40px;
	height: 40px;
	color: var(--bo-primary);
	margin-bottom: 10px;
}

.bo-login-header h2 {
	margin: 0 0 6px 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--bo-text-main);
}

.bo-login-header p {
	margin: 0;
	font-size: 13px;
	color: var(--bo-text-muted);
}

.bo-login-field {
	margin-bottom: 18px;
}

.bo-login-field label {
	display: block;
	font-weight: 600;
	font-size: 13px;
	color: var(--bo-text-main);
	margin-bottom: 6px;
}

.bo-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.bo-input-wrapper .dashicons {
	position: absolute;
	left: 12px;
	color: var(--bo-text-muted);
}

.bo-input-wrapper input {
	width: 100%;
	padding: 10px 12px 10px 38px !important;
	border: 1px solid var(--bo-border);
	border-radius: var(--bo-radius-sm);
	font-size: 14px;
	transition: var(--bo-transition);
	box-sizing: border-box;
	height: 42px !important;
}

.bo-input-wrapper input:focus {
	border-color: var(--bo-primary);
	box-shadow: 0 0 0 2px var(--bo-primary-light);
	outline: none;
}

.bo-login-options {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 22px;
	font-size: 13px;
}

.bo-rememberme {
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	color: var(--bo-text-muted);
	margin: 0;
}

.bo-rememberme input {
	margin: 0 !important;
}

.bo-btn-login {
	width: 100%;
	background: linear-gradient(135deg, var(--bo-primary) 0%, #4f46e5 100%);
	border: none;
	color: white;
	padding: 12px;
	border-radius: var(--bo-radius-sm);
	font-weight: bold;
	font-size: 14px;
	cursor: pointer;
	transition: var(--bo-transition);
	box-shadow: var(--bo-shadow-sm);
}

.bo-btn-login:hover {
	background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
	transform: translateY(-1px);
	box-shadow: var(--bo-shadow-md);
}

.bo-login-error-notice {
	background: #fee2e2;
	border-left: 4px solid var(--bo-danger);
	padding: 10px 12px;
	border-radius: var(--bo-radius-sm);
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 20px;
	color: #991b1b;
	font-size: 13px;
}

.bo-login-error-notice .dashicons {
	color: var(--bo-danger);
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.bo-login-error-notice p {
	margin: 0;
	font-weight: 500;
}
