/* Custom styles for Campaign Linker */

:root {
	--primary-color: #2a4c4e;
	--primary-hover: #1e3839;
	--secondary-color: #3d6a6d;
	--success-color: #10b981;
	--danger-color: #ef4444;
	--background-color: #f8fafc;
	--card-background: #ffffff;
	--text-primary: #1e293b;
	--text-secondary: #64748b;
	--border-color: #e2e8f0;
	--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 16px;
}

* {
	box-sizing: border-box;
}

body {
	background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #fdf2f8 100%);
	min-height: 100vh;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--text-primary);
	padding-bottom: 40px;
}

/* Loader */
.loader {
	border: 4px solid #f3f3f3;
	border-top: 4px solid var(--primary-color);
	border-radius: 50%;
	width: 48px;
	height: 48px;
	animation: spin 1s linear infinite;
	position: fixed;
	left: calc(50% - 24px);
	top: calc(50% - 24px);
	z-index: 9999;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Header */
.header-section {
	background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
	padding: 20px 0;
	margin-bottom: 40px;
	box-shadow: var(--shadow-lg);
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 20px;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 20px;
}

.customer-logo {
	width: 60px;
	height: 60px;
	background: white;
	border-radius: var(--radius-md);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-md);
	overflow: hidden;
	flex-shrink: 0;
}

.customer-logo img {
	max-width: 50px;
	max-height: 50px;
	object-fit: contain;
}

.customer-logo-placeholder {
	color: var(--text-secondary);
	font-size: 10px;
	text-align: center;
	line-height: 1.2;
}

.header-title-group h1 {
	color: white;
	font-size: 26px;
	font-weight: 700;
	margin: 0;
	line-height: 1.2;
}

.header-subtitle {
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
	margin-top: 4px;
}

.header-right {
	text-align: right;
	flex-shrink: 0;
}

/* Navigation Menu */
.header-nav {
	display: flex;
	gap: 8px;
}

.nav-link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	color: rgba(255, 255, 255, 0.8);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	border-radius: var(--radius-md);
	transition: all 0.2s ease;
	background: rgba(255, 255, 255, 0.1);
}

.nav-link:hover {
	color: white;
	background: rgba(255, 255, 255, 0.2);
	text-decoration: none;
}

.nav-link.active {
	color: white;
	background: rgba(255, 255, 255, 0.25);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-link svg {
	flex-shrink: 0;
}

.powered-by {
	color: rgba(255, 255, 255, 0.7);
	font-size: 11px;
	margin-bottom: 2px;
}

.powered-by-link {
	color: white;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.powered-by-link:hover {
	opacity: 0.85;
	color: white;
	text-decoration: underline;
}

/* Main container */
.main-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 40px;
}

/* Card styling */
.card {
	background: var(--card-background);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
	padding: 28px;
	margin-bottom: 24px;
}

.card-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: 20px;
	padding-bottom: 12px;
	border-bottom: 2px solid var(--border-color);
	display: flex;
	align-items: center;
	gap: 8px;
}

.card-title-icon {
	width: 24px;
	height: 24px;
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	font-size: 12px;
}

/* Form styling */
.form-group {
	margin-bottom: 20px;
}

.form-group label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 8px;
}

.form-control {
	width: 100%;
	padding: 12px 16px;
	font-size: 15px;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	transition: all 0.2s ease;
	background: var(--card-background);
}

.form-control:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control.is-valid {
	border-color: var(--success-color);
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310b981' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	padding-right: 44px;
}

.form-control.is-invalid {
	border-color: var(--danger-color);
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 16px;
	padding-right: 44px;
}

/* Select2 styling overrides */
.select2-container {
	width: 100% !important;
}

.select2-container--default .select2-selection--single {
	height: 48px;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	padding: 0;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
}

.select2-container--default .select2-selection--single:hover {
	border-color: var(--primary-color);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
	line-height: 44px;
	color: var(--text-primary);
	padding-left: 16px;
	padding-right: 40px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
	color: var(--text-secondary);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 100%;
	top: 0;
	right: 12px;
	display: flex;
	align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
	border-color: var(--text-secondary) transparent transparent transparent;
	border-width: 6px 5px 0 5px;
	margin-top: 0;
	margin-left: 0;
	position: static;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
	border-color: transparent transparent var(--text-secondary) transparent;
	border-width: 0 5px 6px 5px;
}

.select2-container--default.select2-container--focus .select2-selection--single {
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.select2-dropdown {
	border: 2px solid var(--border-color);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	margin-top: 4px;
}

.select2-container--default .select2-results__option {
	padding: 10px 16px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
	background-color: var(--primary-color);
}

.select2-container--default .select2-results__option[aria-selected=true] {
	background-color: #f0f4ff;
	color: var(--primary-color);
}

.select2-search--dropdown .select2-search__field {
	padding: 10px 12px;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-sm);
}

.select2-search--dropdown .select2-search__field:focus {
	outline: none;
	border-color: var(--primary-color);
}

/* Buttons */
.btn {
	padding: 12px 24px;
	font-size: 14px;
	font-weight: 600;
	border-radius: var(--radius-md);
	border: none;
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.btn-primary {
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	color: white;
	box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
	background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}

.btn-info {
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
	color: white;
	border: none;
}

.btn-info:hover {
	background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
	transform: translateY(-1px);
}

.btn-secondary {
	background: var(--card-background);
	color: var(--text-primary);
	border: 2px solid var(--border-color);
}

.btn-secondary:hover {
	background: var(--background-color);
	border-color: var(--text-secondary);
}

.btn-sm {
	padding: 8px 16px;
	font-size: 13px;
}

.showurl {
	background: var(--card-background);
	color: var(--text-primary);
	border: 2px solid var(--border-color);
	padding: 10px 20px;
}

.showurl:hover {
	background: var(--background-color);
	border-color: var(--primary-color);
	color: var(--primary-color);
}

/* Inline form groups */
.imp-wrapper {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

.imp-wrapper > div {
	flex-grow: 1;
}

/* Details/Summary styling */
details {
	background: #f8fafc;
	border: 2px dashed var(--border-color);
	border-radius: var(--radius-md);
	padding: 16px;
	margin-top: 8px;
}

details[open] {
	background: #fafafa;
	border-style: solid;
	border-color: var(--primary-color);
}

summary {
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	color: var(--primary-color);
	padding: 4px 0;
	list-style: none;
	display: flex;
	align-items: center;
	gap: 6px;
}

summary::-webkit-details-marker {
	display: none;
}

summary::before {
	content: "+";
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	background: var(--primary-color);
	color: white;
	border-radius: 50%;
	font-size: 14px;
	font-weight: 700;
}

details[open] summary::before {
	content: "−";
}

details .form-group {
	margin-top: 16px;
	margin-bottom: 12px;
}

details input[type="text"] {
	width: 100%;
	padding: 10px 12px;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-sm);
	font-size: 14px;
	margin-top: 4px;
}

details input[type="text"]:focus {
	outline: none;
	border-color: var(--primary-color);
}

details button {
	margin-top: 12px;
}

/* Delete icon */
.delete-icon {
	width: 14px;
	height: 14px;
	opacity: 0.4;
	cursor: pointer;
	transition: opacity 0.2s ease;
	vertical-align: middle;
	margin-left: 6px;
}

.delete-icon:hover {
	opacity: 1;
}

/* Alerts */
.alert {
	padding: 16px 20px;
	border-radius: var(--radius-md);
	margin-bottom: 16px;
	border: none;
}

.alert-success {
	background: linear-gradient(135deg, #d1fae5, #ecfdf5);
	color: #065f46;
	border-left: 4px solid var(--success-color);
}

.alert-danger {
	background: linear-gradient(135deg, #fee2e2, #fef2f2);
	color: #991b1b;
	border-left: 4px solid var(--danger-color);
}

.alert-secondary {
	background: linear-gradient(135deg, #e0e7ff, #f0f4ff);
	color: var(--primary-color);
	border-left: 4px solid var(--primary-color);
}

/* Table styling */
.table {
	background: var(--card-background);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	margin-top: 20px;
}

.table thead {
	background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.table thead th {
	color: white;
	font-weight: 600;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 14px 16px;
	border: none;
}

.table tbody tr {
	transition: background 0.2s ease;
}

.table tbody tr:hover {
	background: #f8fafc;
}

.table tbody td {
	padding: 14px 16px;
	vertical-align: middle;
	border-color: var(--border-color);
}

.table-light {
	background: var(--card-background);
}

/* Timestamp cell styling */
.timestamp-cell {
	color: var(--text-secondary);
	font-size: 13px;
	white-space: nowrap;
}

/* Optional section card */
.optional-section {
	background: #fafafa;
	border: 2px dashed var(--border-color);
	border-radius: var(--radius-lg);
	padding: 0;
	margin-bottom: 24px;
}

.optional-section[open] {
	border-style: solid;
	background: var(--card-background);
}

.optional-section > summary {
	padding: 16px 24px;
	font-size: 14px;
	color: var(--text-secondary);
	margin: 0;
}

.optional-section[open] > summary {
	border-bottom: 1px solid var(--border-color);
	margin-bottom: 20px;
}

.optional-section .form-group {
	padding: 0 24px;
}

.optional-section .form-group:last-child {
	padding-bottom: 24px;
}

/* URL buttons section */
.url-buttons {
	display: flex;
	gap: 12px;
	margin-bottom: 20px;
	flex-wrap: wrap;
	align-items: center;
}

/* Sort controls */
.sort-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	font-size: 14px;
	color: var(--text-secondary);
}

.sort-controls label {
	font-weight: 500;
	white-space: nowrap;
}

.sort-controls select {
	padding: 8px 12px;
	border: 2px solid var(--border-color);
	border-radius: var(--radius-sm);
	font-size: 14px;
	background: var(--card-background);
	color: var(--text-primary);
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.sort-controls select:hover {
	border-color: var(--primary-color);
}

.sort-controls select:focus {
	outline: none;
	border-color: var(--primary-color);
}

/* Message section */
#message_step {
	margin-bottom: 24px;
}

#message_step .alert {
	word-break: break-word;
}

/* Generated URL display */
#generatedurl {
	font-family: 'Monaco', 'Menlo', monospace;
	font-size: 13px;
	background: rgba(255, 255, 255, 0.5);
	padding: 4px 8px;
	border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
	.main-container {
		padding: 0 24px;
	}
}

@media (max-width: 768px) {
	.main-container {
		padding: 0 16px;
	}

	.imp-wrapper {
		flex-direction: column;
	}

	.imp-wrapper > div {
		width: 100% !important;
	}

	.header-content {
		flex-direction: column;
		gap: 16px;
	}

	.header-left {
		width: 100%;
		justify-content: center;
	}

	.header-right {
		width: 100%;
	}

	.header-nav {
		justify-content: center;
	}

	.header-section h1 {
		font-size: 22px;
	}

	.card {
		padding: 20px;
	}

	.url-buttons {
		flex-direction: column;
	}

	.url-buttons .btn {
		width: 100%;
	}

	.sort-controls {
		width: 100%;
		margin-left: 0;
		justify-content: space-between;
	}
}

/* Action buttons in table */
.table .btn {
	padding: 6px 14px;
	font-size: 12px;
}

/* Toast notifications */
.toast-notification {
	position: fixed;
	top: 20px;
	right: 20px;
	padding: 16px 20px;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	display: flex;
	align-items: center;
	gap: 12px;
	z-index: 10000;
	animation: slideIn 0.3s ease;
	max-width: 400px;
}

.toast-error {
	background: linear-gradient(135deg, #fee2e2, #fef2f2);
	color: #991b1b;
	border-left: 4px solid var(--danger-color);
}

.toast-success {
	background: linear-gradient(135deg, #d1fae5, #ecfdf5);
	color: #065f46;
	border-left: 4px solid var(--success-color);
}

.toast-message {
	flex: 1;
	font-size: 14px;
	font-weight: 500;
}

.toast-close {
	background: none;
	border: none;
	font-size: 20px;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s ease;
	padding: 0;
	line-height: 1;
}

.toast-close:hover {
	opacity: 1;
}

@keyframes slideIn {
	from {
		transform: translateX(100%);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}
