/* style.css - Layout & Components */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
	font-family: var(--font-stack);
	background-color: var(--bg-body);
	padding: 40px;
	color: var(--text-main);
}

.board-container { max-width: 1400px; margin: 0 auto; position: relative; }

/* --- Header --- */
.app-header {
	text-align: center;
	margin-bottom: 40px;
	position: relative;
}

.app-title { font-size: 45px; font-weight: 700; color: var(--text-dark); margin-bottom: var(--space-sm); }
.app-subtitle { font-size: 16px; color: var(--text-muted); margin-bottom: var(--space-lg); }

/* --- Update Notification Button --- */
.update-notification {
	display: none;
	position: absolute;
	top: 10px;
	right: 0;
	background: #27ae60;
	color: white;
	padding: 8px 20px;
	border: none;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3);
	animation: pulse 2s infinite;
	transition: transform 0.2s;
	z-index: 100;
}

.update-notification:hover { transform: scale(1.05); }
.update-notification.visible { display: block; }

.update-notification .btn-icon { margin-left: 5px; font-size: 14px; }

.update-notification span { pointer-events: none; }

@keyframes pulse {
	0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.7); }
	70% { box-shadow: 0 0 0 10px rgba(39, 174, 96, 0); }
	100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

/* Search Bar Styles */
.search-wrapper {
	max-width: 400px;
	margin: 0 auto;
	position: relative;
}

.global-search-input {
	width: 100%;
	padding: 10px 16px;
	border: 1px solid var(--border-main);
	border-radius: 20px;
	background: var(--bg-input);
	font-size: 14px;
	color: var(--text-main);
	outline: none;
	transition: all 0.2s;
	box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.global-search-input:focus {
	border-color: var(--primary-color);
	box-shadow: 0 4px 8px rgba(52, 152, 219, 0.15);
}

/* --- Employee Section --- */
.employee-section {
	background: var(--bg-section);
	border-radius: var(--radius-lg);
	padding: var(--space-xl);
	margin-bottom: 35px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.employee-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 2px solid var(--border-main);
	background: var(--bg-header);
	margin: -30px -30px 25px -30px;
	padding: 20px 30px 15px 30px;
	cursor: move;
}

.employee-name {
	font-size: 30px;
	font-weight: 600;
	color: var(--primary-color);
	border: none;
	background: transparent;
	outline: none;
	flex: 1;
	padding: 5px;
	cursor: text;
}

.delete-employee-btn {
	background: #ececec;
	color: var(--text-medium);
	border: none;
	padding: var(--space-sm) 16px;
	border-radius: var(--radius-md);
	cursor: pointer;
	font-size: 14px;
	transition: background 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 36px;
}
.delete-employee-btn:hover { background: var(--border-input); }

.delete-employee-btn .btn-icon { display: none; }
.delete-employee-btn .btn-text { display: inline; }

/* --- Columns --- */
.columns-container {
	display: grid;
	grid-template-columns: 18% 54% 26%;
	gap: 15px;
	padding-right: 5px;
	align-items: start;
	cursor: default;
}

.column:nth-child(1) .column-title,
.column:nth-child(2) .column-title {
	padding-left: var(--space-md);
}

.column:nth-child(3) {
	border-left: 1px solid var(--border-main);
	padding-left: 15px;
}

.column-title {
	font-size: 16px;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: 15px;
}

/* --- Items (Rows) --- */
.item {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: var(--space-md);
	padding: 10px var(--space-md);
	background: var(--bg-input);
	border-radius: 6px;
	transition: background 0.2s, transform 0.2s;
	position: relative;
	height: 44px;
	cursor: move;
}
.item:hover { background: var(--bg-hover); }

/* Footer Items: NOT draggable */
.item.footer-item {
	cursor: default !important;
}

/* Consolidated Drag Styles */
.item.dragging,
.employee-section.dragging {
	opacity: 0.4;
	border: 2px dashed var(--border-main);
}
.employee-section.dragging { background: var(--bg-body); }

.item.drag-over,
.employee-section.drag-over {
	border-top: 2px solid var(--primary-color);
	transform: translateY(2px);
}
.employee-section.drag-over { transform: translateY(4px); border-top-width: 3px; }

.project-item {
	flex-wrap: wrap;
	align-content: center;
}

/* Standard Input Style */
.item-input {
	flex: 1;
	width: auto;
	border: none;
	background: transparent;
	outline: none;
	font-size: 15px;
	color: var(--text-dark);
	padding: 0;
	margin: 0;
	min-width: 0;
	height: 24px;
	line-height: 24px;
	font-family: var(--font-stack);
	cursor: text;
}
.item-input::placeholder { color: var(--text-placeholder); }

.delete-item-btn {
	opacity: 0.3;
	background: var(--border-main);
	color: #666;
	border: none;
	padding: 0 8px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-size: 12px;
	transition: opacity 0.2s;
	flex-shrink: 0;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.item:hover .delete-item-btn { opacity: 1; }

.add-employee-btn {
	width: 45px;
	height: 45px;
	border-radius: 50%;
	background: var(--border-main);
	color: var(--text-medium);
	border: none;
	font-size: 24px;
	cursor: pointer;
	display: block;
	margin: 0 auto;
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	transition: all 0.3s;
}
.add-employee-btn:hover {
	background: #c8c8c8;
	transform: scale(1.05);
	box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* --- Status Dropdown --- */
.status-dropdown {
	padding: 0 12px;
	border: none;
	border-radius: var(--radius-md);
	background: white;
	font-size: 13px;
	color: var(--text-medium);
	cursor: pointer;
	min-width: 110px;
	transition: all 0.2s;
	flex-shrink: 0;
	height: 28px;
	display: flex;
	align-items: center;
}
.status-dropdown:hover { opacity: 0.8; }
.status-dropdown:not([class*="status-"]) { background: var(--bg-section); }

.status-dropdown.status-upcoming { background: var(--status-upcoming-bg); color: var(--status-upcoming-text); }
.status-dropdown.status-working { background: var(--status-working-bg); color: var(--status-working-text); }
.status-dropdown.status-proofed { background: var(--status-proofed-bg); color: var(--status-proofed-text); }
.status-dropdown.status-changes { background: var(--status-changes-bg); color: var(--status-changes-text); }
.status-dropdown.status-complete { background: var(--status-complete-bg); color: var(--status-complete-text); }

/* --- Todos --- */
.checkbox-wrapper { position: relative; width: 20px; height: 20px; flex-shrink: 0; }
.checkbox-custom {
	width: 20px; height: 20px;
	border: 2px solid var(--primary-color);
	border-radius: var(--radius-sm);
	background: var(--primary-light);
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.checkbox-custom.checked { background: var(--text-dark); border-color: var(--text-dark); }
.checkbox-custom.checked::after { content: '✓'; color: white; font-size: 14px; font-weight: bold; }

.item.todo-item.completed-item { opacity: 0.6; }
.item-input.completed { text-decoration: line-through; color: var(--text-placeholder); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-placeholder); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-text { font-size: 18px; }

/* --- Custom Client Dropdown Styles --- */
.client-dropdown-container { position: relative; width: 100%; height: 100%; }

.client-button {
	width: 100%;
	height: 100%;
	border: none;
	background: transparent;
	text-align: left;
	color: var(--text-placeholder);
	cursor: pointer;
	font-size: 14px;
	padding: 0 5px;
	outline: none;
	display: flex;
	align-items: center;
}
.client-button.has-selection { color: var(--primary-color); font-weight: 700; }

.client-dropdown-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: -12px;
	width: calc(100% + 24px);
	background: var(--color-white);
	border: 1px solid var(--border-input);
	border-radius: var(--radius-md);
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	z-index: 1000;
	margin-top: 5px;
	padding-bottom: 0;
	overflow: hidden;
}
.client-dropdown-menu.active { display: block; }

/* DELETE MODE VISUALS */
.client-dropdown-menu.delete-mode {
	border: 1px solid var(--danger-color);
}

/* SHARED: Dropdown Section Container */
.dropdown-section {
	padding: var(--space-sm);
	background: var(--bg-hover);
	border-bottom: 1px solid var(--border-light);
}

.client-search-container { }
.client-add-container { display: none; }

/* SHARED: Dropdown Inputs */
.dropdown-input {
	width: 100%;
	padding: 6px;
	border-radius: var(--radius-md);
	font-size: 13px;
	outline: none;
}

.client-filter-input { border: 1px solid var(--gray-400); }
.client-add-input { border: 1px solid var(--primary-color); }

.client-list {
	max-height: 200px;
	overflow-y: auto;
}
.client-option {
	padding: var(--space-sm) var(--space-md);
	cursor: pointer;
	font-size: 14px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.client-option:hover { background: var(--primary-light); }
.client-option.selected {
	background: var(--bg-header);
	color: var(--primary-dark);
	font-weight: bold;
}

/* Prompt when no search results found */
.client-add-prompt {
	font-style: italic;
	color: var(--primary-color);
	background: var(--bg-hover);
	justify-content: center;
}
.client-add-prompt:hover { background: var(--border-light); }

.client-controls {
	display: flex;
	border-top: 1px solid var(--border-light);
	background: var(--bg-hover);
}

/* NEW: Text based toggle button */
.client-manage-btn {
	width: 100%;
	border: none;
	background: transparent;
	padding: 10px;
	cursor: pointer;
	color: var(--primary-color);
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	transition: background 0.2s, color 0.2s;
	text-align: center;
}
.client-manage-btn:hover {
	background: var(--bg-hover);
	color: var(--primary-dark);
}

/* Style for button when active (Delete Mode) */
.client-dropdown-menu.delete-mode .client-manage-btn {
	color: white;
	background: var(--danger-color);
}
.client-dropdown-menu.delete-mode .client-manage-btn:hover {
	background: #c0392b;
}

.client-delete-action {
	display: none;
	color: var(--danger-color);
	font-weight: bold;
	padding: 0 5px;
	border-radius: var(--radius-md);
}
.client-delete-action:hover { background: var(--danger-bg); }
.client-dropdown-menu.delete-mode .client-delete-action { display: block; }
.client-dropdown-menu.delete-mode .client-option { cursor: default; }

/* --- Footer Row Styles --- */
.footer-item {
	opacity: 0.6;
	transition: opacity 0.2s ease-in-out;
}
.footer-item:hover,
.footer-item:focus-within,
.footer-item.active { opacity: 1; }

/* --- App Status Indicator --- */
#app-status {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 9999;
	display: flex;
	gap: 10px;
	pointer-events: none; /* Let clicks pass through */
}

.status-item {
	padding: 8px 16px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 500;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.3s, transform 0.3s;
}
.status-item.visible {
	opacity: 0.95;
	transform: translateY(0);
}

.status-loading {
	background: var(--text-dark);
	color: var(--color-white);
}
.status-saving {
	background: var(--bg-body);
	color: var(--text-muted);
	border: 1px solid var(--border-main);
}
.status-success {
	background: var(--status-complete-bg);
	color: var(--status-complete-text);
}
.status-error {
	background: var(--danger-bg);
	color: var(--danger-color);
}

/* --- Undo Toast --- */
#undo-toast {
	position: fixed;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	z-index: 10000;
	background: var(--text-dark);
	color: var(--color-white);
	padding: 12px 24px;
	border-radius: 30px;
	box-shadow: 0 4px 15px rgba(0,0,0,0.3);
	display: flex;
	align-items: center;
	gap: 15px;
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s ease;
	overflow: hidden;
}

#undo-toast.visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
	pointer-events: all;
}

#undo-toast::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	height: 3px;
	background-color: var(--primary-color);
	width: 100%;
	transform-origin: left;
	transform: scaleX(0);
}

#undo-toast.counting-down::after {
	animation: toast-countdown 4s linear forwards;
}

@keyframes toast-countdown {
	from { transform: scaleX(1); }
	to { transform: scaleX(0); }
}

#undo-msg {
	font-size: 14px;
	font-weight: 500;
}

#undo-btn {
	background: transparent;
	border: none;
	color: var(--primary-color);
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	text-transform: uppercase;
	padding: 0;
}
#undo-btn:hover {
	color: var(--brand-blue-light);
}

/* --- MOBILE & RESPONSIVE LABELS --- */
.mobile-client-label {
	display: none;
	width: 100%;
	font-size: 11px;
	font-weight: 700;
	color: var(--primary-color);
	margin-bottom: 2px;
	text-transform: uppercase;
}

/* --- MEDIA QUERIES --- */
@media (max-width: 1024px) {
	.columns-container { grid-template-columns: 28% 72%; }

	.column:nth-child(1) { grid-column: 1 / 2; grid-row: 1; border-bottom: 1px solid var(--border-light); padding-bottom: 20px; }
	.column:nth-child(2) { grid-column: 2 / 3; grid-row: 1; border-bottom: 1px solid var(--border-light); padding-bottom: 20px; }

	.column:nth-child(3) {
		grid-column: 1 / 3;
		grid-row: 2;
		border-left: none;
		padding-left: 0;
		padding-top: 0;
		margin-top: 10px;
	}

	.column:nth-child(1) .column-title,
	.column:nth-child(2) .column-title { padding-left: var(--space-md); }
}

@media (max-width: 768px) {
	body { padding: 20px 10px; }
	.columns-container { display: block; }
	.column { min-height: auto; margin-bottom: 30px; }

	/* NEW: Compact Mobile Header */
	.app-header {
		max-width: 80vw;
		margin: 0 auto 40px auto;
	}
	.app-title { font-size: 36px; }

	.column:nth-child(1) { display: none; }
	.column:nth-child(2) { border-bottom: 1px solid var(--border-light); padding-bottom: 20px; margin-bottom: 20px; }
	.column-title { padding-left: var(--space-md) !important; }
	.column:nth-child(3) { border: none; padding: 0; margin: 0; }

	.mobile-client-label { display: block; }

	.project-item { height: auto; align-items: center; padding-top: 8px; padding-bottom: 8px; gap: 8px; }
	.mobile-client-label { width: 100%; margin-bottom: 4px; }
	.project-item .item-input { flex: 1; margin-top: 0; }

	.delete-employee-btn { padding: 0; width: 40px; }
	.delete-employee-btn .btn-text { display: none; }
	.delete-employee-btn .btn-icon { display: block; font-size: 18px; }
	.employee-name { font-size: 24px; }

	/* --- MOBILE: UPDATE ONLY MODE --- */
	.add-employee-btn { display: none; }
	.delete-employee-btn { display: none; }
	.delete-item-btn { display: none; }
	.project-item.footer-item { display: none; }

	.employee-header, .project-item, .todo-item { cursor: default !important; }

	/* Mobile Update Bug */
	.update-notification .btn-text { display: none; }
	.update-notification .btn-icon { margin-left: 0; font-size: 20px; }
	.update-notification {
		display: none;
		width: 40px;
		height: 40px;
		padding: 0;
		border-radius: 50%;
		align-items: center;
		justify-content: center;

		position: fixed;
		top: 15px;
		right: 15px;
		z-index: 2000;
	}

	.update-notification.visible {
		display: flex;
	}
}
