/**
 * TI Companies Frontend Forms Styles
 * Modern styling matching ti-theme design system
 * Uses HSL color variables with dark mode support
 *
 * @package TI\Companies
 */

/* ============================================
   CSS Custom Properties (inherited from ti-theme)
   Fallback values if theme hasn't loaded
   ============================================ */
:root {
	/* Background & Foreground */
	--background: 210 20% 98%;
	--foreground: 217 33% 17%;

	/* Card & Surfaces */
	--card: 0 0% 100%;
	--card-foreground: 217 33% 17%;

	/* Primary Brand */
	--primary: 218 52% 21%;
	--primary-foreground: 0 0% 98%;
	--primary-fill: 218 52% 21%;

	/* Secondary */
	--secondary: 217 26% 50%;
	--secondary-foreground: 0 0% 98%;

	/* Muted */
	--muted: 210 40% 96%;
	--muted-foreground: 215 16% 47%;

	/* Status Colors */
	--success: 142 76% 36%;
	--success-foreground: 0 0% 100%;
	--info: 217 91% 35%;
	--info-foreground: 0 0% 100%;
	--warning: 45 93% 47%;
	--warning-foreground: 217 33% 17%;
	--destructive: 0 84% 60%;
	--destructive-foreground: 0 0% 98%;

	/* UI Elements */
	--border: 214 32% 91%;
	--input: 214 32% 91%;
	--ring: 217 91% 20%;

	/* Links */
	--link: 217 91% 35%;
	--link-hover: 217 91% 25%;

	/* Border Radius */
	--radius: 0.5rem;
	--radius-sm: 0.25rem;
	--radius-full: 9999px;
}

/* Dark mode overrides */
.dark {
	--background: 217 91% 8%;
	--foreground: 0 0% 98%;
	--card: 217 80% 12%;
	--card-foreground: 0 0% 98%;
	--primary: 217 50% 20%;
	--primary-foreground: 0 0% 98%;
	--primary-fill: 217 91% 70%;
	--secondary: 217 26% 50%;
	--secondary-foreground: 0 0% 98%;
	--muted: 217 50% 20%;
	--muted-foreground: 217 20% 70%;
	--success: 142 76% 45%;
	--success-foreground: 0 0% 100%;
	--info: 217 91% 60%;
	--info-foreground: 0 0% 100%;
	--warning: 45 93% 55%;
	--warning-foreground: 217 33% 17%;
	--destructive: 0 63% 50%;
	--destructive-foreground: 0 0% 98%;
	--border: 217 40% 25%;
	--input: 217 40% 20%;
	--ring: 217 91% 35%;
	--link: 210 100% 75%;
	--link-hover: 210 100% 85%;
}

/* ============================================
   Main Form Wrapper
   ============================================ */

.ti-frontend-form-wrapper {
	margin: 0 auto;
	padding: 1.5rem;
}

/* ============================================
   Credit Balance Box
   ============================================ */

.ti-credit-balance-box {
	background: hsl(var(--muted));
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	padding: 1.25rem;
	margin-bottom: 1.5rem;
}

.ti-credit-balance-box h4 {
	margin: 0 0 1rem 0;
	color: hsl(var(--foreground));
	font-size: 1rem;
	font-weight: 600;
}

.ti-credit-info {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.ti-credit-balance {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.9375rem;
}

.ti-credit-label {
	color: hsl(var(--muted-foreground));
	font-weight: 500;
}

.ti-credit-count {
	font-weight: 700;
	padding: 0.5rem 1rem;
	border-radius: var(--radius-sm);
	background: hsl(var(--card));
}

.ti-credit-count.has-credits {
	color: hsl(var(--success));
	border: 2px solid hsl(var(--success));
}

.ti-credit-count.no-credits {
	color: hsl(var(--destructive));
	border: 2px solid hsl(var(--destructive));
}

.ti-credit-count.admin-unlimited {
	color: hsl(var(--primary-fill));
	border: 2px solid hsl(var(--primary-fill));
	font-size: 1rem;
}

.ti-credit-warning {
	background: hsl(var(--destructive) / 0.1);
	border: 1px solid hsl(var(--destructive) / 0.3);
	color: hsl(var(--destructive));
	padding: 0.75rem;
	border-radius: var(--radius-sm);
}

.ti-credit-warning strong {
	color: hsl(var(--destructive));
}

.ti-credit-note {
	color: hsl(var(--muted-foreground));
	font-size: 0.8125rem;
	line-height: 1.6;
}

.ti-admin-notice {
	background: hsl(var(--info) / 0.1);
	border-color: hsl(var(--info) / 0.3);
}

.ti-admin-notice .ti-credit-info {
	gap: 0.5rem;
}

/* ============================================
   Form Header
   ============================================ */

.ti-form-header {
	border-bottom: 1px solid hsl(var(--border));
	padding-bottom: 1rem;
	margin-bottom: 1.5rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.ti-form-header h3 {
	margin: 0;
	color: hsl(var(--foreground));
	font-size: 1.5rem;
	font-weight: 600;
}

/* Selector Header */
.ti-selector-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.25rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid hsl(var(--border));
}

.ti-selector-header h3 {
	margin: 0;
	color: hsl(var(--foreground));
	font-size: 1.25rem;
	font-weight: 600;
}

.ti-back-link {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	color: hsl(var(--muted-foreground));
	text-decoration: none;
	font-size: 0.875rem;
	transition: color 0.2s ease;
}

.ti-back-link:hover {
	color: hsl(var(--link));
}

/* ============================================
   Company & Job Selector
   ============================================ */

.ti-company-selector h3 {
	margin-bottom: 0.75rem;
	color: hsl(var(--foreground));
}

.ti-form-description {
	margin-bottom: 1.5rem;
	color: hsl(var(--muted-foreground));
	font-size: 0.9375rem;
	line-height: 1.6;
}

/* ============================================
   Grid Layout for Cards
   ============================================ */

.ti-companies-grid,
.ti-jobs-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 1.25rem;
	margin-bottom: 2rem;
}

@media (max-width: 768px) {
	.ti-companies-grid,
	.ti-jobs-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}
}

/* ============================================
   Modern Edit Card Styling
   ============================================ */

.ti-edit-company-card,
.ti-edit-job-card {
	background: hsl(var(--card));
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	padding: 1.25rem;
	transition: all 0.2s ease;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.ti-edit-company-card:hover,
.ti-edit-job-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px hsl(var(--foreground) / 0.1);
	border-color: hsl(var(--primary-fill) / 0.3);
}

/* Card Header */
.ti-edit-card-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 0.875rem;
}

.ti-edit-card-title-area {
	flex: 1;
	min-width: 0;
}

.ti-edit-company-title,
.ti-edit-job-title {
	margin: 0 0 0.5rem 0;
	font-size: 1rem;
	font-weight: 600;
	color: hsl(var(--foreground));
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Status Badges */
.ti-edit-company-status,
.ti-edit-job-status {
	display: inline-flex;
	align-items: center;
	padding: 0.125rem 0.5rem;
	border-radius: var(--radius-full);
	font-size: 0.625rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 0.25rem;
}

.ti-edit-status-publish {
	background: hsl(var(--success));
	color: hsl(var(--success-foreground));
}

.ti-edit-status-draft {
	background: hsl(var(--warning));
	color: hsl(var(--warning-foreground));
}

.ti-edit-status-pending {
	background: hsl(var(--info));
	color: hsl(var(--info-foreground));
}

/* Meta Information */
.ti-edit-card-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.25rem;
	font-size: 0.6875rem;
	color: hsl(var(--muted-foreground));
	margin-left: 1rem;
}

.ti-edit-last-modified,
.ti-edit-applications {
	font-weight: 600;
	background: hsl(var(--muted));
	padding: 0.25rem 0.5rem;
	border-radius: var(--radius-sm);
	white-space: nowrap;
}

/* Card Content */
.ti-edit-card-content {
	flex-grow: 1;
	margin-bottom: 1rem;
}

.ti-edit-company-excerpt {
	margin: 0;
	color: hsl(var(--muted-foreground));
	font-size: 0.8125rem;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Job-specific content */
.ti-edit-job-company {
	margin-bottom: 0.75rem;
}

.ti-edit-company-badge {
	display: inline-block;
	background: hsl(var(--primary-fill));
	color: hsl(var(--primary-foreground));
	padding: 0.25rem 0.75rem;
	border-radius: var(--radius-full);
	font-size: 0.625rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.ti-edit-job-details {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	font-size: 0.6875rem;
	color: hsl(var(--muted-foreground));
}

.ti-edit-job-location,
.ti-edit-job-expiration {
	background: hsl(var(--muted));
	padding: 0.25rem 0.5rem;
	border-radius: var(--radius-sm);
	font-weight: 500;
}

.ti-edit-expired {
	color: hsl(var(--destructive));
	font-weight: 600;
}

/* Card Actions */
.ti-edit-card-actions {
	display: flex;
	gap: 0.75rem;
	margin-top: auto;
	padding-top: 0.875rem;
	border-top: 1px solid hsl(var(--border));
}

.ti-edit-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1rem;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	font-size: 0.6875rem;
	font-weight: 600;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	transition: all 0.2s ease;
	cursor: pointer;
	flex: 1;
	min-width: 0;
}

.ti-edit-btn-primary {
	background: hsl(var(--primary-fill));
	color: hsl(var(--primary-foreground));
	border-color: hsl(var(--primary-fill));
}

.ti-edit-btn-primary:hover {
	opacity: 0.9;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px hsl(var(--primary-fill) / 0.2);
}

.ti-edit-btn-secondary {
	background: hsl(var(--card));
	color: hsl(var(--muted-foreground));
	border-color: hsl(var(--border));
}

.ti-edit-btn-secondary:hover {
	background: hsl(var(--muted));
	color: hsl(var(--foreground));
	transform: translateY(-1px);
}

.ti-edit-btn-draft {
	background: hsl(var(--warning));
	color: hsl(var(--warning-foreground));
	border-color: hsl(var(--warning));
}

.ti-edit-btn-draft:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.ti-edit-btn-delete {
	background: hsl(var(--destructive));
	color: hsl(var(--destructive-foreground));
	border-color: hsl(var(--destructive));
}

.ti-edit-btn-delete:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.ti-edit-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
	box-shadow: none !important;
}

/* ============================================
   Generic Buttons
   ============================================ */

.ti-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.625rem 1.25rem;
	border: none;
	border-radius: var(--radius);
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-right: 0.625rem;
	margin-bottom: 0.375rem;
}

.ti-btn-primary {
	background: hsl(var(--primary-fill));
	color: hsl(var(--primary-foreground));
}

.ti-btn-primary:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.ti-btn-secondary {
	background: hsl(var(--muted));
	color: hsl(var(--foreground));
	border: 1px solid hsl(var(--border));
}

.ti-btn-secondary:hover {
	background: hsl(var(--background));
}

.ti-btn-danger {
	background: hsl(var(--destructive));
	color: hsl(var(--destructive-foreground));
}

.ti-btn-danger:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

.ti-btn-small {
	padding: 0.375rem 0.75rem;
	font-size: 0.75rem;
}

/* ============================================
   Form Sections
   ============================================ */

.ti-form-sections {
	margin-bottom: 1.5rem;
}

.ti-form-section {
	margin-bottom: 1.5rem;
	padding: 1.25rem;
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	background: hsl(var(--muted));
}

.ti-form-section h4 {
	margin: 0 0 1.25rem 0;
	color: hsl(var(--foreground));
	font-size: 1rem;
	font-weight: 600;
	border-bottom: 1px solid hsl(var(--border));
	padding-bottom: 0.75rem;
}

/* ============================================
   Form Fields
   ============================================ */

.ti-form-field {
	margin-bottom: 1.25rem;
	position: relative;
}

.ti-form-field label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 600;
	color: hsl(var(--foreground));
	font-size: 0.875rem;
}

.ti-form-field .required {
	color: hsl(var(--destructive));
}

.ti-form-input,
.ti-form-textarea,
.ti-form-select {
	width: 100%;
	padding: 0.625rem 0.875rem;
	border: 1px solid hsl(var(--input));
	border-radius: var(--radius-sm);
	font-size: 0.875rem;
	box-sizing: border-box;
	background-color: hsl(var(--card));
	color: hsl(var(--foreground));
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	font-family: inherit;
}

.ti-form-select {
	appearance: none;
	-webkit-appearance: none;
	min-height: 2.5rem;
	padding-right: 2rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	cursor: pointer;
}

.ti-form-input:focus,
.ti-form-textarea:focus,
.ti-form-select:focus {
	outline: none;
	border-color: hsl(var(--ring));
	box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.ti-form-textarea {
	resize: vertical;
	line-height: 1.6;
	min-height: 120px;
}

.ti-form-help {
	margin-top: 0.375rem;
	font-size: 0.75rem;
	color: hsl(var(--muted-foreground));
	font-style: italic;
}

/* Form Rows */
.ti-form-row {
	display: flex;
	gap: 1.25rem;
	margin-bottom: 1.25rem;
}

.ti-form-field-half {
	flex: 1;
}

.ti-form-field-third {
	flex: 0 0 calc(33.333% - 0.875rem);
}

@media (max-width: 768px) {
	.ti-form-row {
		flex-direction: column;
		gap: 0;
	}

	.ti-form-field-half,
	.ti-form-field-third {
		flex: 1;
		width: 100%;
	}
}

/* ============================================
   Checkbox Groups
   ============================================ */

.ti-checkbox-group {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 0.5rem;
	padding: 1rem;
	background: hsl(var(--card));
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius-sm);
	max-height: 200px;
	overflow-y: auto;
}

.ti-checkbox-label {
	display: flex;
	align-items: center;
	font-weight: normal;
	cursor: pointer;
	padding: 0.375rem 0.5rem;
	margin: 0;
	border-radius: var(--radius-sm);
	transition: background-color 0.2s ease;
}

.ti-checkbox-label:hover {
	background-color: hsl(var(--muted));
}

.ti-checkbox-label input[type="checkbox"] {
	margin-right: 0.5rem;
	margin-bottom: 0;
	accent-color: hsl(var(--primary-fill));
}

.ti-checkbox-actions {
	margin-bottom: 0.75rem;
	font-size: 0.8125rem;
}

/* ============================================
   Radio Groups
   ============================================ */

.ti-radio-group {
	display: flex;
	gap: 1.25rem;
	flex-wrap: wrap;
}

.ti-radio-label {
	display: flex;
	align-items: center;
	cursor: pointer;
	margin: 0;
	padding: 0.375rem 0;
}

.ti-radio-label input[type="radio"] {
	margin-right: 0.5rem;
	accent-color: hsl(var(--primary-fill));
}

/* Status Badges */
.ti-status-badge {
	padding: 0.25rem 0.75rem;
	border-radius: var(--radius-full);
	font-weight: 600;
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.ti-status-open {
	background: hsl(var(--success) / 0.15);
	color: hsl(var(--success));
}

.ti-status-closed {
	background: hsl(var(--destructive) / 0.15);
	color: hsl(var(--destructive));
}

/* ============================================
   Logo Upload
   ============================================ */

.ti-logo-upload {
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	padding: 1.25rem;
	background: hsl(var(--card));
	text-align: center;
}

.ti-logo-preview {
	min-height: 100px;
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: hsl(var(--muted));
	border-radius: var(--radius-sm);
	padding: 1rem;
}

.ti-logo-image {
	max-width: 150px;
	height: auto;
	border-radius: var(--radius-sm);
}

.ti-logo-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
}

/* ============================================
   Gallery Upload
   ============================================ */

.ti-gallery-upload {
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	padding: 1.25rem;
	background: hsl(var(--card));
	overflow: visible;
}

.ti-gallery-preview {
	min-height: 120px;
	margin-bottom: 1rem;
	padding: 1.25rem;
	background: hsl(var(--muted));
	border-radius: var(--radius-sm);
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	overflow: visible;
}

.ti-gallery-item {
	position: relative;
	display: inline-block;
	padding: 0.625rem;
}

.ti-gallery-thumb-wrapper {
	position: relative;
	display: inline-block;
	cursor: pointer;
}

.ti-gallery-thumb-wrapper::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 24px;
	height: 24px;
	background: hsl(var(--foreground) / 0.7);
	border-radius: 50%;
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
	z-index: 5;
}

.ti-gallery-thumb-wrapper:hover::after {
	opacity: 1;
}

.ti-gallery-thumb {
	width: 120px;
	height: 120px;
	object-fit: cover;
	border-radius: var(--radius-sm);
	border: 2px solid hsl(var(--card));
	box-shadow: 0 2px 8px hsl(var(--foreground) / 0.1);
	max-width: 100%;
}

.ti-remove-gallery-item {
	position: absolute;
	top: 0;
	right: 0;
	width: 24px;
	height: 24px;
	background: hsl(var(--destructive));
	color: hsl(var(--destructive-foreground));
	border: 2px solid hsl(var(--card));
	border-radius: 50%;
	cursor: pointer;
	font-size: 1rem;
	font-weight: bold;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	transition: all 0.2s ease;
}

.ti-remove-gallery-item:hover {
	background: hsl(var(--destructive) / 0.8);
	transform: scale(1.1);
}

/* Gallery Full Image Preview */
.ti-gallery-full {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 50vw;
	max-height: 50vh;
	width: auto;
	height: auto;
	border-radius: var(--radius);
	box-shadow: 0 20px 40px hsl(var(--foreground) / 0.3);
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	pointer-events: auto;
}

.ti-gallery-full:hover,
.ti-gallery-thumb-wrapper:hover .ti-gallery-full {
	opacity: 1;
	visibility: visible;
}

.ti-gallery-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: hsl(var(--foreground) / 0.5);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	pointer-events: none;
}

/* ============================================
   Location Fields
   ============================================ */

.ti-location-row {
	background: hsl(var(--card));
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius);
	padding: 1rem;
	margin-bottom: 1rem;
	box-shadow: 0 1px 4px hsl(var(--foreground) / 0.03);
	transition: box-shadow 0.2s ease;
}

.ti-location-row:hover {
	box-shadow: 0 4px 12px hsl(var(--foreground) / 0.08);
}

.ti-location-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid hsl(var(--border));
}

.ti-location-header h5 {
	margin: 0;
	color: hsl(var(--foreground));
	font-size: 0.9375rem;
	font-weight: 600;
}

/* Country Select */
.ti-country-select {
	width: 100%;
}

/* City Autocomplete */
.ti-city-input-wrapper {
	position: relative;
}

.ti-city-suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: hsl(var(--card));
	border: 1px solid hsl(var(--border));
	border-top: none;
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	box-shadow: 0 8px 16px hsl(var(--foreground) / 0.1);
	max-height: 250px;
	overflow-y: auto;
	z-index: 1000;
	margin-top: -1px;
}

.ti-city-suggestion {
	padding: 0.625rem 0.875rem;
	cursor: pointer;
	transition: background-color 0.15s ease;
	border-bottom: 1px solid hsl(var(--border) / 0.5);
	font-size: 0.875rem;
}

.ti-city-suggestion:last-child {
	border-bottom: none;
}

.ti-city-suggestion:hover,
.ti-city-suggestion.active {
	background-color: hsl(var(--muted));
}

.ti-city-suggestion strong {
	color: hsl(var(--primary-fill));
	font-weight: 600;
}

.ti-city-suggestion-info {
	padding: 0.625rem 0.875rem;
	color: hsl(var(--muted-foreground));
	font-style: italic;
	font-size: 0.8125rem;
	background-color: hsl(var(--muted));
	border-top: 1px solid hsl(var(--border));
}

/* ============================================
   Select2 Custom Styling
   ============================================ */

.select2-container--default .select2-selection--single {
	height: 42px !important;
	padding: 0.375rem 0.875rem !important;
	border: 1px solid hsl(var(--input)) !important;
	border-radius: var(--radius-sm) !important;
	background-color: hsl(var(--card)) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
	line-height: 28px !important;
	color: hsl(var(--foreground)) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
	height: 40px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
	border-color: hsl(var(--ring)) !important;
	box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2) !important;
}

.select2-dropdown {
	border: 1px solid hsl(var(--border)) !important;
	border-radius: var(--radius-sm) !important;
	box-shadow: 0 8px 16px hsl(var(--foreground) / 0.1) !important;
	background: hsl(var(--card)) !important;
}

.select2-results__option {
	padding: 0.5rem 0.875rem !important;
	cursor: pointer !important;
	user-select: none !important;
	color: hsl(var(--foreground)) !important;
}

.select2-results__option--highlighted[aria-selected] {
	background-color: hsl(var(--primary-fill)) !important;
	color: hsl(var(--primary-foreground)) !important;
}

.select2-container {
	display: block !important;
}

/* ============================================
   Form Actions
   ============================================ */

.ti-form-actions {
	display: flex;
	gap: 1rem;
	justify-content: flex-end;
	padding: 1.25rem 0;
	border-top: 1px solid hsl(var(--border));
	margin-top: 1.5rem;
}

@media (max-width: 768px) {
	.ti-form-actions {
		flex-direction: column;
	}

	.ti-form-actions .ti-btn {
		width: 100%;
		margin-right: 0;
	}
}

/* ============================================
   Notices
   ============================================ */

.ti-frontend-notice {
	padding: 1rem 1.25rem;
	border-radius: var(--radius);
	margin-bottom: 1.25rem;
	font-size: 0.9375rem;
	border-left: 4px solid;
}

.ti-frontend-notice.ti-success {
	background: hsl(var(--success) / 0.1);
	border-color: hsl(var(--success));
	color: hsl(var(--success));
}

.ti-frontend-notice.ti-error {
	background: hsl(var(--destructive) / 0.1);
	border-color: hsl(var(--destructive));
	color: hsl(var(--destructive));
}

.ti-frontend-notice.ti-info {
	background: hsl(var(--info) / 0.1);
	border-color: hsl(var(--info));
	color: hsl(var(--info));
}

/* ============================================
   Job Selector Specific
   ============================================ */

.ti-job-status {
	display: inline-block;
	padding: 0.125rem 0.5rem;
	border-radius: var(--radius-sm);
	font-weight: 600;
	text-transform: uppercase;
	font-size: 0.625rem;
	letter-spacing: 0.05em;
}

.ti-status-publish {
	background: hsl(var(--success) / 0.15);
	color: hsl(var(--success));
}

.ti-status-draft {
	background: hsl(var(--warning) / 0.15);
	color: hsl(var(--warning-foreground));
}

.ti-status-pending {
	background: hsl(var(--info) / 0.15);
	color: hsl(var(--info));
}

.ti-job-actions {
	display: flex;
	gap: 0.625rem;
}

.ti-job-excerpt {
	margin-top: 0.625rem;
	color: hsl(var(--muted-foreground));
	font-size: 0.8125rem;
	line-height: 1.6;
}

/* ============================================
   WordPress Editor Integration
   ============================================ */

.ti-editor-container .wp-editor-wrap {
	border: none;
}

.ti-editor-container .wp-editor-container {
	border: 1px solid hsl(var(--border));
	border-radius: var(--radius-sm);
	min-height: 300px;
	overflow: hidden;
}

.ti-editor-container .wp-editor-area {
	background-color: hsl(var(--card));
	color: hsl(var(--foreground));
	border: none;
	width: 100%;
	min-height: 300px;
	box-sizing: border-box;
	padding: 1rem;
}

.ti-editor-container .mce-content-body {
	background-color: hsl(var(--card));
	color: hsl(var(--foreground));
	padding: 1rem;
	font-family: inherit;
	font-size: 0.875rem;
	line-height: 1.6;
}

.ti-editor-container iframe {
	background-color: hsl(var(--card)) !important;
	min-height: 300px !important;
	width: 100% !important;
}

/* WordPress Editor Tabs */
.wp-editor-tabs {
	text-align: right;
}

.wp-editor-tabs .wp-switch-editor {
	background: hsl(var(--muted));
	border: 1px solid hsl(var(--border));
	border-bottom: none;
	color: hsl(var(--muted-foreground));
	cursor: pointer;
	display: inline-block;
	margin: 0.375rem 0.375rem 0 0;
	padding: 0.25rem 0.625rem;
	text-decoration: none;
	transition: all 0.2s ease;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
	font-size: 0.8125rem;
}

.wp-editor-tabs .wp-switch-editor:hover {
	background: hsl(var(--background));
	color: hsl(var(--foreground));
}

.wp-editor-tabs .wp-switch-editor.active,
.html-active .switch-html,
.tmce-active .switch-tmce {
	background: hsl(var(--card));
	border-bottom-color: hsl(var(--card));
	color: hsl(var(--foreground));
}

/* ============================================
   Loading States
   ============================================ */

.ti-loading {
	opacity: 0.6;
	pointer-events: none;
	position: relative;
}

.ti-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 2px solid hsl(var(--muted));
	border-top: 2px solid hsl(var(--primary-fill));
	border-radius: 50%;
	animation: ti-form-spin 1s linear infinite;
}

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

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
	.ti-frontend-form-wrapper {
		margin: 0.625rem;
		padding: 1rem;
	}

	.ti-form-row {
		flex-direction: column;
		gap: 0;
	}

	.ti-company-actions {
		text-align: center;
	}

	.ti-btn {
		display: block;
		width: 100%;
		margin-right: 0;
		margin-bottom: 0.625rem;
	}

	.ti-form-actions {
		flex-direction: column;
	}

	.ti-checkbox-group {
		grid-template-columns: 1fr;
	}

	.ti-radio-group {
		flex-direction: column;
		gap: 0.625rem;
	}

	.ti-logo-actions,
	.ti-gallery-actions {
		flex-direction: column;
		align-items: center;
	}

	.ti-city-suggestions {
		max-height: 200px;
	}
}

@media (max-width: 480px) {
	.ti-form-header h3 {
		font-size: 1.25rem;
	}

	.ti-form-section h4 {
		font-size: 0.9375rem;
	}

	.ti-edit-company-card,
	.ti-edit-job-card {
		padding: 1rem;
	}

	.ti-gallery-thumb {
		width: 100px;
		height: 100px;
	}
}

/* ============================================
   Ensure White Background for Form Inputs
   ============================================ */

.ti-job-edit-form input[type="text"],
.ti-job-edit-form input[type="email"],
.ti-job-edit-form input[type="url"],
.ti-job-edit-form input[type="number"],
.ti-job-edit-form input[type="tel"],
.ti-job-edit-form select,
.ti-job-edit-form textarea {
	background-color: hsl(var(--card));
}

/* Explicit input backgrounds */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="search"],
input[type="time"],
input[type="week"],
textarea,
select {
	background-color: hsl(var(--card));
}
