/**
 * Wiz Core CRM - Admin Styling
 */

.wiz-crm-wrap {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: #1e293b;
	margin: 20px 20px 0 0;
}

/* Header */
.wiz-crm-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
	flex-wrap: wrap;
	gap: 16px;
}

.wiz-crm-title {
	font-size: 26px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 4px 0;
	line-height: 1.2;
}

.wiz-crm-subtitle {
	font-size: 14px;
	color: #64748b;
	margin: 0;
}

.wiz-crm-header-actions {
	display: flex;
	gap: 10px;
	align-items: center;
}

.wiz-crm-header-actions .button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-weight: 500;
}

/* Stat Cards */
.wiz-crm-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.wiz-crm-stat-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 20px;
	display: flex;
	align-items: center;
	gap: 16px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wiz-crm-stat-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.stat-icon {
	width: 48px;
	height: 48px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.stat-icon .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
}

.stat-icon-blue   { background: #eff6ff; color: #2563eb; }
.stat-icon-amber  { background: #fef3c7; color: #d97706; }
.stat-icon-green  { background: #ecfdf5; color: #059669; }
.stat-icon-purple { background: #f5f3ff; color: #7c3aed; }

.stat-val {
	font-size: 24px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.1;
}

.stat-label {
	font-size: 13px;
	color: #64748b;
	margin-top: 4px;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Grids */
.wiz-crm-grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

@media (max-width: 900px) {
	.wiz-crm-grid-2 {
		grid-template-columns: 1fr;
	}
}

/* Cards */
.wiz-crm-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	margin-bottom: 24px;
	overflow: hidden;
}

.wiz-crm-card-header {
	padding: 16px 20px;
	border-bottom: 1px solid #f1f5f9;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.wiz-crm-card-header h2 {
	font-size: 16px;
	font-weight: 600;
	color: #0f172a;
	margin: 0;
}

.wiz-crm-card-body {
	padding: 20px;
}

/* Tables */
.wiz-crm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.wiz-crm-table th {
	text-align: left;
	padding: 12px 16px;
	background: #f8fafc;
	color: #475569;
	font-weight: 600;
	border-bottom: 1px solid #e2e8f0;
}

.wiz-crm-table td {
	padding: 12px 16px;
	border-bottom: 1px solid #f1f5f9;
	vertical-align: middle;
}

.wiz-crm-table tr:hover td {
	background: #f8fafc;
}

.wiz-crm-meta-sub {
	font-size: 12px;
	color: #64748b;
	margin-top: 2px;
}

/* Badges */
.wiz-crm-badge {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 9999px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: #f1f5f9;
	color: #475569;
}

.badge-lead        { background: #dbeafe; color: #1e40af; }
.badge-prospect    { background: #ede9fe; color: #6b21a8; }
.badge-opportunity { background: #fef3c7; color: #92400e; }
.badge-customer    { background: #dcfce7; color: #166534; }
.badge-inactive    { background: #f1f5f9; color: #64748b; }
.badge-lost        { background: #fee2e2; color: #991b1b; }
.badge-danger      { background: #fee2e2; color: #dc2626; }
.badge-high        { background: #fee2e2; color: #b91c1c; }
.badge-low         { background: #f1f5f9; color: #64748b; }

.text-danger { color: #dc2626 !important; }
.font-bold   { font-weight: 700; }

/* Filter Bar */
.wiz-crm-filter-bar {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 12px 16px;
	margin-bottom: 16px;
}

/* Form inputs */
.wiz-crm-form-group {
	margin-bottom: 16px;
}

.wiz-crm-form-group label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
}

.wiz-crm-form-group input[type="text"],
.wiz-crm-form-group input[type="email"],
.wiz-crm-form-group input[type="tel"],
.wiz-crm-form-group input[type="url"],
.wiz-crm-form-group input[type="number"],
.wiz-crm-form-group input[type="date"],
.wiz-crm-form-group select,
.wiz-crm-form-group textarea {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 14px;
	box-sizing: border-box;
}

.wiz-crm-form-row-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

/* Kanban Board */
.wiz-crm-kanban-board {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
	align-items: start;
	overflow-x: auto;
	padding-bottom: 20px;
}

.kanban-col {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	min-height: 400px;
	display: flex;
	flex-direction: column;
}

.kanban-col-header {
	padding: 12px 14px;
	background: #ffffff;
	border-bottom: 1px solid #e2e8f0;
	border-top: 4px solid #3b82f6;
	border-top-left-radius: 7px;
	border-top-right-radius: 7px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.col-title {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
}

.col-total {
	font-size: 12px;
	color: #64748b;
	margin-top: 2px;
}

.col-count {
	background: #f1f5f9;
	color: #475569;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 9999px;
}

.kanban-cards-wrapper {
	padding: 12px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.kanban-card {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	padding: 12px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	cursor: grab;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kanban-card:hover {
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.card-title {
	font-weight: 600;
	font-size: 13px;
	color: #0f172a;
	margin-bottom: 4px;
}

.card-value {
	font-weight: 700;
	font-size: 14px;
	color: #059669;
	margin-bottom: 8px;
}

.card-contact, .card-date {
	font-size: 12px;
	color: #64748b;
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 2px;
}

.card-contact .dashicons, .card-date .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
}

.card-actions {
	margin-top: 10px;
	padding-top: 8px;
	border-top: 1px solid #f1f5f9;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.card-actions select {
	font-size: 11px;
	padding: 2px 6px;
	height: auto;
}

.card-delete {
	color: #ef4444;
	text-decoration: none;
}

.card-delete .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.kanban-empty {
	text-align: center;
	color: #94a3b8;
	font-size: 12px;
	padding: 30px 10px;
}

/* Tasks list */
.wiz-crm-task-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wiz-crm-task-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f1f5f9;
}

.wiz-crm-task-item:last-child {
	border-bottom: none;
}

.task-checkbox {
	color: #94a3b8;
	text-decoration: none;
	margin-top: 2px;
}

.task-checkbox:hover {
	color: #10b981;
}

.task-title {
	font-size: 13px;
	font-weight: 600;
	color: #1e293b;
}

.task-meta {
	font-size: 12px;
	color: #64748b;
	margin-top: 3px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.task-meta .dashicons {
	font-size: 13px;
	width: 13px;
	height: 13px;
}

.task-row-done td {
	opacity: 0.6;
}

/* Timeline */
.wiz-crm-timeline {
	position: relative;
	padding-left: 28px;
}

.wiz-crm-timeline:before {
	content: '';
	position: absolute;
	left: 12px;
	top: 6px;
	bottom: 6px;
	width: 2px;
	background: #e2e8f0;
}

.wiz-crm-timeline-item {
	position: relative;
	margin-bottom: 20px;
}

.timeline-badge {
	position: absolute;
	left: -28px;
	top: 0;
	width: 24px;
	height: 24px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
}

.timeline-body {
	background: #f8fafc;
	border: 1px solid #f1f5f9;
	border-radius: 6px;
	padding: 10px 14px;
}

.timeline-date {
	font-size: 11px;
	color: #94a3b8;
	margin-bottom: 4px;
}

.timeline-text {
	font-size: 13px;
	color: #334155;
}

/* Empty states */
.wiz-crm-empty {
	text-align: center;
	padding: 30px 16px;
	color: #64748b;
	font-size: 14px;
	margin: 0;
}

.wiz-crm-link {
	font-size: 13px;
	text-decoration: none;
	color: #2563eb;
	font-weight: 500;
}

.wiz-crm-detail-row {
	display: flex;
	justify-content: space-between;
	padding: 8px 0;
	border-bottom: 1px solid #f8fafc;
	font-size: 13px;
}

.detail-label {
	color: #64748b;
	font-weight: 500;
}

.detail-val {
	font-weight: 600;
	color: #0f172a;
}

/* ==========================================================================
   Live chat console
   ========================================================================== */

.wiz-chat-console {
	display: grid;
	grid-template-columns: minmax(260px, 340px) 1fr;
	gap: 16px;
	align-items: start;
	margin-top: 10px;
}

.wiz-chat-console__items {
	margin: 0;
	padding: 0;
	list-style: none;
	max-height: 620px;
	overflow-y: auto;
}

.wiz-chat-console__item {
	border-bottom: 1px solid #f1f5f9;
}

.wiz-chat-console__item a {
	display: block;
	padding: 12px 16px;
	text-decoration: none;
	color: inherit;
}

.wiz-chat-console__item.is-active {
	background: #eff6ff;
	box-shadow: inset 3px 0 0 #2563eb;
}

.wiz-chat-console__item:hover {
	background: #f8fafc;
}

.wiz-chat-console__who {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	color: #0f172a;
}

.wiz-chat-console__status {
	display: inline-block;
	margin-top: 4px;
	font-size: 12px;
	color: #475569;
}

.wiz-chat-console__status.status-waiting {
	color: #b45309;
	font-weight: 600;
}

.wiz-chat-console__status.status-live {
	color: #047857;
	font-weight: 600;
}

.wiz-chat-console__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	padding: 10px 16px;
	background: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
	font-size: 13px;
}

.wiz-chat-console__actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.wiz-chat-console__log {
	max-height: 460px;
	overflow-y: auto;
	padding: 16px;
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wiz-chat-console__msg {
	display: flex;
}

.wiz-chat-console__msg.sender-visitor {
	justify-content: flex-start;
}

.wiz-chat-console__msg.sender-agent,
.wiz-chat-console__msg.sender-bot {
	justify-content: flex-end;
}

.wiz-chat-console__bubble {
	max-width: 74%;
	padding: 10px 12px;
	border-radius: 10px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sender-agent .wiz-chat-console__bubble {
	background: #eff6ff;
	border-color: #bfdbfe;
}

.sender-system .wiz-chat-console__bubble {
	background: #fef3c7;
	border-color: #fde68a;
}

.wiz-chat-console__sender {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #64748b;
}

.wiz-chat-console__body {
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.wiz-chat-console__time {
	font-size: 11px;
	color: #94a3b8;
}

.wiz-chat-console__reply {
	padding: 16px;
	border-top: 1px solid #e2e8f0;
}

.wiz-chat-console__reply textarea {
	width: 100%;
	margin-bottom: 10px;
}

.wiz-chat-console__closed {
	padding: 16px;
	border-top: 1px solid #e2e8f0;
	color: #64748b;
}

@media (max-width: 960px) {
	.wiz-chat-console {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   Chatbot conversation-flow editor
   ========================================================================== */

.wiz-bot-step {
	border: 1px solid #e2e8f0;
	border-left: 4px solid #2563eb;
	border-radius: 8px;
	padding: 16px;
	margin-bottom: 14px;
	background: #ffffff;
}

.wiz-bot-step__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.wiz-bot-step__title {
	color: #0f172a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wiz-crm-code {
	display: inline-block;
	padding: 8px 12px;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	font-family: Consolas, Monaco, monospace;
	font-size: 13px;
	color: #0f172a;
}
