/* Reset và Base Styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: linear-gradient(135deg, #0f172a 0%, #111827 100%);
	min-height: 100vh;
	color: #e5e7eb;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Container chính */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
	position: relative;
}

/* Header chuyên nghiệp */
.header {
	margin-bottom: 40px;
	padding: 30px 0;
	animation: slideDown 0.8s ease-out;
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: rgba(255,255,255,0.06);
	padding: 25px 30px;
	border-radius: 20px;
	backdrop-filter: blur(20px);
	border: 1px solid rgba(255,255,255,0.08);
	box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.logo {
	display: flex;
	align-items: center;
	gap: 20px;
}

.logo i {
	font-size: 3rem;
	color: #fff;
	animation: pulse 2s infinite;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.logo-text {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.title {
	font-size: 2.2rem;
	font-weight: 700;
	color: #fff;
	text-shadow: 0 2px 10px rgba(0,0,0,0.3);
	margin: 0;
}

.subtitle {
	font-size: 1rem;
	color: rgba(255,255,255,0.8);
	font-weight: 400;
	margin: 0;
}

.header-info {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.info-item {
	display: flex;
	align-items: center;
	gap: 8px;
	color: rgba(255,255,255,0.9);
	font-size: 0.9rem;
	font-weight: 500;
}

.info-item i {
	color: #fff;
	font-size: 1rem;
}

/* Ẩn link admin */
.admin-link {
	display: none;
}

/* Form tìm kiếm */
.search-form {
	margin-bottom: 40px;
	animation: slideUp 0.8s ease-out 0.2s both;
}

.search-container {
	display: grid;
	grid-template-columns: 1fr 1fr auto;
	gap: 20px;
	align-items: end;
	background: rgba(255,255,255,0.95);
	padding: 30px;
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.1);
	backdrop-filter: blur(20px);
}

.search-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.search-field label {
	font-weight: 600;
	color: #555;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.9rem;
}

.search-field label i {
	color: #667eea;
}

.search-field input {
	padding: 15px 20px;
	border: 2px solid #e1e5e9;
	border-radius: 12px;
	font-size: 1rem;
	transition: all 0.3s ease;
	background: #fff;
}

.search-field input:focus {
	outline: none;
	border-color: #667eea;
	box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
	transform: translateY(-2px);
}

.search-btn {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	border: none;
	padding: 15px 30px;
	border-radius: 12px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 140px;
	justify-content: center;
}

.search-btn:hover {
	transform: translateY(-3px);
	box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.search-btn:active {
	transform: translateY(-1px);
}

/* Loading Overlay */
.loading-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.8);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 2147483648;
	backdrop-filter: blur(5px);
}

.loading-overlay.hidden {
	display: none;
}

.loading-spinner {
	text-align: center;
	color: white;
}

.spinner {
	width: 60px;
	height: 60px;
	border: 4px solid rgba(255,255,255,0.3);
	border-top: 4px solid #fff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 0 auto 20px;
}

.loading-spinner p {
	font-size: 1.2rem;
	font-weight: 500;
}

/* Image Modal */
.image-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.9);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10000000000; /* Above container overlay */
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
    pointer-events: none; /* block clicks only when hidden */
}

.image-modal.show {
	opacity: 1;
	visibility: visible;
    pointer-events: auto; /* clickable when shown */
}

.image-modal.hidden {
	display: none;
}

.modal-content {
	position: relative;
	max-width: min(1200px, 90vw);
	max-height: 90vh;
	background: #fff;
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0,0,0,0.5);
	transform: scale(0.7);
	transition: transform 0.3s ease;
    z-index: 2147483650; /* ensure above any stacking context */
}

.image-modal.show .modal-content {
	transform: scale(1);
}

.close-modal {
	position: absolute;
	top: 15px;
	right: 20px;
	font-size: 2rem;
	color: #fff;
	cursor: pointer;
	background: rgba(0,0,0,0.5);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	z-index: 10;
}

.close-modal:hover {
	background: rgba(0,0,0,0.8);
	transform: rotate(90deg);
}

#modal-image {
	width: 100%;
	height: auto;
	max-height: calc(90vh - 120px);
	display: block;
	object-fit: contain;
}

.modal-actions {
	padding: 20px;
	text-align: center;
	background: #f8f9fa;
}

.download-btn {
	background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
	color: white;
	border: none;
	padding: 12px 25px;
	border-radius: 25px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.download-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 25px rgba(40, 167, 69, 0.4);
}

/* Kết quả tìm kiếm */
.result {
	background: rgba(17,24,39,0.9);
	border-radius: 20px;
	padding: 30px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.1);
	backdrop-filter: blur(20px);
	animation: slideUp 0.8s ease-out;
}

.customer-info {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-bottom: 30px;
	padding-bottom: 20px;
	border-bottom: 2px solid #f0f0f0;
}

.customer-avatar i {
	font-size: 4rem;
	color: #667eea;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.customer-details h2 {
	font-size: 2rem;
	font-weight: 700;
	color: #f9fafb;
	margin-bottom: 8px;
}

.customer-id {
	font-size: 1.1rem;
	color: #9ca3af;
	display: flex;
	align-items: center;
	gap: 8px;
}

.customer-id i {
	color: #667eea;
}

/* Grid phiếu bảo hành */
.warranty-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
	gap: 25px;
}

.warranty-card {
	background: #0b1220;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(0,0,0,0.1);
	transition: all 0.3s ease;
	border: 1px solid rgba(255,255,255,0.06);
}

.warranty-card:hover {
	transform: translateY(-8px);
	box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

.warranty-image {
	position: relative;
	width: 100%;
	height: 200px;
	overflow: hidden;
	cursor: pointer;
}

.warranty-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.warranty-image:hover img {
	transform: scale(1.05);
}

.warranty-image .view-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.5);
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.warranty-image:hover .view-overlay {
	opacity: 1;
}

.view-text {
	text-align: center;
	color: white;
}

.view-text i {
	font-size: 2.5rem;
	margin-bottom: 10px;
	display: block;
}

.view-text span {
	font-size: 1.1rem;
	font-weight: 600;
	display: block;
}

.warranty-content {
	padding: 20px;
}

.warranty-title {
	font-size: 1.2rem;
	font-weight: 600;
	color: #f9fafb;
	margin-bottom: 15px;
}

.warranty-dates {
	display: flex;
	justify-content: space-between;
	margin-bottom: 15px;
	font-size: 0.9rem;
	color: #9ca3af;
}

.warranty-status {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.status-badge {
	padding: 6px 12px;
	border-radius: 20px;
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
}

.status-badge.active {
	background: #d4edda;
	color: #155724;
}

.status-badge.expired {
	background: #f8d7da;
	color: #721c24;
}

/* Message */
.message {
	text-align: center;
	padding: 20px;
	margin-top: 20px;
	border-radius: 12px;
	font-weight: 500;
	animation: fadeIn 0.5s ease-out;
}

.message.error {
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.message.success {
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

/* Animations */
@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes pulse {
	0%, 100% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.1);
	}
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
	.container {
		padding: 15px;
	}
	
	.header-content {
		flex-direction: column;
		gap: 20px;
		text-align: center;
		padding: 20px;
	}
	
	.logo {
		flex-direction: column;
		gap: 15px;
	}
	
	.title {
		font-size: 1.8rem;
	}
	
	.subtitle {
		font-size: 0.9rem;
	}
	
	.header-info {
		flex-direction: row;
		gap: 20px;
		justify-content: center;
	}
	
	.search-container {
		grid-template-columns: 1fr;
		gap: 15px;
		padding: 16px;
	}
	
	.warranty-grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	
	.customer-info {
		flex-direction: column;
		text-align: center;
	}
	
	.customer-details h2 {
		font-size: 1.6rem;
	}

	/* Larger touch targets */
	.search-field input,
	.search-btn,
	.download-btn,
	.close-modal {
		min-height: 48px;
	}

	/* Modal fit on small screens */
	.modal-content {
		max-width: 100%;
		max-height: 100%;
		border-radius: 12px;
	}

	body {
		padding-bottom: env(safe-area-inset-bottom);
		padding-left: env(safe-area-inset-left);
		padding-right: env(safe-area-inset-right);
	}
	
	.footer-content {
		grid-template-columns: 1fr;
		gap: 30px;
		text-align: center;
	}
	
	.footer-section h3 {
		justify-content: center;
	}
}

/* Utility Classes */
.hidden {
	display: none !important;
}

.fade-in {
	animation: fadeIn 0.5s ease-out;
}

.slide-up {
	animation: slideUp 0.8s ease-out;
}
.warranty-remaining {
    margin: 8px 0;
    display: flex;
    align-items: center;
    font-size: 14px;
}

.days-remaining {
    margin-left: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.days-remaining.active {
    background-color: #e3f9e5;
    color: #1b8a2a;
}

.days-remaining.last-day {
    background-color: #fff3cd;
    color: #856404;
}

.days-remaining.expired {
    background-color: #f8d7da;
    color: #721c24;
}

.days-remaining.unlimited {
    background-color: #cce5ff;
    color: #004085;
}

/* Footer chuyên nghiệp */
.footer {
	background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
	color: #fff;
	margin-top: 60px;
	padding: 40px 0 20px;
	border-top: 3px solid #667eea;
}

.footer-content {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 40px;
}

.footer-section h3 {
	font-size: 1.3rem;
	font-weight: 600;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 10px;
	color: #fff;
}

.footer-section h3 i {
	color: #667eea;
	font-size: 1.2rem;
}

.footer-section p {
	color: rgba(255,255,255,0.85);
	line-height: 1.6;
	margin-bottom: 15px;
}

.footer-section ul {
	list-style: none;
	padding: 0;
}

.footer-section ul li {
	color: rgba(255,255,255,0.8);
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.footer-link { color: #fff; text-decoration: underline; }
.footer-link:hover { opacity: 0.85; }

.footer-section ul li i {
	color: #28a745;
	font-size: 0.9rem;
}

.footer-bottom {
	border-top: 1px solid rgba(255,255,255,0.1);
	margin-top: 30px;
	padding-top: 20px;
	text-align: center;
}

.footer-bottom p {
	color: rgba(255,255,255,0.6);
	font-size: 0.9rem;
	margin: 0;
}
