/**
 * TOURIST.VISION — Files без Bootstrap
 * Классы виджета (.fileinput-button, .start, .progress-bar) оставляем для JS Alex300/files.
 */

/* Совместимость с AvatarUploader.js (classList hidden) без Bootstrap */
.hidden {
	display: none !important;
}

/* —— Кнопки виджета загрузки —— */
.tv-files-btn,
.file-upload .fileinput-button,
.file-upload .start,
.file-upload .cancel,
.file-upload .delete,
.file-upload .files-replace-button,
.file-upload-avatar .fileinput-button {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	padding: 0.45em 0.85em;
	border: 1px solid transparent;
	border-radius: 2px;
	background: #1a1a1a;
	color: #fff;
	font: inherit;
	line-height: 1.3;
	cursor: pointer;
	text-decoration: none;
	vertical-align: middle;
}

.file-upload .fileinput-button,
.file-upload-avatar .fileinput-button {
	position: relative;
	overflow: hidden;
	background: #2d6a4f;
}

.file-upload .start,
.file-upload .files-replace-button {
	background: #1d3557;
}

.file-upload .cancel {
	background: #b08900;
	color: #111;
}

.file-upload .delete {
	background: #9b2226;
}

.tv-files-btn--primary,
.tv-files-actions .uk-button-primary {
	/* UIkit primary остаётся; фолбэк ниже */
}

.tv-files-btn--muted {
	background: #555;
}

.tv-files-btn[disabled],
.file-upload .start[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

/* —— Progress (JS ищет .progress / .progress-bar) —— */
.file-upload .progress,
.tv-files-progress,
.pfs .progress {
	position: relative;
	height: 1.1em;
	margin: 0.5em 0;
	overflow: hidden;
	background: #e8e8e8;
	border-radius: 2px;
}

.file-upload .progress-bar,
.tv-files-progress__bar,
.pfs .progress-bar {
	height: 100%;
	width: 0;
	background: #2d6a4f;
	color: #fff;
	font-size: 0.75em;
	line-height: 1.1em;
	text-align: center;
	transition: width 0.2s ease;
}

.progress-bar-info { background: #457b9d; }
.progress-bar-warning { background: #e9c46a; color: #222; }
.progress-bar-danger { background: #9b2226; }
.progress-bar-success { background: #2d6a4f; }

.progress-striped.active .progress-bar,
.progress.progress-striped.active .progress-bar {
	background-image: linear-gradient(
		45deg,
		rgba(255, 255, 255, 0.15) 25%,
		transparent 25%,
		transparent 50%,
		rgba(255, 255, 255, 0.15) 50%,
		rgba(255, 255, 255, 0.15) 75%,
		transparent 75%,
		transparent
	);
	background-size: 1rem 1rem;
}

/* —— Таблица файлов —— */
.file-upload .filesTable {
	width: 100%;
	border-collapse: collapse;
	margin-top: 0.75em;
}

.file-upload .filesTable td {
	padding: 0.5em 0.4em;
	border-bottom: 1px solid #ddd;
	vertical-align: top;
}

.file-upload .filesTable .name {
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

/* —— Dropzone —— */
.file-upload .dropzone {
	text-align: center;
	font-weight: 700;
	padding: 0.75em;
	margin: 0.5em 0;
	border: 1px dashed #aaa;
	background: #f7f7f7;
}

.file-upload .dropzone.in {
	font-size: larger;
	border-color: #2d6a4f;
}

.file-upload-buttonbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	align-items: center;
	margin-bottom: 0.5em;
}

.file-upload-buttonbar .toggle[type='checkbox'] {
	transform: scale(1.4);
	margin-left: 0.35em;
}

.tv-files-hint {
	width: 100%;
	font-size: 0.9em;
	color: #555;
	text-align: center;
}

.tv-files-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

/* —— Галерея страницы / список —— */
.tv-files-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: 1rem;
}

.tv-files-gallery__item {
	margin: 0;
}

.tv-files-gallery__item img {
	display: block;
	width: 100%;
	height: auto;
}

.tv-files-gallery__item figcaption {
	margin-top: 0.35em;
	font-size: 0.85em;
	color: #444;
}

.tv-files-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
	gap: 0.75rem;
}

.tv-files-list__item {
	text-align: center;
	overflow: hidden;
}

.tv-files-list__item img {
	max-width: 100%;
	height: auto;
}

/* —— PFS / folders —— */
.tv-files-toolbar {
	display: flex;
	justify-content: flex-end;
	gap: 0.5em;
	margin: 0.75em 0;
}

.tv-files-meta {
	margin: 1em 0 0.5em;
}

.tv-files-quota {
	margin: 1em 0;
	padding: 0.75em 1em;
	background: #f3f3f3;
	border: 1px solid #ddd;
}

.tv-files-exts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
	margin-top: 0.5em;
}

.tv-files-exts__item {
	text-align: center;
	font-size: 0.85em;
}

.tv-files-folder-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
	gap: 0.75rem;
	margin: 0.5em 0 1em;
}

.tv-files-folder-file {
	display: flex;
	gap: 0.5em;
	align-items: flex-start;
}

.tv-files-folder-file__icon {
	width: 50px;
	flex-shrink: 0;
}

.tv-files-form-row {
	margin-bottom: 1em;
}

.tv-files-form-row label {
	display: block;
	margin-bottom: 0.25em;
	font-weight: 600;
}

.tv-files-iframe {
	width: 100%;
	min-height: 420px;
	border: 0;
}

.tv-files-table {
	width: 100%;
	border-collapse: collapse;
}

.tv-files-table th,
.tv-files-table td {
	padding: 0.4em 0.5em;
	border-bottom: 1px solid #ddd;
	vertical-align: middle;
}

.tv-files-table .tv-files-actions {
	white-space: nowrap;
}

.tv-files-paste-help {
	margin-top: 1em;
	padding: 0.75em 1em;
	background: #f3f3f3;
	border: 1px solid #ddd;
}

@media (max-width: 767px) {
	.fileupload-buttonbar .delete,
	.fileupload-buttonbar .toggle,
	.files .toggle {
		display: none;
	}

	.tv-files-col-size {
		display: none;
	}
}
