/* =========================================================================
   Ticketing System – Client Portal CSS
   iOS Glassmorphism Design | Blue & White | Cairo Font | RTL + LTR
   ========================================================================= */

/* -------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   ------------------------------------------------------------------------- */
:root {
	/* Primary palette */
	--ts-primary:        #007AFF;
	--ts-primary-light:  #4DA3FF;
	--ts-primary-dark:   #0055CC;
	--ts-primary-rgb:    0, 122, 255;

	/* Neutral palette */
	--ts-white:          #FFFFFF;
	--ts-black:          #000000;
	--ts-text-primary:   #1C1C1E;
	--ts-text-secondary: #6E6E73;
	--ts-text-tertiary:  #AEAEB2;

	/* Glassmorphism */
	--ts-glass-bg:       rgba(255, 255, 255, 0.72);
	--ts-glass-bg-heavy: rgba(255, 255, 255, 0.85);
	--ts-glass-border:   rgba(255, 255, 255, 0.35);
	--ts-glass-shadow:   0 8px 32px rgba(0, 122, 255, 0.10);
	--ts-glass-blur:     20px;

	/* Background */
	--ts-bg-gradient:    linear-gradient(135deg, #E8F0FE 0%, #F5F8FF 50%, #DCEAFF 100%);

	/* Status colors */
	--ts-status-open:       #007AFF;
	--ts-status-in-progress:#FF9500;
	--ts-status-resolved:   #34C759;
	--ts-status-closed:     #8E8E93;

	/* Priority colors */
	--ts-priority-low:    #34C759;
	--ts-priority-medium: #FF9500;
	--ts-priority-high:   #FF3B30;
	--ts-priority-urgent: #AF52DE;

	/* Semantic */
	--ts-success:  #34C759;
	--ts-warning:  #FF9500;
	--ts-danger:   #FF3B30;
	--ts-info:     #5AC8FA;

	/* Spacing */
	--ts-space-xs:  4px;
	--ts-space-sm:  8px;
	--ts-space-md:  16px;
	--ts-space-lg:  24px;
	--ts-space-xl:  32px;
	--ts-space-2xl: 48px;

	/* Radius */
	--ts-radius-sm:   8px;
	--ts-radius-md:   12px;
	--ts-radius-lg:   16px;
	--ts-radius-xl:   20px;
	--ts-radius-full: 9999px;

	/* Typography */
	--ts-font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--ts-font-size-xs:   0.75rem;
	--ts-font-size-sm:   0.875rem;
	--ts-font-size-base: 1rem;
	--ts-font-size-lg:   1.125rem;
	--ts-font-size-xl:   1.25rem;
	--ts-font-size-2xl:  1.5rem;
	--ts-font-size-3xl:  1.875rem;
	--ts-font-size-4xl:  2.25rem;

	/* Transitions */
	--ts-transition-fast:   150ms ease;
	--ts-transition-normal: 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
	--ts-transition-slow:   400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* -------------------------------------------------------------------------
   Portal Root & Reset
   ------------------------------------------------------------------------- */
.ts-portal {
	font-family: var(--ts-font-family);
	font-size: var(--ts-font-size-base);
	line-height: 1.6;
	color: var(--ts-text-primary);
	min-height: 100vh;
	background: var(--ts-bg-gradient);
	position: relative;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.ts-portal *,
.ts-portal *::before,
.ts-portal *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

.ts-portal a {
	color: var(--ts-primary);
	text-decoration: none;
	transition: color var(--ts-transition-fast);
}

.ts-portal a:hover {
	color: var(--ts-primary-dark);
}

.ts-portal button {
	font-family: var(--ts-font-family);
	cursor: pointer;
	border: none;
	outline: none;
}

.ts-portal input,
.ts-portal textarea,
.ts-portal select {
	font-family: var(--ts-font-family);
	font-size: var(--ts-font-size-base);
}

/* -------------------------------------------------------------------------
   Loader
   ------------------------------------------------------------------------- */
.ts-portal-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
}

.ts-loader-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid rgba(0, 122, 255, 0.15);
	border-top-color: var(--ts-primary);
	border-radius: 50%;
	animation: tsSpinnerRotate 0.8s linear infinite;
}

@keyframes tsSpinnerRotate {
	to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------
   Glass Card Base
   ------------------------------------------------------------------------- */
.ts-glass {
	background: var(--ts-glass-bg);
	backdrop-filter: blur(var(--ts-glass-blur));
	-webkit-backdrop-filter: blur(var(--ts-glass-blur));
	border: 1px solid var(--ts-glass-border);
	border-radius: var(--ts-radius-lg);
	box-shadow: var(--ts-glass-shadow);
}

.ts-glass-heavy {
	background: var(--ts-glass-bg-heavy);
	backdrop-filter: blur(30px);
	-webkit-backdrop-filter: blur(30px);
	border: 1px solid var(--ts-glass-border);
	border-radius: var(--ts-radius-lg);
	box-shadow: var(--ts-glass-shadow);
}

/* -------------------------------------------------------------------------
   LOGIN SCREEN
   ------------------------------------------------------------------------- */
.ts-login-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: var(--ts-space-lg);
}

.ts-login-card {
	width: 100%;
	max-width: 420px;
	padding: var(--ts-space-2xl) var(--ts-space-xl);
	text-align: center;
	animation: tsSlideUp 0.4s var(--ts-transition-normal);
}

.ts-login-logo {
	width: 64px;
	height: 64px;
	margin: 0 auto var(--ts-space-md);
	background: var(--ts-primary);
	border-radius: var(--ts-radius-lg);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.ts-login-logo svg {
	width: 32px;
	height: 32px;
	fill: var(--ts-white);
}

.ts-login-title {
	font-size: var(--ts-font-size-2xl);
	font-weight: 700;
	color: var(--ts-text-primary);
	margin-bottom: var(--ts-space-xs);
}

.ts-login-subtitle {
	font-size: var(--ts-font-size-sm);
	color: var(--ts-text-secondary);
	margin-bottom: var(--ts-space-xl);
}

/* Form groups */
.ts-form-group {
	position: relative;
	margin-bottom: var(--ts-space-md);
	text-align: start;
}

.ts-form-group label {
	display: block;
	font-size: var(--ts-font-size-sm);
	font-weight: 600;
	color: var(--ts-text-secondary);
	margin-bottom: var(--ts-space-xs);
}

.ts-form-input {
	width: 100%;
	padding: 12px 16px;
	border: 1.5px solid rgba(0, 122, 255, 0.15);
	border-radius: var(--ts-radius-md);
	background: rgba(255, 255, 255, 0.6);
	font-size: var(--ts-font-size-base);
	color: var(--ts-text-primary);
	transition: border-color var(--ts-transition-fast), box-shadow var(--ts-transition-fast);
	outline: none;
}

.ts-form-input:focus {
	border-color: var(--ts-primary);
	box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.ts-form-input::placeholder {
	color: var(--ts-text-tertiary);
}

.ts-form-input.ts-input-error {
	border-color: var(--ts-danger);
	box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

textarea.ts-form-input {
	resize: vertical;
	min-height: 120px;
}

select.ts-form-input {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236E6E73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-inline-end: 36px;
}

[dir="rtl"] select.ts-form-input {
	background-position: left 12px center;
}

/* Primary button */
.ts-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ts-space-sm);
	padding: 12px 24px;
	border-radius: var(--ts-radius-md);
	font-size: var(--ts-font-size-base);
	font-weight: 600;
	transition: all var(--ts-transition-fast);
	white-space: nowrap;
	line-height: 1.4;
}

.ts-btn-primary {
	background: var(--ts-primary);
	color: var(--ts-white);
	box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.ts-btn-primary:hover {
	background: var(--ts-primary-dark);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(0, 122, 255, 0.35);
}

.ts-btn-primary:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.ts-btn-primary:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.ts-btn-full {
	width: 100%;
}

.ts-btn-secondary {
	background: rgba(0, 122, 255, 0.08);
	color: var(--ts-primary);
}

.ts-btn-secondary:hover {
	background: rgba(0, 122, 255, 0.15);
}

.ts-btn-ghost {
	background: transparent;
	color: var(--ts-text-secondary);
	padding: 8px 12px;
}

.ts-btn-ghost:hover {
	background: rgba(0, 0, 0, 0.04);
	color: var(--ts-text-primary);
}

.ts-btn-sm {
	padding: 8px 16px;
	font-size: var(--ts-font-size-sm);
}

.ts-btn-icon {
	width: 40px;
	height: 40px;
	padding: 0;
	border-radius: var(--ts-radius-md);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Loading state in buttons */
.ts-btn .ts-btn-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: var(--ts-white);
	border-radius: 50%;
	animation: tsSpinnerRotate 0.7s linear infinite;
}

.ts-btn.ts-loading .ts-btn-spinner {
	display: inline-block;
}

.ts-btn.ts-loading .ts-btn-text {
	opacity: 0.7;
}

/* Error message */
.ts-login-error {
	display: none;
	padding: 10px 14px;
	background: rgba(255, 59, 48, 0.08);
	border: 1px solid rgba(255, 59, 48, 0.2);
	border-radius: var(--ts-radius-sm);
	color: var(--ts-danger);
	font-size: var(--ts-font-size-sm);
	text-align: start;
	margin-bottom: var(--ts-space-md);
	animation: tsShake 0.4s ease;
}

.ts-login-error.ts-visible {
	display: block;
}

@keyframes tsShake {
	0%, 100% { transform: translateX(0); }
	20%      { transform: translateX(-8px); }
	40%      { transform: translateX(8px); }
	60%      { transform: translateX(-4px); }
	80%      { transform: translateX(4px); }
}

/* -------------------------------------------------------------------------
   DASHBOARD LAYOUT
   ------------------------------------------------------------------------- */
.ts-dashboard {
	max-width: 960px;
	margin: 0 auto;
	padding: var(--ts-space-lg);
	min-height: 100vh;
	animation: tsFadeIn 0.3s ease;
}

/* Top bar */
.ts-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--ts-space-md) var(--ts-space-lg);
	margin-bottom: var(--ts-space-lg);
	border-radius: var(--ts-radius-lg);
	flex-wrap: wrap;
	gap: var(--ts-space-md);
}

.ts-topbar-left {
	display: flex;
	align-items: center;
	gap: var(--ts-space-md);
}

.ts-topbar-avatar {
	width: 44px;
	height: 44px;
	border-radius: var(--ts-radius-full);
	background: var(--ts-primary);
	color: var(--ts-white);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: var(--ts-font-size-lg);
	flex-shrink: 0;
}

.ts-topbar-name {
	font-weight: 600;
	font-size: var(--ts-font-size-lg);
	color: var(--ts-text-primary);
}

.ts-topbar-email {
	font-size: var(--ts-font-size-xs);
	color: var(--ts-text-secondary);
}

.ts-topbar-right {
	display: flex;
	align-items: center;
	gap: var(--ts-space-sm);
}

/* -------------------------------------------------------------------------
   FILTER PILLS
   ------------------------------------------------------------------------- */
.ts-filters {
	display: flex;
	align-items: center;
	gap: var(--ts-space-sm);
	margin-bottom: var(--ts-space-lg);
	flex-wrap: wrap;
}

.ts-filter-pill {
	padding: 8px 18px;
	border-radius: var(--ts-radius-full);
	font-size: var(--ts-font-size-sm);
	font-weight: 500;
	color: var(--ts-text-secondary);
	background: rgba(255, 255, 255, 0.5);
	border: 1px solid rgba(0, 0, 0, 0.06);
	transition: all var(--ts-transition-fast);
	cursor: pointer;
}

.ts-filter-pill:hover {
	background: rgba(0, 122, 255, 0.06);
	color: var(--ts-primary);
}

.ts-filter-pill.ts-active {
	background: var(--ts-primary);
	color: var(--ts-white);
	border-color: var(--ts-primary);
	box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.ts-filter-count {
	margin-inline-start: 4px;
	font-size: var(--ts-font-size-xs);
	opacity: 0.8;
}

/* Search bar */
.ts-search-bar {
	position: relative;
	margin-bottom: var(--ts-space-lg);
}

.ts-search-bar input {
	width: 100%;
	padding: 12px 16px;
	padding-inline-start: 44px;
	border: 1.5px solid rgba(0, 122, 255, 0.1);
	border-radius: var(--ts-radius-lg);
	background: var(--ts-glass-bg);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	font-size: var(--ts-font-size-base);
	color: var(--ts-text-primary);
	transition: border-color var(--ts-transition-fast);
	outline: none;
}

.ts-search-bar input:focus {
	border-color: var(--ts-primary);
}

.ts-search-bar .ts-search-icon {
	position: absolute;
	top: 50%;
	inset-inline-start: 14px;
	transform: translateY(-50%);
	color: var(--ts-text-tertiary);
	pointer-events: none;
}

/* -------------------------------------------------------------------------
   TICKET CARDS
   ------------------------------------------------------------------------- */
.ts-ticket-list {
	display: flex;
	flex-direction: column;
	gap: var(--ts-space-md);
}

.ts-ticket-card {
	padding: var(--ts-space-md) var(--ts-space-lg);
	transition: transform var(--ts-transition-fast), box-shadow var(--ts-transition-fast);
	cursor: pointer;
}

.ts-ticket-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 40px rgba(0, 122, 255, 0.12);
}

.ts-ticket-card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--ts-space-sm);
	gap: var(--ts-space-sm);
}

.ts-ticket-card-number {
	font-size: var(--ts-font-size-xs);
	color: var(--ts-text-tertiary);
	font-weight: 500;
}

.ts-ticket-card-subject {
	font-size: var(--ts-font-size-lg);
	font-weight: 600;
	color: var(--ts-text-primary);
	margin-bottom: var(--ts-space-xs);
}

.ts-ticket-card-preview {
	font-size: var(--ts-font-size-sm);
	color: var(--ts-text-secondary);
	margin-bottom: var(--ts-space-md);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ts-ticket-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ts-space-sm);
	flex-wrap: wrap;
}

.ts-ticket-card-meta {
	display: flex;
	align-items: center;
	gap: var(--ts-space-md);
}

.ts-ticket-card-date {
	font-size: var(--ts-font-size-xs);
	color: var(--ts-text-tertiary);
}

/* Status badges */
.ts-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border-radius: var(--ts-radius-full);
	font-size: var(--ts-font-size-xs);
	font-weight: 600;
	white-space: nowrap;
}

.ts-badge-open {
	background: rgba(0, 122, 255, 0.1);
	color: var(--ts-status-open);
}

.ts-badge-in_progress {
	background: rgba(255, 149, 0, 0.1);
	color: var(--ts-status-in-progress);
}

.ts-badge-resolved {
	background: rgba(52, 199, 89, 0.1);
	color: var(--ts-status-resolved);
}

.ts-badge-closed {
	background: rgba(142, 142, 147, 0.1);
	color: var(--ts-status-closed);
}

/* Priority dots */
.ts-priority-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}

.ts-priority-low    { background: var(--ts-priority-low); }
.ts-priority-medium { background: var(--ts-priority-medium); }
.ts-priority-high   { background: var(--ts-priority-high); }
.ts-priority-urgent { background: var(--ts-priority-urgent); animation: tsPulse 2s ease-in-out infinite; }

@keyframes tsPulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50%      { opacity: 0.6; transform: scale(1.4); }
}

/* -------------------------------------------------------------------------
   EMPTY STATE
   ------------------------------------------------------------------------- */
.ts-empty-state {
	text-align: center;
	padding: var(--ts-space-2xl) var(--ts-space-lg);
}

.ts-empty-state-icon {
	width: 80px;
	height: 80px;
	margin: 0 auto var(--ts-space-lg);
	background: rgba(0, 122, 255, 0.06);
	border-radius: var(--ts-radius-xl);
	display: flex;
	align-items: center;
	justify-content: center;
}

.ts-empty-state-icon svg {
	width: 40px;
	height: 40px;
	stroke: var(--ts-primary);
	stroke-width: 1.5;
	fill: none;
}

.ts-empty-state-title {
	font-size: var(--ts-font-size-xl);
	font-weight: 600;
	color: var(--ts-text-primary);
	margin-bottom: var(--ts-space-sm);
}

.ts-empty-state-desc {
	font-size: var(--ts-font-size-sm);
	color: var(--ts-text-secondary);
	margin-bottom: var(--ts-space-lg);
}

/* -------------------------------------------------------------------------
   PAGINATION
   ------------------------------------------------------------------------- */
.ts-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--ts-space-sm);
	padding: var(--ts-space-lg) 0;
}

.ts-page-btn {
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border-radius: var(--ts-radius-sm);
	font-size: var(--ts-font-size-sm);
	font-weight: 500;
	color: var(--ts-text-secondary);
	background: rgba(255, 255, 255, 0.5);
	border: 1px solid rgba(0, 0, 0, 0.06);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all var(--ts-transition-fast);
	cursor: pointer;
}

.ts-page-btn:hover {
	background: rgba(0, 122, 255, 0.08);
	color: var(--ts-primary);
}

.ts-page-btn.ts-active {
	background: var(--ts-primary);
	color: var(--ts-white);
	border-color: var(--ts-primary);
}

.ts-page-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* -------------------------------------------------------------------------
   FAB (Floating Action Button)
   ------------------------------------------------------------------------- */
.ts-fab {
	position: fixed;
	bottom: 90px;
	inset-inline-end: 30px;
	width: 56px;
	height: 56px;
	border-radius: var(--ts-radius-full);
	background: var(--ts-primary);
	color: var(--ts-white);
	box-shadow: 0 6px 24px rgba(0, 122, 255, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all var(--ts-transition-fast);
	z-index: 100;
	cursor: pointer;
}

.ts-fab:hover {
	transform: scale(1.08);
	box-shadow: 0 8px 32px rgba(0, 122, 255, 0.5);
}

.ts-fab svg {
	width: 24px;
	height: 24px;
	fill: var(--ts-white);
}

/* -------------------------------------------------------------------------
   NEW TICKET FORM (Modal overlay)
   ------------------------------------------------------------------------- */
.ts-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.3);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--ts-space-lg);
	animation: tsFadeIn 0.2s ease;
}

.ts-modal {
	width: 100%;
	max-width: 580px;
	max-height: 90vh;
	overflow-y: auto;
	padding: var(--ts-space-xl);
	animation: tsSlideUp 0.3s var(--ts-transition-normal);
}

.ts-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--ts-space-lg);
}

.ts-modal-title {
	font-size: var(--ts-font-size-xl);
	font-weight: 700;
	color: var(--ts-text-primary);
}

.ts-modal-close {
	width: 36px;
	height: 36px;
	border-radius: var(--ts-radius-full);
	background: rgba(0, 0, 0, 0.05);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--ts-transition-fast);
	cursor: pointer;
	border: none;
}

.ts-modal-close:hover {
	background: rgba(0, 0, 0, 0.1);
}

.ts-modal-close svg {
	width: 18px;
	height: 18px;
	stroke: var(--ts-text-secondary);
	stroke-width: 2;
}

/* File upload area */
.ts-file-upload-area {
	border: 2px dashed rgba(0, 122, 255, 0.2);
	border-radius: var(--ts-radius-md);
	padding: var(--ts-space-lg);
	text-align: center;
	transition: all var(--ts-transition-fast);
	cursor: pointer;
	margin-bottom: var(--ts-space-md);
}

.ts-file-upload-area:hover,
.ts-file-upload-area.ts-drag-over {
	border-color: var(--ts-primary);
	background: rgba(0, 122, 255, 0.03);
}

.ts-file-upload-area svg {
	width: 32px;
	height: 32px;
	stroke: var(--ts-primary);
	stroke-width: 1.5;
	fill: none;
	margin-bottom: var(--ts-space-sm);
}

.ts-file-upload-text {
	font-size: var(--ts-font-size-sm);
	color: var(--ts-text-secondary);
}

.ts-file-upload-text span {
	color: var(--ts-primary);
	font-weight: 600;
}

.ts-file-list {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--ts-space-md);
}

.ts-file-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	background: rgba(0, 122, 255, 0.04);
	border-radius: var(--ts-radius-sm);
	margin-bottom: var(--ts-space-xs);
	font-size: var(--ts-font-size-sm);
}

.ts-file-item-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ts-file-item-remove {
	color: var(--ts-danger);
	cursor: pointer;
	margin-inline-start: var(--ts-space-sm);
	font-size: var(--ts-font-size-lg);
	line-height: 1;
}

/* Priority selector */
.ts-priority-selector {
	display: flex;
	gap: var(--ts-space-sm);
	margin-bottom: var(--ts-space-md);
}

.ts-priority-option {
	flex: 1;
	text-align: center;
	padding: 10px 8px;
	border: 1.5px solid rgba(0, 0, 0, 0.08);
	border-radius: var(--ts-radius-md);
	cursor: pointer;
	font-size: var(--ts-font-size-sm);
	font-weight: 500;
	transition: all var(--ts-transition-fast);
	background: rgba(255, 255, 255, 0.5);
}

.ts-priority-option:hover {
	border-color: rgba(0, 122, 255, 0.3);
}

.ts-priority-option.ts-selected {
	border-color: var(--ts-primary);
	background: rgba(0, 122, 255, 0.06);
	color: var(--ts-primary);
}

.ts-priority-option input {
	display: none;
}

/* -------------------------------------------------------------------------
   TICKET DETAIL VIEW
   ------------------------------------------------------------------------- */
.ts-detail-header {
	display: flex;
	align-items: flex-start;
	gap: var(--ts-space-md);
	margin-bottom: var(--ts-space-lg);
}

.ts-detail-back {
	width: 40px;
	height: 40px;
	border-radius: var(--ts-radius-full);
	background: rgba(0, 122, 255, 0.08);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background var(--ts-transition-fast);
	cursor: pointer;
	border: none;
}

.ts-detail-back:hover {
	background: rgba(0, 122, 255, 0.15);
}

.ts-detail-back svg {
	width: 20px;
	height: 20px;
	stroke: var(--ts-primary);
	stroke-width: 2;
	fill: none;
}

/* Flip arrow for RTL */
[dir="rtl"] .ts-detail-back svg {
	transform: scaleX(-1);
}

.ts-detail-info {
	flex: 1;
}

.ts-detail-number {
	font-size: var(--ts-font-size-xs);
	color: var(--ts-text-tertiary);
	font-weight: 500;
}

.ts-detail-subject {
	font-size: var(--ts-font-size-2xl);
	font-weight: 700;
	color: var(--ts-text-primary);
	margin-bottom: var(--ts-space-sm);
}

.ts-detail-meta {
	display: flex;
	align-items: center;
	gap: var(--ts-space-md);
	flex-wrap: wrap;
}

.ts-detail-meta-item {
	display: flex;
	align-items: center;
	gap: var(--ts-space-xs);
	font-size: var(--ts-font-size-sm);
	color: var(--ts-text-secondary);
}

/* Chat thread */
.ts-chat-thread {
	display: flex;
	flex-direction: column;
	gap: var(--ts-space-md);
	margin-bottom: var(--ts-space-lg);
	padding: var(--ts-space-md) 0;
}

/* Original message */
.ts-original-message {
	padding: var(--ts-space-lg);
	margin-bottom: var(--ts-space-md);
}

.ts-original-message-label {
	font-size: var(--ts-font-size-xs);
	color: var(--ts-text-tertiary);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: var(--ts-space-sm);
}

.ts-original-message-body {
	font-size: var(--ts-font-size-base);
	color: var(--ts-text-primary);
	line-height: 1.8;
	white-space: pre-wrap;
	word-wrap: break-word;
}

/* Chat bubbles */
.ts-chat-bubble {
	max-width: 80%;
	padding: var(--ts-space-md) var(--ts-space-lg);
	border-radius: var(--ts-radius-lg);
	position: relative;
	animation: tsFadeIn 0.3s ease;
}

.ts-chat-bubble-client {
	align-self: flex-start;
	background: var(--ts-white);
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-end-start-radius: 4px;
}

.ts-chat-bubble-staff {
	align-self: flex-end;
	background: var(--ts-primary);
	color: var(--ts-white);
	border-end-end-radius: 4px;
}

.ts-chat-bubble-author {
	font-size: var(--ts-font-size-xs);
	font-weight: 600;
	margin-bottom: var(--ts-space-xs);
}

.ts-chat-bubble-staff .ts-chat-bubble-author {
	color: rgba(255, 255, 255, 0.8);
}

.ts-chat-bubble-client .ts-chat-bubble-author {
	color: var(--ts-primary);
}

.ts-chat-bubble-body {
	font-size: var(--ts-font-size-base);
	line-height: 1.7;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.ts-chat-bubble-staff .ts-chat-bubble-body {
	color: var(--ts-white);
}

.ts-chat-bubble-time {
	font-size: var(--ts-font-size-xs);
	margin-top: var(--ts-space-xs);
	opacity: 0.6;
}

.ts-chat-bubble-staff .ts-chat-bubble-time {
	color: rgba(255, 255, 255, 0.7);
}

.ts-staff-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: var(--ts-font-size-xs);
	font-weight: 600;
	color: rgba(255, 255, 255, 0.8);
	margin-inline-start: var(--ts-space-sm);
}

/* Attachments inside messages */
.ts-chat-attachments {
	margin-top: var(--ts-space-sm);
	display: flex;
	flex-wrap: wrap;
	gap: var(--ts-space-xs);
}

/* Reply box */
.ts-reply-box {
	padding: var(--ts-space-lg);
	position: sticky;
	bottom: 0;
}

.ts-reply-box-inner {
	display: flex;
	gap: var(--ts-space-sm);
	align-items: flex-end;
}

.ts-reply-box textarea {
	flex: 1;
	resize: none;
	min-height: 48px;
	max-height: 160px;
	padding: 12px 16px;
	border: 1.5px solid rgba(0, 122, 255, 0.15);
	border-radius: var(--ts-radius-md);
	background: rgba(255, 255, 255, 0.7);
	font-size: var(--ts-font-size-base);
	color: var(--ts-text-primary);
	outline: none;
	transition: border-color var(--ts-transition-fast);
	line-height: 1.5;
}

.ts-reply-box textarea:focus {
	border-color: var(--ts-primary);
}

.ts-reply-send {
	width: 48px;
	height: 48px;
	border-radius: var(--ts-radius-md);
	background: var(--ts-primary);
	color: var(--ts-white);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: all var(--ts-transition-fast);
	cursor: pointer;
	border: none;
}

.ts-reply-send:hover {
	background: var(--ts-primary-dark);
}

.ts-reply-send svg {
	width: 20px;
	height: 20px;
	fill: var(--ts-white);
}

[dir="rtl"] .ts-reply-send svg {
	transform: scaleX(-1);
}

.ts-reply-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Closed banner */
.ts-closed-banner {
	padding: var(--ts-space-md) var(--ts-space-lg);
	text-align: center;
	font-size: var(--ts-font-size-sm);
	color: var(--ts-text-secondary);
	background: rgba(142, 142, 147, 0.08);
	border-radius: var(--ts-radius-md);
	margin-top: var(--ts-space-md);
}

/* -------------------------------------------------------------------------
   TOAST NOTIFICATIONS
   ------------------------------------------------------------------------- */
.ts-toast {
	position: fixed;
	top: 20px;
	left: 50%;
	transform: translateX(-50%) translateY(-100px);
	padding: 12px 24px;
	border-radius: var(--ts-radius-md);
	font-size: var(--ts-font-size-sm);
	font-weight: 500;
	color: var(--ts-white);
	z-index: 10000;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
	white-space: nowrap;
	max-width: 90%;
	text-align: center;
}

.ts-toast.ts-toast-visible {
	transform: translateX(-50%) translateY(0);
}

.ts-toast-success {
	background: var(--ts-success);
}

.ts-toast-error {
	background: var(--ts-danger);
}

.ts-toast-info {
	background: var(--ts-primary);
}

/* -------------------------------------------------------------------------
   LANGUAGE SWITCHER
   ------------------------------------------------------------------------- */
.ts-lang-switcher {
	position: fixed;
	bottom: 24px;
	inset-inline-end: 24px;
	display: flex;
	align-items: center;
	border-radius: var(--ts-radius-full);
	overflow: hidden;
	z-index: 200;
	padding: 3px;
}

.ts-lang-btn {
	padding: 8px 16px;
	font-size: var(--ts-font-size-sm);
	font-weight: 600;
	color: var(--ts-text-secondary);
	background: transparent;
	border: none;
	border-radius: var(--ts-radius-full);
	transition: all var(--ts-transition-fast);
	cursor: pointer;
	font-family: var(--ts-font-family);
}

.ts-lang-btn.ts-active {
	background: var(--ts-primary);
	color: var(--ts-white);
	box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.ts-lang-btn:hover:not(.ts-active) {
	color: var(--ts-primary);
}

/* -------------------------------------------------------------------------
   ANIMATIONS
   ------------------------------------------------------------------------- */
@keyframes tsFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes tsSlideUp {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes tsSlideIn {
	from { opacity: 0; transform: translateX(20px); }
	to   { opacity: 1; transform: translateX(0); }
}

.ts-view-enter {
	animation: tsSlideUp 0.3s var(--ts-transition-normal) both;
}

.ts-view-exit {
	animation: tsFadeIn 0.15s ease reverse both;
}

/* -------------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
	.ts-login-card {
		padding: var(--ts-space-xl) var(--ts-space-lg);
	}

	.ts-dashboard {
		padding: var(--ts-space-md);
	}

	.ts-topbar {
		padding: var(--ts-space-sm) var(--ts-space-md);
	}

	.ts-topbar-name {
		font-size: var(--ts-font-size-base);
	}

	.ts-ticket-card {
		padding: var(--ts-space-md);
	}

	.ts-chat-bubble {
		max-width: 92%;
	}

	.ts-detail-subject {
		font-size: var(--ts-font-size-xl);
	}

	.ts-modal {
		padding: var(--ts-space-lg);
		max-height: 100vh;
		border-radius: var(--ts-radius-lg) var(--ts-radius-lg) 0 0;
		align-self: flex-end;
	}

	.ts-modal-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.ts-priority-selector {
		flex-wrap: wrap;
	}

	.ts-priority-option {
		flex: 0 0 calc(50% - 4px);
	}

	.ts-fab {
		bottom: 80px;
		inset-inline-end: 16px;
	}

	.ts-lang-switcher {
		bottom: 16px;
		inset-inline-end: 16px;
	}

	.ts-filters {
		overflow-x: auto;
		flex-wrap: nowrap;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-bottom: var(--ts-space-xs);
	}

	.ts-filters::-webkit-scrollbar {
		display: none;
	}

	.ts-filter-pill {
		flex-shrink: 0;
	}
}

/* -------------------------------------------------------------------------
   SCROLLBAR
   ------------------------------------------------------------------------- */
.ts-portal ::-webkit-scrollbar {
	width: 6px;
}

.ts-portal ::-webkit-scrollbar-track {
	background: transparent;
}

.ts-portal ::-webkit-scrollbar-thumb {
	background: rgba(0, 122, 255, 0.15);
	border-radius: 3px;
}

.ts-portal ::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 122, 255, 0.3);
}

/* -------------------------------------------------------------------------
   Utility classes
   ------------------------------------------------------------------------- */
.ts-hidden { display: none !important; }
.ts-text-center { text-align: center; }
.ts-text-start { text-align: start; }
.ts-mt-sm { margin-top: var(--ts-space-sm); }
.ts-mt-md { margin-top: var(--ts-space-md); }
.ts-mt-lg { margin-top: var(--ts-space-lg); }
.ts-mb-sm { margin-bottom: var(--ts-space-sm); }
.ts-mb-md { margin-bottom: var(--ts-space-md); }
.ts-mb-lg { margin-bottom: var(--ts-space-lg); }

/* -------------------------------------------------------------------------
   Reply Attachments
   ------------------------------------------------------------------------- */
.ts-reply-attach-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s;
	color: var(--ts-text-secondary);
}

.ts-reply-attach-btn:hover {
	background: var(--ts-bg-secondary);
}

.ts-reply-file-preview {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px 12px;
}

.ts-reply-file-preview:empty {
	display: none;
}

.ts-reply-file-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px;
	background: var(--ts-bg-secondary);
	border-radius: 6px;
	font-size: 12px;
}

.ts-reply-file-item img {
	width: 32px;
	height: 32px;
	object-fit: cover;
	border-radius: 4px;
}

.ts-reply-file-remove {
	background: none;
	border: none;
	color: var(--ts-text-tertiary);
	cursor: pointer;
	font-size: 16px;
	padding: 0 4px;
}

.ts-reply-file-remove:hover {
	color: #ef4444;
}

/* ---- Attachment Image Display (all contexts) ----------------------------- */
.ts-chat-attachment-image {
	display: inline-block;
	margin-top: 8px;
	border-radius: 10px;
	overflow: hidden;
	line-height: 0;
	transition: transform var(--ts-transition-fast), box-shadow var(--ts-transition-fast);
}

.ts-chat-attachment-image:hover {
	transform: scale(1.02);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.ts-chat-attachment-image img {
	max-width: 240px;
	max-height: 180px;
	border-radius: 10px;
	object-fit: cover;
	display: block;
	border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Images inside staff (dark) bubbles need visible border */
.ts-chat-bubble-staff .ts-chat-attachment-image img {
	border-color: rgba(255, 255, 255, 0.2);
}

/* Images inside original message */
.ts-original-message .ts-chat-attachment-image img {
	max-width: 280px;
	max-height: 200px;
}

/* ---- Attachment File Links (all contexts) --------------------------------- */
.ts-chat-attachment-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 6px;
	padding: 6px 12px;
	background: var(--ts-bg-secondary);
	border-radius: var(--ts-radius-sm);
	font-size: var(--ts-font-size-xs);
	font-weight: 500;
	text-decoration: none;
	color: var(--ts-primary);
	transition: background var(--ts-transition-fast);
}

.ts-chat-attachment-link:hover {
	background: var(--ts-bg-tertiary);
}

.ts-chat-bubble-client .ts-chat-attachment-link {
	background: rgba(0, 122, 255, 0.06);
	color: var(--ts-primary);
}

.ts-chat-bubble-staff .ts-chat-attachment-link {
	background: rgba(255, 255, 255, 0.15);
	color: var(--ts-white);
}

.ts-chat-bubble-staff .ts-chat-attachment-link:hover {
	background: rgba(255, 255, 255, 0.25);
}
