/* LAYOUT PRINCIPAL */
main {
	max-width: 1200px;
	margin: 0 auto;
	padding: 1rem;
}

/* Dropdown menu styles */
.options-dropdown {
	display: none;
	position: fixed;
	background: white;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 0.75rem;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
	min-width: 140px;
	z-index: 1000;
	overflow: hidden;
	backdrop-filter: blur(10px);
	animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.option-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.75rem 1rem;
	border: none;
	background: none;
	font-size: 0.875rem;
	color: var(--tertiary-color);
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.option-item:last-child {
	border-bottom: none;
}

.option-item:hover {
	background: var(--primary-color);
	color: white;
}

.option-item:hover .option-icon {
	transform: scale(1.1);
}

.option-icon {
	font-size: 1rem;
	transition: transform 0.2s ease;
}

.option-item.delete-btn:hover {
	background: #ff4757;
}

/* Touch devices styles */
@media (hover: none) and (pointer: coarse) {
	#foldersDocuments > div > .item-options {
		opacity: 1; /* Siempre visible en dispositivos táctiles */
		background: rgba(255, 255, 255, 0.95);
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	}
	
	#foldersDocuments > div:active > .item-options {
		transform: scale(0.95);
	}
}

/* Loader styles */
.loader-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, 0.7);
	backdrop-filter: blur(5px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	transition: opacity 0.3s ease;
}

.loader-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.5rem;
}

.loader-text {
	color: white;
	font-size: 1.125rem;
	font-weight: 500;
	margin: 0;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* RESPONSIVE DESIGN */
@media screen and (min-width: 768px) {
	main {
		padding: 2rem;
	}
}

@media screen and (min-width: 1024px) {
	main {
		padding: 3rem;
	}
}

#folderForm {
	display: grid;
	gap: 1.6rem;
	margin-top: 1rem;
}

#folders {
	display: none;
}

#foldersDocuments {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 1.25rem;
	margin-bottom: 2rem;
	padding: 1rem 0;

	& > div {
		background: white;
		border: 1px solid rgba(0, 0, 0, 0.1);
		border-radius: 1rem;
		cursor: pointer;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 1.5rem 1rem;
		position: relative;
		transition: all 0.3s ease;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
		overflow: hidden;

		&::before {
			content: '';
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			height: 3px;
			background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
			transform: scaleX(0);
			transition: transform 0.3s ease;
		}

		&:hover {
			transform: translateY(-4px);
			box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
			border-color: var(--primary-color);
		}

		&:hover::before {
			transform: scaleX(1);
		}

		&:hover > .item-icon {
			transform: scale(1.1);
		}

		& > .item-icon {
			width: 5rem;
			height: 5rem;
			background: none;
			border-radius: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 4rem;
			color: var(--primary-color);
			margin-bottom: 1rem;
			transition: all 0.3s ease;
			box-shadow: none;
		}

		&[data-type="folder"] > .item-icon {
			color: #ff9500;
		}

		&[data-type="document"] > .item-icon {
			color: #00b86b;
		}

		& > img {
			display: none; /* Ocultamos las imágenes viejas */
		}

		& > p {
			font-size: 0.875rem;
			font-weight: 600;
			margin: 0;
			text-align: center;
			color: var(--tertiary-color);
			line-height: 1.4;
			word-break: break-word;
		}

		& > .item-options {
			position: absolute;
			top: 0.75rem;
			right: 0.75rem;
			width: 2rem;
			height: 2rem;
			background: rgba(255, 255, 255, 0.9);
			border: 1px solid rgba(0, 0, 0, 0.1);
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			cursor: pointer;
			opacity: 0;
			transition: all 0.3s ease;
			backdrop-filter: blur(10px);
		}

		&:hover > .item-options {
			opacity: 1;
		}

		& > .item-options:hover {
			background: var(--primary-color);
			color: white;
			transform: scale(1.1);
		}

		& > .item-options::before {
			content: '⋮';
			font-size: 1rem;
			font-weight: bold;
		}
	}
}

#loader {
	display: flex;
	justify-content: center;
}

.actions {
	display: flex;
	gap: 1rem;
	justify-content: flex-end;
}

/* Responsive design */
@media (max-width: 768px) {
	#foldersDocuments {
		grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
		gap: 1rem;
		padding: 0.5rem 0;

		& > div {
			padding: 1rem 0.75rem;

			& > .item-icon {
				width: 4rem;
				height: 4rem;
				font-size: 3rem;
				margin-bottom: 0.75rem;
			}

			& > p {
				font-size: 0.8rem;
			}

			& > .item-options {
				width: 1.75rem;
				height: 1.75rem;
				top: 0.5rem;
				right: 0.5rem;
				opacity: 1; /* Siempre visible en mobile */
				background: rgba(255, 255, 255, 0.95);
				box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
			}
		}
	}

	.actions {
		flex-direction: column;
		gap: 0.75rem;
	}

	.options-dropdown {
		min-width: 120px;
	}

	.option-item {
		padding: 0.6rem 0.8rem;
		font-size: 0.8rem;
	}
}

@media (max-width: 480px) {
	#foldersDocuments {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
		gap: 0.75rem;

		& > div {
			padding: 0.75rem 0.5rem;

			& > .item-icon {
				width: 3rem;
				height: 3rem;
				font-size: 2.5rem;
				margin-bottom: 0.5rem;
			}

			& > p {
				font-size: 0.75rem;
				line-height: 1.3;
			}

			& > .item-options {
				width: 1.5rem;
				height: 1.5rem;
				top: 0.4rem;
				right: 0.4rem;
				opacity: 1; /* Siempre visible en mobile pequeño */
				background: rgba(255, 255, 255, 0.95);
				box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
			}

			& > .item-options::before {
				font-size: 0.9rem;
			}
		}
	}
}
