/* Admin Dashboard Layout */
#admin-wrapper {
	display: flex;
	height: 100vh;
}

#admin-sidebar {
	width: 200px;
	background: hotpink;
	color: white;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1rem;
	flex-shrink: 0;
}

#admin-sidebar button {
	background: white;
	color: hotpink;
	border: none;
	padding: 0.5rem;
	border-radius: 0.5rem;
	cursor: pointer;
	text-align: left;
	transition: all 0.3s ease;
}

#admin-sidebar button:hover {
	background: #f0f0f0;
	transform: translateY(-1px);
}

#admin-sidebar .back-to-store-btn {
	background: #28a745 !important;
	color: white !important;
	font-weight: 600;
	margin-bottom: 1rem;
	text-align: center;
	border: 2px solid #28a745;
}

#admin-sidebar .back-to-store-btn:hover {
	background: #218838 !important;
	border-color: #218838;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

#admin-main {
	flex: 1;
	padding: 1rem;
	overflow-y: auto;
	background: #f8f9fa;
}

/* Admin Header */
.admin-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 2rem;
	padding: 1rem;
	background: white;
	border-radius: 0.5rem;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-header h2 {
	margin: 0;
	color: hotpink;
}

/* Products Grid */
.products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 1.5rem;
	margin-bottom: 2rem;
}

.product-card {
	background: white;
	border-radius: 0.5rem;
	padding: 1rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	transition:
		transform 0.2s ease,
		box-shadow 0.2s ease;
}

.product-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.product-image {
	width: 100%;
	height: 200px;
	margin-bottom: 1rem;
	border-radius: 0.5rem;
	overflow: hidden;
	background: #f5f5f5;
}

.product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.product-info h3 {
	margin: 0 0 0.5rem 0;
	color: #333;
	font-size: 1.2rem;
}

.product-price {
	font-size: 1.1rem;
	font-weight: bold;
	color: hotpink;
	margin: 0.5rem 0;
}

.product-description {
	color: #666;
	font-size: 0.9rem;
	line-height: 1.4;
	margin: 0.5rem 0 1rem 0;
	max-height: 3.6rem;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.product-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 1rem;
}

/* Button Variations */
.primary-btn {
	background: hotpink;
	color: white;
	border: none;
	padding: 0.75rem 1.5rem;
	border-radius: 0.5rem;
	cursor: pointer;
	font-weight: 600;
	transition: all 0.3s ease;
}

.primary-btn:hover {
	background: #ff1493;
	transform: translateY(-1px);
}

.secondary-btn {
	background: #6c757d;
	color: white;
	border: none;
	padding: 0.75rem 1.5rem;
	border-radius: 0.5rem;
	cursor: pointer;
	font-weight: 600;
	transition: all 0.3s ease;
}

.secondary-btn:hover {
	background: #5a6268;
	transform: translateY(-1px);
}

.edit-btn {
	background: #28a745;
	color: white;
	border: none;
	padding: 0.5rem 1rem;
	border-radius: 0.25rem;
	cursor: pointer;
	font-size: 0.9rem;
	transition: all 0.3s ease;
	flex: 1;
}

.edit-btn:hover {
	background: #218838;
}

.delete-btn {
	background: #dc3545;
	color: white;
	border: none;
	padding: 0.5rem 1rem;
	border-radius: 0.25rem;
	cursor: pointer;
	font-size: 0.9rem;
	transition: all 0.3s ease;
	flex: 1;
}

.delete-btn:hover {
	background: #c82333;
}

/* Form Containers */
.admin-form-container {
	background: white;
	border-radius: 0.5rem;
	padding: 2rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	max-width: 600px;
	margin: 0 auto;
}

.admin-form-container h2 {
	margin-top: 0;
	margin-bottom: 1.5rem;
	color: hotpink;
	text-align: center;
}

.form-actions {
	display: flex;
	gap: 1rem;
	margin-top: 1.5rem;
	justify-content: center;
}

.admin-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 1rem;
}

.admin-table th,
.admin-table td {
	padding: 0.5rem;
	border: 1px solid #ccc;
	text-align: left;
}

.admin-form {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 1rem;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form textarea {
	padding: 0.75rem;
	border: 2px solid #ddd;
	border-radius: 0.5rem;
	font-size: 1rem;
	transition: border-color 0.3s ease;
	width: 100%;
	box-sizing: border-box;
}

.admin-form input[type="text"]:focus,
.admin-form input[type="password"]:focus,
.admin-form input[type="number"]:focus,
.admin-form textarea:focus {
	outline: none;
	border-color: hotpink;
}

.admin-form textarea {
	resize: vertical;
	min-height: 100px;
}

.admin-form label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	font-weight: 500;
}

.admin-form input[type="checkbox"] {
	width: auto;
	margin: 0;
}

/* Orders Table Styles */
.orders-table-container {
	background: white;
	border-radius: 0.5rem;
	padding: 1rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	overflow-x: auto;
}

.orders-table {
	min-width: 1000px;
}

.orders-table th,
.orders-table td {
	padding: 0.75rem 0.5rem;
	vertical-align: top;
}

.orders-table th {
	background: hotpink;
	color: white;
	font-weight: 600;
	text-align: center;
}

.total-amount {
	font-weight: bold;
	color: hotpink;
	text-align: right;
}

.items-cell {
	max-width: 200px;
	font-size: 0.9rem;
	line-height: 1.4;
}

.status-select {
	padding: 0.25rem 0.5rem;
	border: 1px solid #ddd;
	border-radius: 0.25rem;
	background: white;
	font-size: 0.9rem;
	text-transform: capitalize;
}

.status-select:focus {
	outline: none;
	border-color: hotpink;
}

/* Image Upload Styles */
.image-upload-section {
	margin: 1.5rem 0;
	padding: 1rem;
	border: 2px dashed #ddd;
	border-radius: 0.5rem;
	background: #fafafa;
}

.image-upload-section label {
	display: block;
	margin-bottom: 0.5rem;
	color: #333;
	font-weight: 600;
}

.image-upload-section input[type="file"] {
	width: 100%;
	padding: 0.5rem;
	border: 1px solid #ddd;
	border-radius: 0.25rem;
	background: white;
	cursor: pointer;
}

.image-upload-help {
	margin-top: 0.5rem;
	color: #666;
	font-style: italic;
}

.image-preview-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
	padding: 1rem 0;
}

.image-preview-item {
	text-align: center;
	padding: 0.5rem;
	border: 1px solid #eee;
	border-radius: 0.5rem;
	background: white;
}

.preview-thumb {
	width: 100%;
	height: 80px;
	object-fit: cover;
	border-radius: 0.25rem;
	margin-bottom: 0.5rem;
}

.preview-info {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.preview-name {
	font-size: 0.8rem;
	font-weight: 500;
	color: #333;
	word-break: break-word;
}

.preview-size {
	font-size: 0.7rem;
	color: #666;
}

.image-section {
	margin: 1.5rem 0;
	padding: 1rem;
	border: 1px solid #eee;
	border-radius: 0.5rem;
	background: #fafafa;
}

.image-section label {
	display: block;
	margin-bottom: 0.5rem;
	color: #333;
	font-weight: 600;
}

.current-images-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 1rem;
	margin: 1rem 0;
	padding: 1rem;
	background: white;
	border-radius: 0.5rem;
	border: 1px solid #ddd;
}

.current-image-item {
	position: relative;
	text-align: center;
	padding: 0.5rem;
	border: 1px solid #eee;
	border-radius: 0.5rem;
	background: #fafafa;
}

.current-image-thumb {
	width: 100%;
	height: 100px;
	object-fit: cover;
	border-radius: 0.25rem;
}

.remove-image-btn {
	position: absolute;
	top: 0.25rem;
	right: 0.25rem;
	background: #dc3545;
	color: white;
	border: none;
	border-radius: 50%;
	width: 24px;
	height: 24px;
	cursor: pointer;
	font-size: 0.8rem;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.9;
	transition: opacity 0.3s ease;
}

.remove-image-btn:hover {
	opacity: 1;
	background: #c82333;
}

.no-images {
	text-align: center;
	color: #666;
	font-style: italic;
	padding: 2rem;
	background: #f8f9fa;
	border-radius: 0.5rem;
	border: 2px dashed #ddd;
}

/* User menu dropdown */
#topnav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3rem;
	background: hotpink;
	color: white;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding: 0 1rem;
	z-index: 1002;
}

.user-menu {
	position: relative;
}

.user-menu > button {
	background: transparent;
	border: none;
	color: white;
	font-size: 1rem;
	cursor: pointer;
}

#topnav .user-dropdown button {
	padding: 1rem;
	font-size: 1.05em;
}

.user-dropdown {
	position: absolute;
	top: 100%;
	right: 0;
	background: white;
	color: black;
	border: 1px solid #ccc;
	border-radius: 0.25rem;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
	z-index: 1003;
	display: none;
	flex-direction: column;
	min-width: 180px;
}

.user-dropdown button {
	padding: 0.5rem 1rem;
	background: none;
	border: none;
	text-align: left;
	width: 100%;
	cursor: pointer;
}

.user-menu.open .user-dropdown {
	display: flex;
	width: max-content;
	padding: 0.25rem;
}

#burger {
	display: none;
	background: transparent;
	border: none;
	font-size: 1.5rem;
	color: white;
	position: fixed;
	top: 0.5rem;
	left: 1rem;
	z-index: 1004;
	cursor: pointer;
}

@media (max-width: 768px) {
	#burger {
		display: block;
		padding: 0px;
		font-size: 1.7em;
	}
	#admin-wrapper {
		flex-direction: column;
	}
	#admin-sidebar {
		position: fixed;
		left: -220px;
		top: 3rem;
		width: 200px;
		height: calc(100% - 3rem);
		background: hotpink;
		flex-direction: column;
		z-index: 1003;
		transition: left 0.3s ease;
	}
	#admin-sidebar.open {
		left: 0;
	}
	.admin-table thead {
		display: none;
	}
	.admin-table tr {
		display: block;
		margin-bottom: 1rem;
		border: 1px solid #ddd;
		padding: 0.5rem;
		border-radius: 0.5rem;
	}
	.admin-table td {
		display: block;
		text-align: right;
		position: relative;
		padding-left: 50%;
	}
	.admin-table td::before {
		content: attr(data-label);
		position: absolute;
		left: 0.5rem;
		top: 0;
		font-weight: bold;
		text-align: left;
	}

	/* Mobile responsive for new admin features */
	.admin-header {
		flex-direction: column;
		gap: 1rem;
		text-align: center;
	}

	.products-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.product-card {
		margin: 0;
	}

	.product-image {
		height: 150px;
	}

	.admin-form-container {
		margin: 0.5rem;
		padding: 1rem;
	}

	.form-actions {
		flex-direction: column;
	}

	.product-actions {
		flex-direction: column;
		gap: 0.5rem;
	}

	.edit-btn,
	.delete-btn {
		flex: none;
		width: 100%;
	}

	#admin-main {
		padding: 0.5rem;
	}

	/* Mobile image upload adjustments */
	.image-preview-container,
	.current-images-container {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
		gap: 0.5rem;
	}

	.preview-thumb,
	.current-image-thumb {
		height: 60px;
	}

	.image-upload-section,
	.image-section {
		margin: 1rem 0;
		padding: 0.75rem;
	}

	.preview-name {
		font-size: 0.7rem;
	}

	.preview-size {
		font-size: 0.6rem;
	}

	.remove-image-btn {
		width: 20px;
		height: 20px;
		font-size: 0.7rem;
	}

	/* Mobile responsive adjustments for orders table */
	.orders-table-container {
		padding: 0.5rem;
		margin: 0.5rem 0;
	}

	.orders-table {
		min-width: auto;
	}

	.orders-table thead {
		display: none;
	}

	.orders-table tr {
		display: block;
		margin-bottom: 1rem;
		border: 1px solid #ddd;
		padding: 1rem;
		border-radius: 0.5rem;
		background: white;
		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	}

	.orders-table td {
		display: block;
		text-align: left;
		padding: 0.5rem 0;
		border: none;
		position: relative;
		padding-left: 35%;
	}

	.orders-table td::before {
		content: attr(data-label) ": ";
		position: absolute;
		left: 0;
		top: 0.5rem;
		font-weight: bold;
		color: hotpink;
		width: 30%;
	}

	.total-amount {
		text-align: left;
		font-size: 1.1rem;
	}

	.items-cell {
		max-width: none;
	}

	.status-select {
		margin-left: 0;
		width: 65%;
	}
}
