<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MergePDFWindow.aspx.cs" Inherits="PDI.Web.MergePDFWindow" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Unir PDFs</title>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
	<style>
		body, html {
			font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
			font-size: 14px;
			margin: 0;
			padding: 0;
			background-color: #fafafa;
			color: #333;
		}

		.window-container {
			padding: 16px 20px;
		}

		h3 {
			font-size: 0.95rem;
			color: #6D214F;
			margin: 0 0 10px 0;
			font-weight: 600;
		}

		.input-group {
			margin-bottom: 12px;
		}

		.input-group label {
			display: block;
			margin-bottom: 4px;
			font-weight: 600;
			font-size: 0.85rem;
			color: #555;
		}

		input[type="text"], select {
			width: 100%;
			padding: 8px 10px;
			border: 1px solid #ccc;
			border-radius: 5px;
			font-size: 0.9rem;
			font-family: inherit;
			background: #fff;
			color: #333;
			box-sizing: border-box;
			transition: border-color 0.2s;
		}

		select {
			-webkit-appearance: menulist;
			appearance: menulist;
		}

		input[type="text"]:focus, select:focus {
			border-color: #6D214F;
			outline: none;
		}

		input[type="submit"] {
			width: 100%;
			padding: 8px 16px;
			background: transparent;
			color: #6D214F;
			border: 1.5px solid #6D214F;
			border-radius: 5px;
			font-size: 0.9rem;
			font-weight: 600;
			cursor: pointer;
			transition: all 0.2s;
			font-family: inherit;
			margin-top: 6px;
		}

		input[type="submit"]:hover {
			background: #6D214F;
			color: #fff;
		}

		.doc-summary {
			background: #f3eef1;
			border-radius: 5px;
			padding: 10px 14px;
			margin-bottom: 14px;
			font-size: 0.85rem;
			color: #555;
		}

		.doc-summary strong {
			color: #6D214F;
		}

		.status-label {
			display: block;
			margin-top: 8px;
			font-size: 0.85rem;
		}

		.status-success {
			color: #27ae60;
		}

		.status-error {
			color: #d9534f;
		}

		.checkbox-group {
			margin-top: 10px;
			margin-bottom: 4px;
		}

		.checkbox-group label {
			display: inline-flex;
			align-items: center;
			gap: 6px;
			cursor: pointer;
			font-size: 0.85rem;
			color: #555;
			font-weight: 500;
		}

		.checkbox-group input[type="checkbox"] {
			accent-color: #6D214F;
			width: 15px;
			height: 15px;
		}
	</style>
</head>
<body>
	<form id="form1" runat="server">
		<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
		<div class="window-container">
			<h3>Unir Documentos en un Solo PDF</h3>

			<div class="doc-summary">
				<strong><asp:Label ID="lblDocCount" runat="server" /></strong> documentos seleccionados
			</div>

			<div class="input-group">
				<label>Nombre del archivo resultante:</label>
				<asp:TextBox ID="txtFilename" runat="server" MaxLength="200" placeholder="Ej: Expediente-Completo.pdf" />
			</div>

			<div class="input-group">
				<label>Carpeta destino:</label>
				<asp:DropDownList ID="ddlFolder" runat="server" />
			</div>

			<div class="checkbox-group">
				<label>
					<asp:CheckBox ID="chkDeleteOriginals" runat="server" />
					Eliminar individuales despu&eacute;s de unir
				</label>
			</div>

			<asp:Button ID="btnMerge" runat="server" Text="Continuar" OnClick="btnMerge_Click" OnClientClick="return validateMerge();" />
			<asp:Label ID="lblStatus" runat="server" CssClass="status-label" />
		</div>
		<script type="text/javascript">
			function closeWindow() {
				if (window.parent && window.parent.PDIModal) window.parent.PDIModal.closeFromChild();
			}

			function validateMerge() {
				var chk = document.getElementById('<%= chkDeleteOriginals.ClientID %>');
				if (chk && chk.checked) {
					return confirm('Al eliminar los documentos individuales:\n\n' +
						'- Se dejaran de compartir con otros usuarios\n' +
						'- Se removeran de todas las listas\n' +
						'- Se eliminaran los archivos fisicos y registros\n\n' +
						'Desea continuar?');
				}
				return true;
			}
		</script>
	</form>
</body>
</html>
