/**
 * JWT Tool Styles - как на jwt.io
 */

/* ===== JWT Editor Layout ===== */
.jwt-editor {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr;
	gap: 0;
	min-height: 600px;
	background-color: var(--bs-body-bg);
}

.jwt-column {
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--bs-border-color);
	transition: background-color 0.2s ease;
}

.jwt-column:hover {
	background-color: rgba(0, 0, 0, 0.02);
}

.jwt-column:last-child {
	border-right: none;
}

/* ===== Column Header ===== */
.jwt-column__header {
	display: flex;
	align-items: center;
	padding: 0.75rem 1rem;
	background-color: var(--bs-light);
	border-bottom: 1px solid var(--bs-border-color);
	font-weight: 600;
	color: var(--bs-body-color);
	user-select: none;
}

.jwt-column__header .material-icons {
	font-size: 1.25rem;
}

/* ===== Column Badges ===== */
.jwt-column__badge {
	font-size: 0.75rem;
	font-weight: 500;
	padding: 0.25em 0.65em;
}

/* ===== Column Content ===== */
.jwt-column__content {
	flex: 1;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* ===== Token Input ===== */
.jwt-token-input {
	font-family: 'Courier New', Consolas, monospace;
	font-size: 0.875rem;
	resize: vertical;
	min-height: 200px;
	word-break: break-all;
	line-height: 1.5;
	background-color: var(--bs-body-bg);
	border: 1px solid var(--bs-border-color);
	border-radius: 0.375rem;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease;
}

.jwt-token-input:focus {
	border-color: var(--bs-primary);
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
	outline: none;
}

/* ===== JSON Input ===== */
.jwt-json-input {
	font-family: 'Courier New', Consolas, monospace;
	font-size: 0.85rem;
	resize: vertical;
	min-height: 300px;
	line-height: 1.5;
	background-color: var(--bs-body-bg);
	border: 1px solid var(--bs-border-color);
	border-radius: 0.375rem;
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease;
}

.jwt-json-input:focus {
	border-color: var(--bs-primary);
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
	outline: none;
}

/* ===== Actions ===== */
.jwt-actions {
	gap: 0.5rem;
	margin-top: 0.75rem;
}

/* ===== Claims Info ===== */
.jwt-claims-info {
	display: flex;
	gap: 0.5rem;
}

/* ===== Verification Section ===== */
.jwt-verification {
	background-color: var(--bs-light);
	border: 1px solid var(--bs-border-color);
	border-radius: 0.5rem;
	padding: 1rem;
	transition: all 0.2s ease;
}

.jwt-verification__header {
	display: flex;
	align-items: center;
	font-weight: 600;
	color: var(--bs-warning);
	margin-bottom: 0.75rem;
}

.jwt-verification__result {
	margin-top: 0.75rem;
}

/* ===== Algorithm Badge ===== */
.jwt-algorithm-badge {
	display: inline-block;
}

.jwt-algorithm-badge select {
	width: 100%;
}

/* ===== JSON Error ===== */
.jwt-json-error {
	font-weight: 600;
}

/* ===== Update Status ===== */
#lastUpdated {
	transition: color 0.2s;
}

/* ===== Claims Validation ===== */
.jwt-claims-validation {
	background-color: var(--bs-light);
	border: 1px solid var(--bs-border-color);
	border-radius: 0.375rem;
	padding: 0.75rem;
}

.jwt-claims-validation .warning-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	font-size: 0.875rem;
}

.jwt-claims-validation .warning-item:last-child {
	margin-bottom: 0;
}

/* ===== Dark Mode ===== */
[data-bs-theme='dark'] .jwt-column {
	border-right-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme='dark'] .jwt-column:hover {
	background-color: rgba(255, 255, 255, 0.02);
}

[data-bs-theme='dark'] .jwt-column__header {
	background-color: rgba(255, 255, 255, 0.05);
	border-bottom-color: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme='dark'] .jwt-token-input,
[data-bs-theme='dark'] .jwt-json-input {
	background-color: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme='dark'] .jwt-token-input:focus,
[data-bs-theme='dark'] .jwt-json-input:focus {
	background-color: rgba(255, 255, 255, 0.08);
	border-color: var(--bs-primary);
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

[data-bs-theme='dark'] .jwt-verification {
	background-color: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme='dark'] .jwt-claims-validation {
	background-color: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.1);
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
	.jwt-editor {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.jwt-column {
		border-right: none;
		border: 1px solid var(--bs-border-color);
		border-radius: 0.5rem;
	}

	.jwt-token-input,
	.jwt-json-input {
		min-height: 150px;
	}
}

@media (max-width: 576px) {
	.jwt-column__header {
		font-size: 0.9rem;
	}

	.jwt-actions,
	.jwt-claims-info {
		flex-wrap: wrap;
	}

	.jwt-actions .btn,
	.jwt-claims-info .btn {
		flex: 1;
		min-width: 120px;
	}

	.jwt-column__badge {
		font-size: 0.7rem;
	}
}

/* ===== Animations ===== */
@keyframes pulse {
	0%,
	100% {
		opacity: 1;
	}
	50% {
		opacity: 0.6;
	}
}

.jwt-column__content.updated {
	animation: pulse 0.5s ease-in-out;
}

/* ===== JWT Loading Spinner ===== */
.jwt-loading {
	display: inline-block;
	width: 1rem;
	height: 1rem;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: jwt-spin 0.6s linear infinite;
}

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

/* ===== Material Icons Fix for Buttons ===== */
.jwt-actions .btn .material-icons,
.jwt-claims-info .btn .material-icons {
	white-space: nowrap;
	vertical-align: middle;
	font-size: inherit;
	width: auto;
	display: inline-block;
	flex-shrink: 0;
}

/* Fix for span width in buttons */
.btn .material-icons {
	min-width: 0 !important;
	width: auto !important;
	display: inline-block !important;
	flex-shrink: 0 !important;
	flex-grow: 0 !important;
}

/* Specific fix for decodeTokenBtn */
#decodeTokenBtn .material-icons {
	flex-shrink: 0;
	flex-grow: 0;
	white-space: nowrap;
}
