/* ========================================
   INDEX PAGE STYLES
   ======================================== */

/* Fix dropdown menu z-index issue */
.topbar .dropdown-menu {
	z-index: 9999 !important;
	position: absolute !important;
}

.topbar .dropdown {
	z-index: 9998 !important;
}

/* Ensure page-header doesn't overlap dropdown */
.page-header {
	z-index: 1;
}

/* Page Header Styles - Space Theme */
.page-header {
	background: linear-gradient(135deg, rgba(25, 25, 112, 0.4) 0%, rgba(72, 61, 139, 0.4) 25%, rgba(138, 43, 226, 0.4) 50%, rgba(186, 85, 211, 0.4) 75%, rgba(255, 20, 147, 0.4) 100%), url('https://science.buu.ac.th/sciweek_comp/images/bg_topic.png');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	border-radius: 16px;
	box-shadow: 0 15px 50px rgba(25, 25, 112, 0.4), inset 0 0 100px rgba(0, 0, 0, 0.2);
	position: relative;
	overflow: hidden;
	margin: 0;
	padding: 3rem 3rem;
	min-height: 180px;
	z-index: 1;
}

.page-header h1 {
	font-size: 2.5rem;
	font-weight: 700;
	text-shadow: 0 3px 6px rgba(0,0,0,0.3);
	letter-spacing: 0.5px;
	color: white !important;
	position: relative;
	z-index: 2;
	line-height: 1.3;
}

.page-header p {
	font-size: 1.8rem;
	text-shadow: 0 2px 4px rgba(0,0,0,0.4);
	font-weight: 600;
	color: white !important;
	position: relative;
	z-index: 2;
}

/* Twinkling Stars Effect */
.page-header::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-image: 
		radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.8), transparent),
		radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.6), transparent),
		radial-gradient(1px 1px at 90px 40px, rgba(255, 255, 255, 0.8), transparent),
		radial-gradient(1px 1px at 130px 80px, rgba(255, 255, 255, 0.6), transparent),
		radial-gradient(2px 2px at 160px 30px, rgba(255, 255, 255, 0.8), transparent);
	background-repeat: repeat;
	background-size: 200px 100px;
	animation: twinkle 4s ease-in-out infinite;
	opacity: 0.3;
	z-index: 1;
}

@keyframes twinkle {
	0%, 100% { opacity: 0.3; }
	50% { opacity: 1; }
}

/* Header Logo Styles */
.header-logo {
	max-height: 120px;
	max-width: 100%;
	object-fit: contain;
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
	transition: all 0.3s ease;
}

.header-logo:hover {
	transform: scale(1.05);
	filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}

/* Animated Light Bar */
.page-header::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 3px;
	background: linear-gradient(90deg, 
		transparent 0%, 
		rgba(255, 255, 200, 0.6) 15%, 
		rgba(255, 255, 180, 0.9) 30%, 
		rgba(255, 255, 150, 1) 50%, 
		rgba(255, 255, 180, 0.9) 70%, 
		rgba(255, 255, 200, 0.6) 85%, 
		transparent 100%);
	box-shadow: 
		0 0 20px rgba(255, 255, 150, 0.8),
		0 0 40px rgba(255, 255, 100, 0.4),
		0 0 60px rgba(255, 255, 50, 0.2);
	animation: lightBar 3s ease-in-out infinite;
	z-index: 10;
}

@keyframes lightBar {
	0% {
		left: -100%;
		opacity: 0;
	}
	10% {
		opacity: 1;
	}
	90% {
		opacity: 1;
	}
	100% {
		left: 100%;
		opacity: 0;
	}
}

/* Competition Card Styles */
.competition-card {
	transition: all 0.3s ease;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	border: none;
	background: linear-gradient(135deg, rgba(25, 25, 112, 0.9) 0%, rgba(72, 61, 139, 0.9) 25%, rgba(138, 43, 226, 0.9) 50%, rgba(186, 85, 211, 0.9) 75%, rgba(255, 20, 147, 0.9) 100%);
	border: 1px solid rgba(102, 126, 234, 0.2);
	position: relative;
}

.competition-card:hover {
	transform: translateY(-8px);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
	background: linear-gradient(135deg, rgba(25, 25, 112, 1) 0%, rgba(72, 61, 139, 1) 25%, rgba(138, 43, 226, 1) 50%, rgba(186, 85, 211, 1) 75%, rgba(255, 20, 147, 1) 100%);
	border: 1px solid rgba(102, 126, 234, 0.4);
}

/* Card Content */
.competition-card .card-body {
	position: relative;
	z-index: 2;
	color: white;
}

.competition-card .card-footer {
	position: relative;
	z-index: 2;
	background: linear-gradient(135deg, rgba(25, 25, 112, 0.9) 0%, rgba(72, 61, 139, 0.9) 25%, rgba(138, 43, 226, 0.9) 50%, rgba(186, 85, 211, 0.9) 75%, rgba(255, 20, 147, 0.9) 100%);
	border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Competition Icon - News Style */
.competition-icon {
	width: 100%;
	height: 120px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 1.5rem;
	overflow: hidden;
	position: relative;
}

.competition-icon::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.05);
	z-index: 1;
}

.competition-icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
	z-index: 2;
	position: relative;
	transition: all 0.3s ease;
}

.competition-card:hover .competition-icon img {
	transform: scale(1.05);
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

/* Card Title - White Text */
.competition-card .card-title {
	color: white !important;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
	font-weight: 700;
}

.competition-card .card-text {
	color: rgba(255, 255, 255, 0.9) !important;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Button Styles */
.btn-outline-primary {
	border-width: 2px;
	font-weight: 600;
	transition: all 0.3s ease;
	border-radius: 8px;
}

.btn-outline-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* Alert Styles */
.alert-sm {
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	border-radius: 8px;
}

.btn-sm {
	padding: 0.375rem 0.75rem;
	font-size: 0.875rem;
	border-radius: 6px;
}

/* Carousel Styles */
.carousel-fade .carousel-item {
	opacity: 0;
	transition: opacity 0.6s ease-in-out;
}

.carousel-fade .carousel-item.active {
	opacity: 1;
}

.carousel-control-prev,
.carousel-control-next {
	width: 5%;
	opacity: 0.8;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
	opacity: 1;
}

/* Card Title Styles */
.card-title {
	font-weight: 700;
	line-height: 1.4;
	color: #2c3e50;
}

/* Animation Keyframes */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Accessibility Styles */
.competition-card:focus-within {
	outline: 2px solid #667eea;
	outline-offset: 2px;
}

/* Smooth Scrolling */
html {
	scroll-behavior: smooth;
}

/* Responsive Page Header */
@media (max-width: 768px) {
	.page-header {
		padding: 2rem 2rem;
		min-height: 150px;
	}
	
	.page-header h1 {
		font-size: 1.8rem;
		line-height: 1.4;
	}
	
	.page-header p {
		font-size: 1.4rem;
	}
	
	.header-logo {
		max-height: 80px;
		margin-top: 1rem;
	}
	
	/* Light bar for tablet */
	.page-header::before {
		height: 2px;
		animation-duration: 2.5s;
	}
}

@media (max-width: 576px) {
	.page-header {
		padding: 1.5rem 1.5rem;
		min-height: 120px;
	}
	
	.page-header h1 {
		font-size: 1.4rem;
		line-height: 1.3;
	}
	
	.page-header p {
		font-size: 1.1rem;
	}
	
	.header-logo {
		max-height: 60px;
		margin-top: 1rem;
	}
	
	/* Light bar for mobile */
	.page-header::before {
		height: 1.5px;
		animation-duration: 2s;
	}
}

/* Responsive Competition Cards */
@media (max-width: 768px) {
	.competition-card {
		margin-bottom: 1.5rem;
	}
	
	.competition-icon {
		height: 100px;
		margin-bottom: 1rem;
	}
}

@media (max-width: 576px) {
	.competition-card {
		margin-bottom: 1rem;
	}
	
	.competition-icon {
		height: 80px;
		margin-bottom: 0.75rem;
	}
	
	.competition-card .card-title {
		font-size: 1.1rem;
	}
	
	.competition-card .card-text {
		font-size: 0.9rem;
	}
}

/* Loading Animation */
.loading {
	opacity: 0;
	animation: fadeInUp 0.6s ease forwards;
}

/* Focus Indicators */
.btn:focus,
.card:focus {
	box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

/* Alert Styles - Enhanced for Page Header Theme */
.alert {
	border: none;
	border-radius: 12px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
	font-size: 1.3rem;
	line-height: 1.5;
}

.alert::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, 
		rgba(255, 255, 200, 0.6) 0%, 
		rgba(255, 255, 180, 0.9) 50%, 
		rgba(255, 255, 150, 1) 100%);
	animation: lightBar 3s ease-in-out infinite;
}

.alert-info {
	background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
	border-left: 4px solid #667eea;
	color: #2c3e50;
	font-weight: 600;
}

.alert-success {
	background: linear-gradient(135deg, rgba(28, 200, 138, 0.25) 0%, rgba(54, 185, 204, 0.25) 100%);
	border-left: 4px solid #1cc88a;
	color: #155724;
	font-weight: 600;
}

.alert-warning {
	background: linear-gradient(135deg, rgba(246, 194, 62, 0.25) 0%, rgba(255, 193, 7, 0.25) 100%);
	border-left: 4px solid #f6c23e;
	color: #856404;
	font-weight: 600;
}

.alert-danger {
	background: linear-gradient(135deg, rgba(231, 76, 60, 0.25) 0%, rgba(220, 53, 69, 0.25) 100%);
	border-left: 4px solid #e74c3c;
	color: #721c24;
	font-weight: 600;
}

.alert-primary {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
	border-left: 4px solid #667eea;
	color: #2c3e50;
	font-weight: 600;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Alert Icons */
.alert i {
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.alert-info i {
	color: #667eea;
}

.alert-success i {
	color: #1cc88a;
}

.alert-warning i {
	color: #f6c23e;
}

.alert-danger i {
	color: #e74c3c;
}

.alert-primary i {
	color: #667eea;
}

/* Card Enhancements */
.card {
	border: none;
	border-radius: 16px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	transition: all 0.3s ease;
	overflow: hidden;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
}

.card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
	background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(248, 249, 250, 1) 100%);
}

.card-header {
	background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
	border: none;
	color: white;
	font-weight: 600;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-body {
	background: linear-gradient(135deg, rgba(248, 249, 250, 0.8) 0%, rgba(233, 236, 239, 0.8) 100%) !important;
}

.card-footer {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
	border-top: 1px solid rgba(102, 126, 234, 0.1);
}

/* Button Enhancements */
.btn {
	border-radius: 8px;
	font-weight: 600;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	font-size: 1.1rem;
}

.btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-outline-primary {
	border: 2px solid #667eea;
	color: #667eea;
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(10px);
}

.btn-outline-primary:hover {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-color: #667eea;
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.btn-success {
	background: linear-gradient(135deg, #1cc88a 0%, #36b9cc 100%);
	border: none;
	color: white;
}

.btn-success:hover {
	background: linear-gradient(135deg, #17a673 0%, #2c9faf 100%);
	transform: translateY(-2px);
}

/* Carousel Enhancements */
.carousel {
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.carousel-item img {
	border-radius: 16px;
}

/* Footer Enhancements */
.sticky-footer {
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.css-footer {
	background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
	border-radius: 12px;
	padding: 1.5rem;
	margin-top: 1rem;
	border: 1px solid rgba(102, 126, 234, 0.1);
	box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

/* Print Styles */
@media print {
	.page-header {
		background: none !important;
		color: #000 !important;
		box-shadow: none !important;
	}
	
	.page-header h1,
	.page-header p {
		color: #000 !important;
		text-shadow: none !important;
	}
}

/* Manual Page Header - Compact Version */
.page-header.py-3 {
	min-height: 120px;
	padding: 2rem 3rem !important;
}

.page-header.py-3 h1 {
	font-size: 2rem;
	line-height: 1.2;
}

/* Responsive Manual Page Header */
@media (max-width: 768px) {
	.page-header.py-3 {
		padding: 1.5rem 2rem !important;
		min-height: 100px;
	}
	
	.page-header.py-3 h1 {
		font-size: 1.5rem;
		line-height: 1.3;
	}
}

@media (max-width: 576px) {
	.page-header.py-3 {
		padding: 1rem 1.5rem !important;
		min-height: 80px;
	}
	
	.page-header.py-3 h1 {
		font-size: 1.2rem;
		line-height: 1.4;
	}
}
