/**
 * Protected File Manager - Frontend Styles
 */

.pfm-file-manager {
	margin: 20px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.pfm-directory-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.pfm-item {
	display: flex;
	align-items: center;
	padding: 10px 12px;
	margin: 0;
	background: #fff;
	border-bottom: 1px solid #f0f0f0;
	cursor: pointer;
	transition: background-color 0.15s ease;
	position: relative;
	user-select: none;
}

.pfm-item.pfm-folder {
	cursor: pointer;
}

.pfm-item:last-child {
	border-bottom: none;
}

.pfm-item:hover {
	background: #f8f9fa;
}

.pfm-item.pfm-folder {
	font-weight: 500;
}

.pfm-item.pfm-folder:hover {
	background: #e8f4f8;
}

.pfm-item.pfm-file:hover {
	background: #f8f9fa;
}

.pfm-item.pfm-expanded {
	background: #f0f7fa;
}

.pfm-item.pfm-expanded:hover {
	background: #e8f4f8;
}

.pfm-folder-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	line-height: 1;
	text-align: center;
	margin-right: 10px;
	font-size: 14px;
	color: #666;
	cursor: pointer;
	user-select: none;
	transition: transform 0.2s ease, color 0.2s ease;
	flex-shrink: 0;
	pointer-events: none; /* Make it non-clickable, parent handles clicks */
}

.pfm-folder-toggle.pfm-collapsed {
	transform: rotate(0deg);
}

.pfm-folder-toggle.pfm-expanded {
	transform: rotate(90deg);
}

.pfm-icon {
	font-size: 18px;
	margin-right: 8px;
	width: 20px;
	text-align: center;
	flex-shrink: 0;
}

.pfm-name {
	flex: 1;
	color: #333;
	font-size: 14px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pfm-size {
	color: #666;
	font-size: 12px;
	margin-left: 12px;
	flex-shrink: 0;
}

.pfm-subdirectory {
	margin-left: 0;
	margin-top: 0;
	display: none;
	background: #fafafa;
}

.pfm-subdirectory .pfm-directory-list {
	border-left: 3px solid #0073aa;
	padding-left: 20px;
	margin-left: 20px;
}

.pfm-item.pfm-expanded > .pfm-subdirectory {
	display: block;
}

.pfm-error {
	color: #d63638;
	background: #fcf0f1;
	padding: 10px 15px;
	border-left: 4px solid #d63638;
	border-radius: 4px;
}

/* Modal Styles */
.pfm-modal {
	display: none;
	position: fixed;
	z-index: 100000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: auto;
	background-color: rgba(0, 0, 0, 0.5);
	animation: pfm-fadeIn 0.3s;
}

.pfm-modal.active {
	display: flex;
	align-items: center;
	justify-content: center;
}

@keyframes pfm-fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.pfm-modal-content {
	background-color: #fff;
	margin: auto;
	padding: 30px;
	border-radius: 8px;
	width: 90%;
	max-width: 400px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	animation: pfm-slideDown 0.3s;
}

@keyframes pfm-slideDown {
	from {
		transform: translateY(-50px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.pfm-modal-header {
	margin-bottom: 20px;
}

.pfm-modal-header h3 {
	margin: 0 0 10px 0;
	font-size: 1.5em;
	color: #333;
}

.pfm-modal-header p {
	margin: 0;
	color: #666;
	font-size: 0.9em;
}

.pfm-modal-body {
	margin-bottom: 20px;
}

.pfm-modal-body label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #333;
}

.pfm-modal-body input[type="password"] {
	width: 100%;
	padding: 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 1em;
	box-sizing: border-box;
}

.pfm-modal-body input[type="password"]:focus {
	outline: none;
	border-color: #0073aa;
	box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.pfm-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.pfm-btn {
	padding: 10px 20px;
	border: none;
	border-radius: 4px;
	font-size: 1em;
	cursor: pointer;
	transition: all 0.2s ease;
}

.pfm-btn-primary {
	background-color: #0073aa;
	color: #fff;
}

.pfm-btn-primary:hover {
	background-color: #005a87;
}

.pfm-btn-secondary {
	background-color: #f0f0f0;
	color: #333;
}

.pfm-btn-secondary:hover {
	background-color: #e0e0e0;
}

.pfm-message {
	margin-top: 10px;
	padding: 10px;
	border-radius: 4px;
	font-size: 0.9em;
}

.pfm-message-error {
	background-color: #fcf0f1;
	color: #d63638;
	border-left: 4px solid #d63638;
}

.pfm-message-success {
	background-color: #e8f5e9;
	color: #2e7d32;
	border-left: 4px solid #2e7d32;
}

.pfm-loading {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #f3f3f3;
	border-top: 2px solid #0073aa;
	border-radius: 50%;
	animation: pfm-spin 1s linear infinite;
	margin-left: 10px;
}

@keyframes pfm-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.pfm-item.loading {
	opacity: 0.7;
	pointer-events: none;
}

.pfm-loading-item {
	color: #666;
	font-style: italic;
	padding: 10px 12px !important;
	background: #f8f9fa !important;
}

/* Empty folder state */
.pfm-subdirectory:empty::before {
	content: "No items";
	display: block;
	padding: 20px;
	text-align: center;
	color: #999;
	font-style: italic;
	font-size: 13px;
}

/* Loading state */
.pfm-item.loading .pfm-name::after {
	content: "...";
	animation: pfm-dots 1.5s steps(4, end) infinite;
}

@keyframes pfm-dots {
	0%, 20% { content: "."; }
	40% { content: ".."; }
	60%, 100% { content: "..."; }
}

/* Responsive */
@media (max-width: 768px) {
	.pfm-modal-content {
		width: 95%;
		padding: 20px;
	}

	.pfm-item {
		padding: 10px 8px;
		font-size: 13px;
	}

	.pfm-folder-toggle {
		width: 22px;
		height: 22px;
		font-size: 12px;
	}

	.pfm-icon {
		font-size: 16px;
		width: 18px;
	}

	.pfm-subdirectory .pfm-directory-list {
		padding-left: 15px;
		margin-left: 15px;
	}
}
