/* ==========================================================================
   Paranoia File Encryption - Application-Specific Styles (app.css)
   ========================================================================== */

/* ---------- Password Section ---------- */

.password-section {
	margin-top: 0.6em;
	margin-bottom: 0.5em;
	max-width: 24em;
}

.password-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 4px;
}

.password-header label {
	font-weight: bold;
	margin-bottom: 0;
}

.password-header .header-actions {
	display: flex;
	gap: 4px;
}

.password-input-wrapper {
	display: flex;
	align-items: center;
	position: relative; /* anchor for the overlaid clear (×) button */
	margin-top: 3px;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
	flex: 1;
	min-height: 22px;
	padding: 6px 32px 6px 8px; /* right pad leaves room for the overlaid × */
	font-size: 14px;
	border: 1px solid #999;
	border-radius: 3px;
	box-sizing: border-box;
}

.password-input-wrapper input[type="password"]:focus,
.password-input-wrapper input[type="text"]:focus {
	border-color: #098572;
	outline: none;
	box-shadow: 0 0 3px rgba(9, 133, 114, 0.3);
}

.btn-clear-password {
	position: absolute;
	right: 4px;
	background: none;
	border: none;
	font-size: 16px;
	color: #888;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
}

.btn-clear-password:hover {
	color: #cc0000;
}

.checkbox-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 3px;
}

.checkbox-row label {
	font-size: 80%;
	font-weight: normal;
}

/* ---------- Drop Zone ---------- */

.drop-zone {
	border: 2px dashed #AAAAAA;
	border-radius: 8px;
	padding: 1.5em 1em;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
	margin-bottom: 0.5em;
	background: #fafafa;
	-webkit-tap-highlight-color: transparent;
}

.drop-zone:hover,
.drop-zone.drag-over {
	border-color: #098572;
	background-color: #f0faf8;
}

.drop-zone-icon {
	font-size: 2em;
	margin-bottom: 0.2em;
	opacity: 0.6;
	line-height: 1;
}

.drop-zone p {
	margin: 0.3em 0;
	color: #666;
	font-size: 14px;
}

.drop-zone-or {
	font-size: 80%;
	color: #999;
}

.drop-zone-buttons {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 0.4em;
	flex-wrap: wrap;
}

/* ---------- File List ---------- */

.file-list {
	border: 1px solid #CCCCCC;
	border-radius: 4px;
	padding: 0.4em 0.6em;
	margin-bottom: 0.5em;
	background: #fff;
	max-height: 200px;
	overflow-y: auto;
}

.file-list-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 0.3em;
	border-bottom: 1px solid #eee;
	margin-bottom: 0.3em;
}

.file-list-header strong {
	font-size: 13px;
	color: #454545;
}

.file-list-count {
	font-size: 12px;
	color: #888;
}

.file-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.2em 0;
	font-size: 13px;
	border-bottom: 1px solid #f5f5f5;
}

.file-item:last-child {
	border-bottom: none;
}

.file-item-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
	color: #333;
}

.file-item-size {
	color: #888;
	font-size: 12px;
	margin-left: 0.8em;
	white-space: nowrap;
}

.file-item-enc {
	color: #098572;
}

.file-item-dir-header {
	border-bottom: 1px solid #ddd;
	padding-bottom: 0.3em;
	margin-bottom: 0.1em;
}

/* Remove button (X) per file row */
.file-item-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-left: 4px;
	cursor: pointer;
	flex-shrink: 0;
	color: #bbb;
	font-size: 13px;
	line-height: 1;
	border-radius: 3px;
	border: none;
	background: none;
	padding: 0;
}

.file-item-remove:hover {
	color: #cc0000;
	background: #ffeaea;
}

/* Add more files row inside file list */
.file-list-add-row {
	display: flex;
	gap: 6px;
	margin-top: 0.4em;
	padding-top: 0.3em;
	border-top: 1px solid #eee;
}

.file-list-add-row .btn-add-more {
	font-size: 12px;
	padding: 2px 8px;
	min-height: 0;
	height: auto;
}

/* ---------- Confirmation Dialog ---------- */

.confirm-dialog-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.confirm-dialog {
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 8px;
	padding: 1.2em 1.5em;
	max-width: 400px;
	width: 90%;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.confirm-dialog p {
	margin: 0 0 1em 0;
	font-size: 14px;
	color: #333;
	line-height: 1.4;
}

.confirm-dialog a {
	color: #0066aa;
	text-decoration: underline;
}

.confirm-dialog-buttons {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}

/* ---------- Action Row ---------- */

.action-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding-top: 0.3em;
	padding-bottom: 0.3em;
}

.action-spacer {
	flex: 1;
}

/* ---------- Gear Settings Button (bare icon in the H1 title bar — unified with PTE) ---------- */

header { position: relative; }
h1.asH2 { position: relative; }   /* anchor for the absolutely-positioned gear */

.btn-settings {
	position: absolute;
	top: 50%;
	right: 10px;
	transform: translateY(-50%);
	width: 24px;
	height: 24px;
	padding: 0;
	margin: 0;
	border: 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") no-repeat center center;
	background-size: 22px 22px;
	cursor: pointer;
	opacity: 0.7;
	-webkit-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
}

.btn-settings:hover,
.btn-settings:focus,
.btn-settings.active {
	opacity: 1;
	outline: none;
}

/* ---------- Settings Panel (compact) ---------- */

.settings-panel {
	position: absolute;
	top: 100%;
	right: 8px;
	z-index: 50;
	margin-top: 2px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: #f7f7f7;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 13px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.settings-panel label {
	white-space: nowrap;
	color: #555;
}

.settings-panel select {
	font-size: 13px;
	padding: 2px 6px;
	border: 1px solid #999;
	border-radius: 3px;
	background: #fff;
}

/* ---------- Progress ---------- */

.progress-section {
	margin: 0.6em 0;
}

.progress-container {
	width: 100%;
	height: 18px;
	background: #e8e8e8;
	border-radius: 9px;
	overflow: hidden;
	border: 1px solid #ccc;
}

.progress-bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(to bottom, #6ec6b8 0%, #098572 100%);
	border-radius: 9px;
	transition: width 0.3s ease;
}

.progress-bar.indeterminate {
	width: 100%;
	background: linear-gradient(to bottom, #6ec6b8 0%, #098572 100%);
	animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
	0% { opacity: 0.4; }
	50% { opacity: 1; }
	100% { opacity: 0.4; }
}

.progress-text {
	font-size: 12px;
	color: #666;
	margin-top: 4px;
	text-align: center;
}

/* ---------- Status / Error Messages ---------- */

.status-message {
	padding: 0.5em 0.7em;
	border-radius: 4px;
	margin: 0.5em 0;
	font-size: 13px;
}

.status-message.error {
	background: #ffeaea;
	border: 1px solid #e0a0a0;
	color: #aa0000;
}

.status-message.success {
	background: #eaffea;
	border: 1px solid #a0c0a0;
	color: #006600;
}

.status-message.info {
	background: #eaf0ff;
	border: 1px solid #a0b0d0;
	color: #334466;
}

.status-message.warning {
	background: #fff8e0;
	border: 1px solid #d4b040;
	color: #6b5a00;
}

.status-message.warning a {
	color: #0066aa;
	text-decoration: underline;
}

/* ---------- Output Section ---------- */

.output-section {
	border: 2px solid #098572;
	border-radius: 6px;
	padding: 0.7em;
	margin: 0.5em 0;
	background: #f6fffe;
}

.output-info {
	margin-bottom: 0.5em;
	font-size: 13px;
	color: #333;
}

.output-info strong {
	color: #098572;
}

.output-file-item {
	display: flex;
	align-items: center;
	padding: 0.25em 0;
	font-size: 13px;
}

.output-file-item + .output-file-item {
	border-top: 1px solid #e0efed;
}

.output-file-item-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
}

/* Inline download icon per file row */
.output-dl-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	margin-left: 6px;
	cursor: pointer;
	flex-shrink: 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 10.5l-3.5-3.5h2.5V2h2v5h2.5zM3 12h10v1.5H3z' fill='%23098572'/%3E%3C/svg%3E") no-repeat center center;
	background-size: 16px 16px;
	border-radius: 3px;
}

.output-dl-icon:hover {
	background-color: #e0f5f1;
}

/* Collapsible file list for >20 files */
.output-file-list-toggle {
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	padding: 0.2em 0;
}

.output-file-list-toggle:hover {
	opacity: 0.8;
}

.output-file-list-toggle .toggle-indicator {
	font-size: 100%;
	display: inline-block;
	transition: transform 0.2s;
}

.output-file-list-toggle .toggle-indicator.open {
	transform: rotate(90deg);
}

.output-file-list-body.collapsed {
	display: none;
}

.output-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 0.3em;
}

/* ---------- Processing Lock State ---------- */

body.processing .drop-zone,
body.processing .file-list,
body.processing .password-section input,
body.processing .action-row button,
body.processing .settings-panel select {
	pointer-events: none;
	opacity: 0.5;
}

/* ---------- Mobile Responsive ---------- */

@media (max-width: 600px) {
	body {
		margin-left: 0.4em;
		margin-right: 0.4em;
	}

	h1, h1.asH2, h2 {
		margin-left: -0.4em;
		margin-right: -0.4em;
		padding-left: 0.4em;
		padding-right: 0.4em;
	}

	div.gradient {
		margin-left: -0.4em;
		margin-right: -0.4em;
		padding-left: 0.4em;
		padding-right: 0.4em;
	}

	.password-input-wrapper {
		max-width: 100%;
	}

	.password-input-wrapper input[type="password"],
	.password-input-wrapper input[type="text"] {
		font-size: 16px; /* Prevents iOS zoom on focus */
	}

	.drop-zone {
		padding: 1.2em 0.8em;
	}

	button.downred-button,
	button.downgreen-button {
		min-width: 100px;
		height: 40px;
		font-size: 15px;
	}

	button.erase-button {
		height: 40px;
		font-size: 15px;
	}

	button.download-button {
		height: 40px;
		font-size: 15px;
		min-width: 120px;
	}

	.settings-panel select {
		font-size: 16px; /* Prevents iOS zoom */
	}
}

/* ---------- Touch Improvements ---------- */

@media (pointer: coarse) {
	.drop-zone {
		min-height: 100px;
	}

	button.downred-button,
	button.downgreen-button,
	button.erase-button,
	button.download-button,
	.btnLight {
		min-height: 44px;
	}

	.file-item {
		padding: 0.4em 0;
	}

	.output-file-item {
		padding: 0.35em 0;
	}

	.output-dl-icon {
		width: 32px;
		height: 32px;
		background-size: 20px 20px;
	}

	.checkbox-row {
		padding: 0.2em 0;
	}

	.checkbox-row input[type="checkbox"] {
		width: 18px;
		height: 18px;
		margin-right: 4px;
		vertical-align: middle;
	}

	.btn-clear-password {
		font-size: 18px;
		padding: 6px 9px; /* larger tap target for the overlaid × on touch */
	}
}
