/**
 * TrustLens Admin Settings Styles
 *
 * @package TrustLens
 */

/* ==========================================================================
   Settings
   ========================================================================== */

.wstl-settings .wstl-card {
	max-width: 800px;
}

.wstl-settings .form-table th {
	width: 250px;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.wstl-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.wstl-modal.is-open {
	display: flex;
}

.wstl-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(20, 40, 62, 0.45);
	backdrop-filter: blur(4px);
}

.wstl-modal-content {
	--wstl-modal-bg: #ffffff;
	--wstl-modal-border: #d5e0eb;
	--wstl-modal-shadow: 0 14px 34px rgba(16, 42, 67, 0.08), 0 8px 20px rgba(16, 42, 67, 0.06);
	--wstl-modal-accent: linear-gradient(135deg, #1f5f8b 0%, #2a7ab8 100%);
	position: relative;
	background: var(--wstl-modal-bg);
	border: 1px solid var(--wstl-modal-border);
	border-radius: 14px;
	box-shadow: var(--wstl-modal-shadow);
	max-width: 600px;
	width: 90%;
	max-height: 85vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.wstl-modal-content::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: var(--wstl-modal-accent);
	border-radius: 14px 14px 0 0;
	pointer-events: none;
}

.wstl-modal-content .form-table,
.wstl-modal-content form {
	flex: 1;
	overflow: auto;
}

.wstl-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px;
	background: linear-gradient(138deg, #ffffff 0%, #f2f8fd 55%, #f8f6f1 100%);
	border-bottom: 1px solid var(--wstl-modal-border, #d5e0eb);
	border-radius: 14px 14px 0 0;
	flex-shrink: 0;
}

.wstl-modal-header h2 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: #14283e;
	letter-spacing: -0.02em;
}

/* Modal content that has direct h2 + form (e.g. automation rule modal) */
.wstl-modal-content > .wstl-modal-close {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 2;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(20, 40, 62, 0.06);
	border: none;
	border-radius: 10px;
	font-size: 22px;
	line-height: 1;
	color: #5b6d80;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.wstl-modal-content > .wstl-modal-close:hover {
	background: rgba(20, 40, 62, 0.12);
	color: #14283e;
}

.wstl-modal-content > h2 {
	margin: 0;
	padding: 20px 24px 16px;
	padding-right: 52px;
	font-size: 18px;
	font-weight: 700;
	color: #14283e;
	letter-spacing: -0.02em;
	background: linear-gradient(138deg, #ffffff 0%, #f2f8fd 55%, #f8f6f1 100%);
	border-bottom: 1px solid var(--wstl-modal-border, #d5e0eb);
	flex-shrink: 0;
}

.wstl-modal-content > form {
	padding: 20px 24px 24px;
}

.wstl-modal-close {
	background: rgba(20, 40, 62, 0.06);
	border: none;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	font-size: 20px;
	line-height: 1;
	color: #5b6d80;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
	flex-shrink: 0;
}

.wstl-modal-close:hover {
	background: rgba(20, 40, 62, 0.12);
	color: #14283e;
}

.wstl-modal-body {
	padding: 20px 24px 24px;
	overflow: auto;
	color: #14283e;
}

.wstl-modal-footer {
	padding: 16px 24px 20px;
	border-top: 1px solid var(--wstl-modal-border, #d5e0eb);
	text-align: right;
	background: #f8fafc;
	border-radius: 0 0 14px 14px;
	flex-shrink: 0;
}

/* ==========================================================================
   Settings Tabs
   ========================================================================== */

.wstl-settings-tabs {
	margin: 20px 0;
}

.wstl-settings-tabs .nav-tab-wrapper {
	margin-bottom: 20px;
}

.wstl-settings-tab-content {
	display: none;
}

.wstl-settings-tab-content.active {
	display: block;
}

/* ==========================================================================
   Form Enhancements
   ========================================================================== */

.wstl-form-group {
	margin-bottom: 15px;
}

.wstl-form-group label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
}

.wstl-form-group input[type="text"],
.wstl-form-group input[type="url"],
.wstl-form-group input[type="email"],
.wstl-form-group select,
.wstl-form-group textarea {
	width: 100%;
}

.wstl-checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wstl-checkbox-group label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: normal;
}

/* ==========================================================================
   Webhook & Automation Tables
   ========================================================================== */

.wstl-settings-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 15px;
}

.wstl-settings-table th,
.wstl-settings-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #eee;
}

.wstl-settings-table th {
	background: #f9f9f9;
	font-weight: 600;
}

.wstl-settings-table .actions {
	white-space: nowrap;
}

.wstl-settings-table .actions a,
.wstl-settings-table .actions button {
	margin-right: 5px;
}

/* ==========================================================================
   Status Indicators
   ========================================================================== */

.wstl-status {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
}

.wstl-status-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ccc;
}

.wstl-status-enabled .wstl-status-dot {
	background: #28a745;
}

.wstl-status-disabled .wstl-status-dot {
	background: #dc3545;
}

/* ==========================================================================
   API Documentation
   ========================================================================== */

.wstl-api-docs code {
	background: #f1f1f1;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 12px;
}

.wstl-api-endpoint {
	background: #f9f9f9;
	padding: 15px;
	border-left: 3px solid #0073aa;
	margin-bottom: 15px;
	font-family: monospace;
}

.wstl-api-method {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	margin-right: 8px;
}

.wstl-api-method-get { background: #28a745; color: #fff; }
.wstl-api-method-post { background: #0073aa; color: #fff; }
.wstl-api-method-put { background: #ffc107; color: #212529; }
.wstl-api-method-delete { background: #dc3545; color: #fff; }

/* ==========================================================================
   Danger Zone
   ========================================================================== */

.wstl-card-danger {
	border-left: 4px solid #dc3545;
}

.wstl-card-danger h2 {
	color: #dc3545;
}

/* ==========================================================================
   Data / Sync settings (views)
   ========================================================================== */

.wstl-card-dev {
	border-left: 4px solid #8e44ad;
	background: linear-gradient(135deg, #f9f9f9 0%, #f5f0f9 100%);
}

.wstl-sync-status {
	padding: 15px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
}

.wstl-sync-status .wstl-progress-bar {
	margin: 10px 0;
}

.wstl-test-data-success {
	color: #46b450;
	font-weight: 500;
}

.wstl-test-data-error {
	color: #dc3545;
	font-weight: 500;
}

/* ==========================================================================
   Automation rules (condition rows)
   ========================================================================== */

.wstl-condition-row {
	display: flex;
	gap: 8px;
	margin-bottom: 8px;
	align-items: center;
}

.wstl-condition-row select,
.wstl-condition-row input {
	margin: 0;
}

.wstl-remove-condition {
	color: #a00;
	border-color: #a00;
}
