:root {
    --color-text: #333;
    --color-white: #fff;
    --color-black: #000;

    --bg-gradient-main: linear-gradient(135deg, #f5f7fa 0%, #fceaea 100%);
    --bg-light: #fdf2f2;
    --bg-lighter: #fde8e8;
    --bg-lightest: #fff5f5;
    --bg-neutral: #f8f9fa;
    --bg-neutral-alt: #e9ecef;

    --red-main: #cf3030;
    --red-dark: #b02828;
    --red-darker: #9a2222;
    --red-deep: #8b1a1a;
    --red-soft: #a94442;
    --red-border: #f5c2c2;
    --red-border-hover: #e6a1a1;

    --shadow-dark: rgba(0, 0, 0, 0.15);
    --shadow-medium: rgba(0, 0, 0, 0.12);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-red: rgba(207, 48, 48, 0.6);
    --shadow-red-strong: rgba(207, 48, 48, 0.7);
    --shadow-red-light: rgba(207, 48, 48, 0.3);
    --overlay-light: rgba(255, 255, 255, 0.95);

    --grey-dark: #495057;
    --grey-medium: #7f8c8d;
    --grey-border: #e0e0e0;
    --grey-border-light: var(--grey-border-light);

    --accent-blue-light: rgba(52, 152, 219, 0.2);
}

.auth-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--bg-gradient-main);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10000;
}

.auth-container {
	background: white;
	padding: 30px;
	border-radius: 12px;
	box-shadow: 0 10px 30px var(--shadow-dark);
	width: 90%;
	max-width: 450px;
	text-align: center;
}

.auth-logo {
	filter: brightness(0);
	max-width: 180px;
	margin-bottom: 15px;
}

.auth-header h2 {
	color: var(--red-main);
	margin: 0 0 20px;
	font-size: 1.4rem;
}

.auth-tabs {
	display: flex;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--grey-border);
}

.tab {
	flex: 1;
	padding: 12px;
	background: none;
	border: none;
	font-weight: 600;
	color: #777;
	cursor: pointer;
	border-bottom: 3px solid transparent;
}

.tab.active {
	color: var(--red-main);
	border-bottom: 3px solid var(--red-main);
}

.auth-form {
	display: none;
}

.auth-form.active-form {
	display: block;
}

.auth-form input {
	width: 100%;
	padding: 12px;
	margin: 8px 0;
	border: 1px solid #ccc;
	border-radius: 6px;
	box-sizing: border-box;
	font-size: 1rem;
}

.auth-form button {
	width: 100%;
	padding: 12px;
	background: var(--red-main);
	color: white;
	border: none;
	border-radius: 6px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	margin: 15px 0 10px;
	transition: background 0.2s;
}

.auth-form button:hover {
	background: var(--red-dark);
}

.auth-error {
	color: #d32f2f;
	font-size: 0.9rem;
	min-height: 1.2rem;
	margin-top: -8px;
}

body {
	margin: 0;
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background: var(--bg-gradient-main);
	color: var(--color-text);
	line-height: 1.6;
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
}

#mainApp {
	display: none;
	flex-direction: column;
	min-height: 100vh;
}

#mainApp.visible {
	display: flex;
}

#mainApp > footer {
	margin-top: auto;
	text-align: center;
	padding: 25px;
	color: var(--grey-medium);
	font-size: 0.95rem;
	background: var(--bg-neutral);
	border-top: 1px solid var(--bg-neutral-alt);
}

.banner {
	background: linear-gradient(to right, var(--red-main), var(--red-dark));
	padding: 20px 40px;
	border-bottom: 1px solid var(--red-darker);
	box-shadow: 0 4px 12px var(--shadow-dark);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.banner .logo {
	max-width: 280px;
	height: auto;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.logo {
	max-height: 40px;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.auth-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: flex-end;
}

.reset-password-btn {
	background: rgba(255,255,255,0.2);
	color: white;
	border: 1px solid white;
	padding: 8px 16px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 500;
	transition: background 0.2s;
	margin-inline-start: 40px;
}

.reset-password-btn:hover {
	background: rgba(255,255,255,0.3);
}

/* Password Reset Modal */
.modal {
	position: fixed;
	z-index: 2000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.5);
	display: flex;
	justify-content: center;
	align-items: center;
}

.modal-content {
	background: white;
	padding: 25px;
	border-radius: 10px;
	width: 90%;
	max-width: 400px;
	text-align: center;
	margin: 10px;
}

.modal-content input {
	width: 100%;
	padding: 10px;
	margin: 8px 0;
	border: 1px solid #ccc;
	border-radius: 4px;
	box-sizing: border-box;
}

.modal-content button {
	width: 100%;
	padding: 10px;
	background: var(--red-main);
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	margin-top: 10px;
}

.close-modal {
	float: right;
	font-size: 24px;
	cursor: pointer;
}

.logout-btn { 
	background: rgba(255,255,255,0.2);
	color: white;
	border: 1px solid white;
	padding: 8px 16px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 500;
	transition: background 0.2s;
}

.logout-btn:hover {
	background: rgba(255,255,255,0.3);
}

.loading {
	text-align: center;
	padding: 20px;
	color: #666;
}

.no-documents, .error-message {
	text-align: center;
	padding: 20px;
	color: #666;
	font-style: italic;
}

.error-message {
	color: #d32f2f;
}

.section-title {
	padding-top: 25px;
	text-align: center;
	color: var(--red-deep);
	font-size: 2.2rem;
	margin-bottom: 10px;
	text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.section-subtitle {
	text-align: center;
	color: var(--red-soft);
	font-size: 1.1rem;
	margin-top: 0;
	margin-bottom: 30px;
	font-weight: 400;
}

.container {
	max-width: 900px;
	width: 80%;
	margin: 0 auto;
	padding: 30px;
	background-color: var(--color-white);
	border-radius: 12px;
	box-shadow: 0 8px 30px var(--shadow-medium);
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	flex: 0 1 auto;
	min-height: 0;
	margin-bottom: 30px;
}

.container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: linear-gradient(to right, var(--red-main), var(--red-dark));
}

.search-options {
	display: flex;
	justify-content: center;
	gap: 30px;
	margin-bottom: 25px;
	flex-wrap: wrap;
}

.option-card {
	background: var(--bg-light);
	border: 2px solid var(--red-border);
	border-radius: 10px;
	padding: 20px 30px;
	cursor: pointer;
	transition: all 0.3s ease;
	text-align: center;
	min-width: 180px;
}

.option-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px var(--shadow-red);
}

.option-card.selected {
    background: var(--bg-lighter);
    border-color: var(--red-main);
    box-shadow: 0 0 15px var(--shadow-red);
}

.option-card.selected h3 {
	color: var(--red-dark);
}

.option-card h3 {
	margin: 0 0 10px;
	color: var(--red-deep);
	font-size: 1.3rem;
}

.option-card p {
	margin: 0;
	color: var(--color-black);
	font-size: 0.95rem;
}

.input-section {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin-bottom: 30px;
	background: var(--bg-light);
	padding: 25px;
	border-radius: 10px;
	border: 1px solid var(--red-border);
}

.input-group {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	align-items: center;
}

.input-group label {
	font-weight: 600;
	color: var(--grey-dark);
	min-width: 100px;
}

#folderNameInput {
	flex-grow: 1;
	padding: 14px 18px;
	border: 2px solid var(--red-border);
	border-radius: 8px;
	font-size: 16px;
	outline: none;
	transition: border-color 0.3s;
}

#folderNameInput:focus {
	border-color: var(--red-main);
	box-shadow: 0 0 0 3px var(--accent-blue-light)
}

.button-group {
	display: flex;
	justify-content: center;
	gap: 15px;
	margin-top: 10px;
}

.file-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(385px, 1fr));
	gap: 25px;
	padding-top: 25px;
	border-top: 1px solid var(--grey-border-light);
	margin-top: 20px;
	flex: 1;
	min-height: 0;
}

.grid-item {
	background: linear-gradient(to bottom, var(--color-white), var(--bg-neutral));
	border: 1px solid var(--grey-border);
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 5px 15px var(--shadow-light);
	display: flex;
	flex-direction: column;
	transition: transform 0.3s ease-in-out, box-shadow 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-7px);
    box-shadow: 0 0 18px rgba(207, 48, 48, 0.4);
}

.grid-item-header {
	background: linear-gradient(to right, var(--red-main), var(--red-dark));
	padding: 15px;
	font-weight: bold;
	text-align: center;
	word-break: break-all;
	color: white;
	font-size: 1.1rem;
}

.preview-container {
	flex-grow: 1;
	position: relative;
	background-color: var(--color-white);
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 220px;
	overflow: hidden;
}

.preview-iframe.transfer {
	width: 1080px;
	height: 500px;
	transform: translateX(-50%) scale(0.4);
}

.preview-iframe.retention {
	width: 1620px;
	height: 750px;
	transform: translateX(-50%) scale(0.3);
}

.preview-iframe {
	border: none;
	display: block;
	background-color: white;
	transform-origin: top center;
	position: absolute;
	top: 0;
	left: 50%;
}

.preview-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--overlay-light);
	display: flex;
	justify-content: center;
	align-items: center;
	font-style: italic;
	color: var(--grey-medium);
	z-index: 10;
	pointer-events: none;
}

.grid-item-footer {
	padding: 15px;
	background: var(--bg-light);
	text-align: center;
	border-top: 1px solid var(--red-border);
	display: flex;
	gap: 12px;
	justify-content: center;
}

.open-button,
.download-button {
	flex: 1;
	padding: 12px 15px;
	color: white;
	text-decoration: none;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 15px;
	transition: all 0.2s ease;
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.open-button {
    background: transparent;
    border: 2px solid var(--red-darker);
    color: var(--red-darker);
}

.open-button:hover {
    background: var(--red-darker);
    color: white;
}

.download-button {
	background: linear-gradient(to right, var(--red-main), var(--red-dark));
}

.download-button:hover {
    background: linear-gradient(to right, var(--red-dark), var(--red-darker));
    box-shadow: 0 0 15px var(--shadow-red);
}

.search-type-indicator {
	display: inline-block;
	background: var(--red-main);
	color: white;
	padding: 5px 12px;
	border-radius: 20px;
	font-size: 0.9rem;
	margin-left: 10px;
	vertical-align: middle;
}

@media (min-width: 768px) {
	.banner {
        padding: 20px 40px;
    }
}

@media (max-width: 600px) {
    .container {
        margin-bottom: 30px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .input-group label {
        min-width: auto;
        font-size: 0.9rem;
    }

    #folderNameInput {
        font-size: 14px;
        padding: 10px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }
	
    #transferOption {
	margin-top: 15px;
    }

    #retentionOption {
	margin-top: -5px;
    }

    .option-card {
        padding: 15px;
        min-width: auto;
        width: 100%;
    }

    .file-grid {
        grid-template-columns: 1fr;
    }

	.banner {
		display: grid;
		grid-template-columns: 1fr;
		grid-auto-rows: auto;
		justify-items: center;
		gap: 12px;
		text-align: center;
		padding: 16px 16px;
		box-sizing: border-box;
		width: 100%;
	}

	.banner .logo {
		max-width: 200px;
		margin-bottom: 10px;
	}

	.auth-actions {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 10px;
		width: 100%;
		box-sizing: border-box;
		align-self: stretch;
	}

	.auth-actions button {
		min-width: 0;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		margin-inline-start: 0px;
	}
}

.instructions {
	background: var(--bg-lighter);
	padding: 20px;
	border-radius: 8px;
	margin: 25px 0;
	border-left: 4px solid var(--red-main);
}

.instructions h3 {
	margin-top: 0;
	color: var(--red-deep);
}

.instructions ol {
	padding-left: 20px;
}

.instructions li {
	margin-bottom: 10px;
}

.forgot-password {
	display: block;
	text-align: center;
	margin-top: 8px;
	color: #666;
	text-decoration: none;
	font-size: 0.9rem;
}

.forgot-password:hover {
	color: var(--red-main);
	text-decoration: underline;
}

#forgotPasswordModal {
	position: fixed;
	z-index: 11000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0,0,0,0.5);
	display: none;
	justify-content: center;
	align-items: center;
}

#toastContainer {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 20000;
	display: flex;
	flex-direction: column-reverse;
	gap: 10px;
	max-width: 350px;
}

.toast {
	padding: 15px 20px;
	border-radius: 8px;
	color: white;
	font-weight: 500;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	animation: fadeInUp 0.3s, fadeOutDown 0.3s var(--toast-delay, 4700ms);
	animation-fill-mode: forwards;
	display: flex;
	align-items: center;
	gap: 10px;
}

.toast.success {
	background: #107C10;
}

.toast.info {
	background: #2196F3;
}

.toast.error {
    background: var(--red-main);
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeOutDown {
	from {
		opacity: 1;
		transform: translateY(0);
	}

	to {
		opacity: 0;
		transform: translateY(20px);
	}
}

.password-requirements {
	font-size: 0.85rem;
	color: var(--grey-medium);
	margin-top: -8px;
	margin-bottom: 8px;
}