:root {
	color-scheme: light;
	--clr-bg: #f8f9fa;
	--clr-bg-muted: #f0f2f5;
	--clr-surface: #ffffff;
	--clr-surface-alt: #fafbfc;
	--clr-border: rgba(0, 0, 0, 0.06);
	--clr-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	--clr-primary: #3b82f6;
	--clr-primary-dark: #1e40af;
	--clr-accent: #10b981;
	--clr-danger: #ef4444;
	--clr-muted: #6b7280;
	--radius-lg: 12px;
	--radius-md: 8px;
	--radius-sm: 6px;
	font-family: 'Inter', 'Noto Sans Sinhala', system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }

.app-body {
	margin: 0;
	background: linear-gradient(135deg, #cfecef61 0%, #6dcacf3b 50%, #5db5bcc9 100%);
	color: #1f2937;
	min-height: 100vh;
	font-family: 'Inter', 'Noto Sans Sinhala', system-ui, sans-serif;
	position: relative;
	overflow-x: hidden;
}

.app-body::before {
	content: '';
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	height: 300px;
	background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"><path d="M0,64 Q300,0 600,64 T1200,64 L1200,120 L0,120 Z" fill="rgba(255,255,255,0.25)"/><path d="M0,80 Q300,20 600,80 T1200,80 L1200,120 L0,120 Z" fill="rgba(255,255,255,0.15)"/></svg>') no-repeat bottom;
	background-size: cover;
	pointer-events: none;
	z-index: 0;
}

.app-shell {
	position: relative;
	z-index: 1;
}

.skip-link {
	position: absolute;
	left: -999px;
	top: 0;
	background: #111827;
	color: #fff;
	padding: 0.6rem 1rem;
	z-index: 1000;
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.skip-link:focus {
	left: 0;
}

.app-navbar {
	position: sticky !important;
	top: 0;
	z-index: 1020;
	background: #ffffff !important;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
	transition: all 0.2s ease;
	overflow: visible;
}

.app-navbar:hover {
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.brand {
	color: #0f172a !important;
	transition: transform 0.2s ease;
	font-size: 1.15rem;
}

.brand:hover { 
	text-decoration: none !important;
	transform: scale(1.05);
}

.brand-glyph {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	background: #f0f2f5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #3b82f6;
	font-size: 1.2rem;
	box-shadow: none;
	transition: all 0.2s ease;
}

.brand-glyph:hover {
	background: #e5e7eb;
	transform: none;
}

.brand-text {
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: lowercase;
	color: #0f172a !important;
	text-shadow: none;
}

.navbar-nav .nav-link {
	color: #0f172a !important;
	font-weight: 600;
	padding: 0.6rem 1rem !important;
	border-radius: 10px;
	transition: all 0.2s ease;
	margin: 0 4px;
}

.navbar-nav .nav-link:hover {
	background: rgba(59, 130, 246, 0.1);
	color: #3b82f6 !important;
	transform: translateY(-2px);
}

.navbar-nav .nav-link.active {
	background: rgba(59, 130, 246, 0.15);
	color: #3b82f6 !important;
	font-weight: 700;
}

.navbar-toggler {
	border-color: rgba(0, 0, 0, 0.2) !important;
	color: #333 !important;
	padding: 0.5rem 0.75rem;
	background: white;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	border-radius: 8px;
	font-size: 1.5rem;
}

.navbar-toggler:focus {
	box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
	outline: none;
}

/* Ensure navbar shows on desktop */
@media (min-width: 992px) {
	.navbar-collapse {
		display: flex !important;
	}
}

/* Avatar Circle Styling */
.avatar-circle {
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #3b82f6;
	border-radius: 50%;
	color: white;
	font-weight: 600;
	font-size: 0.85rem;
	box-shadow: none;
	transition: all 0.2s ease;
}

#userDropdown:hover .avatar-circle {
	background: #1e40af;
	box-shadow: none;
}

/* Navbar dropdown fixes */
.navbar-collapse {
	position: relative;
	z-index: 1001;
}

.dropdown {
	position: relative;
}

/* User Dropdown Menu Styling */
.dropdown-menu {
	animation: slideDown 0.2s ease-out;
	border: 1px solid rgba(0, 0, 0, 0.08) !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
	position: absolute;
	z-index: 1050;
	min-width: 220px;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.dropdown-menu.show {
	display: block !important;
	opacity: 1;
}

.dropdown-menu .dropdown-item {
	padding: 0.6rem 1rem;
	font-size: 0.95rem;
	transition: all 0.2s ease;
}

/* Chat styles */
.chat-scroll {
	background: linear-gradient(135deg, #f0f2f5 0%, #ffffff 100%);
	min-height: 360px;
	max-height: 620px;
	overflow-y: auto;
	padding: 1.2rem;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
}

.chat-row {
	display: flex;
	margin-bottom: 1rem;
	animation: fadeIn 0.3s ease-in;
}

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

.chat-row.chat-me { 
	justify-content: flex-end; 
}

.chat-row.chat-them { 
	justify-content: flex-start; 
}

.chat-bubble {
	max-width: 65%;
	padding: 0.9rem 1.1rem;
	border-radius: 20px;
	word-wrap: break-word;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	transition: all 0.2s ease;
	position: relative;
	min-height: 30px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.chat-bubble:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.12);
	transform: translateY(-1px);
}

.chat-row.chat-them .chat-bubble {
	background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
	color: #1a1a1a;
	border: 2px solid #e8e8e8;
	border-bottom-left-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	padding: 1rem 1.2rem;
}

.chat-row.chat-me .chat-bubble {
	background: linear-gradient(135deg, #abbbffa6 0%, #000000 100%);
	color: #fff;
	border: none;
	border-bottom-right-radius: 4px;
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
	padding: 1rem 1.2rem;
}

.chat-body { 
	white-space: pre-wrap; 
	word-break: break-word;
	font-size: 1rem;
	line-height: 1.6;
	font-weight: 400;
	margin: 0 0 6px 0;
	padding: 0;
	display: block;
	color: inherit;
}

.chat-meta {
	font-size: 0.65rem;
	margin-top: 8px;
	opacity: 0.7;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

.chat-row.chat-me .chat-meta { 
	color: rgba(255,255,255,0.95);
	text-align: right;
	margin-top: 6px;
}

.chat-row.chat-them .chat-meta {
	color: #999;
	text-align: left;
	margin-top: 6px;
}

.chat-contact-list .list-group-item {
	border: none;
	border-left: 4px solid transparent;
	transition: all 0.2s ease;
	cursor: pointer;
}

.chat-contact-list .list-group-item:hover {
	background-color: #f5f5f5;
	border-left-color: #667eea;
}

.chat-contact-list .list-group-item.active {
	background: linear-gradient(135deg, #000000 0%, #154737 100%);
	color: #fff;
	border-color: #000000;
	border-left-color: #fff;
	box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-contact-list .list-group-item.active small,
.chat-contact-list .list-group-item.active strong { 
	color: #fff !important; 
}

.chat-contact-list .list-group-item.active .badge {
	background: rgba(255,255,255,0.3) !important;
	color: #fff !important;
}

.chat-attachment {
	margin-top: 10px;
	padding: 10px;
	background: rgba(0,0,0,0.04);
	border-radius: 12px;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	max-width: 100%;
	border: 1px solid rgba(0,0,0,0.06);
}

.chat-row.chat-me .chat-attachment {
	background: rgba(255,255,255,0.2);
	border-color: rgba(255,255,255,0.3);
}

.chat-attachment img {
	max-width: 220px;
	max-height: 220px;
	border-radius: 10px;
	display: block;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.chat-attachment img:hover {
	transform: scale(1.05);
}

.chat-attachment audio {
	width: 100%;
	max-width: 320px;
	border-radius: 8px;
}

.file-upload-area {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.file-upload-area input[type="file"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.voice-record-btn {
	transition: all 0.3s ease;
	background: #fff;
	border: 1.5px solid #667eea;
	color: #667eea;
}

.voice-record-btn:hover {
	background: #f0f0f0;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.voice-record-btn.recording {
	background: #dc3545 !important;
	border-color: #dc3545 !important;
	color: #fff !important;
	animation: pulse 1.5s infinite;
	box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

.sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 991px) {
	.app-navbar .brand-glyph { width: 38px; height: 38px; }
	.app-navbar .brand-text { font-size: 1rem; }
	.page-title { font-size: 1.35rem; }
	.data-table { border-radius: var(--radius-md); }
}

.dropdown-menu .dropdown-item:hover {
	background-color: #f5f5f5;
	color: #667eea;
	transform: translateX(4px);
}

.dropdown-menu .dropdown-item i {
	width: 20px;
	font-size: 1rem;
}

.dropdown-menu .dropdown-header {
	padding: 0.75rem 1rem;
	background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

/* Icons styling */
.bi {
	display: inline-block;
	vertical-align: -0.125em;
}

#userDropdown {
	position: relative;
	white-space: nowrap;
}

.app-main {
	background: transparent;
}

.page-heading {
	border-bottom: 1px solid rgba(15, 23, 42, 0.05);
	padding-bottom: 1.25rem;
}

.eyebrow {
	font-size: 0.75rem;
	letter-spacing: 0.18em;
	color: #94a3b8;
}

.app-card,
.card.glass,
.card.shadow-soft {
	border-radius: var(--radius-lg);
	border: 1px solid var(--clr-border);
	box-shadow: var(--clr-shadow);
	background: var(--clr-surface);
}

.hero-panel {
	background: linear-gradient(120deg, #111936, #352677, #6539ff);
	color: #f8fafc;
	overflow: hidden;
	position: relative;
}

.hero-panel::after {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.2), transparent 55%);
	pointer-events: none;
}

.hero-panel > * { position: relative; z-index: 1; }

.feature-card {
	border: 1px solid rgba(103, 89, 255, 0.2);
	border-radius: var(--radius-lg);
	background: var(--clr-surface);
	box-shadow: var(--clr-shadow);
	height: 100%;
}

.feature-card h5 { font-weight: 600; }

.feature-card p { font-size: 0.9rem; color: var(--clr-muted); }

.metric-card {
	background: rgba(255, 255, 255, 0.12);
	border-radius: var(--radius-md);
	padding: 1rem 1.25rem;
	border: 1px solid rgba(255, 255, 255, 0.15);
}

.metric-card strong { font-size: 1.75rem; display: block; }

.pill-link {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem 0.95rem;
	border-radius: 999px;
	font-size: 0.8rem;
	text-decoration: none;
	background: rgba(255, 255, 255, 0.15);
	color: #e0e7ff;
}

.pill-link:hover { color: #fff; }

.app-card + .app-card { margin-top: 1.25rem; }

.stat-pill {
	border-radius: 999px;
	padding: 0.4rem 1rem;
	background: var(--clr-bg-muted);
	font-size: 0.85rem;
	color: var(--clr-primary);
	font-weight: 600;
}

.data-table {
	border-radius: var(--radius-lg);
	overflow: hidden;
	border: 1px solid var(--clr-border);
	box-shadow: var(--clr-shadow);
}

.data-table table { margin: 0; }

.data-table thead { background: var(--clr-bg-muted); }

.data-table th {
	text-transform: uppercase;
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	color: #475569;
}

.badge-soft {
	border-radius: 999px;
	padding: 0.25rem 0.75rem;
	font-size: 0.75rem;
	font-weight: 600;
	background: rgba(103, 89, 255, 0.15);
	color: var(--clr-primary);
}

.badge-soft.success { background: rgba(34, 197, 94, 0.15); color: #15803d; }
.badge-soft.muted { background: rgba(15, 23, 42, 0.08); color: #475569; }

.badge-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-weight: 600;
	font-size: 0.82rem;
	border-radius: 999px;
	padding: 0.35rem 0.9rem;
	background: var(--clr-bg-muted);
	color: #0f172a;
}

.badge-chip i { font-size: 0.95rem; }
.badge-chip-student { background: rgba(59, 130, 246, 0.18); color: #1d4ed8; }
.badge-chip-teacher { background: rgba(34, 197, 94, 0.18); color: #047857; }
.badge-chip-security { background: rgba(234, 179, 8, 0.2); color: #92400e; }

.muted { color: var(--clr-muted); }

.consent-note {
	background: rgba(103, 89, 255, 0.12);
	color: #0f172a;
	border-radius: var(--radius-md);
	padding: 0.75rem 1rem;
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-weight: 500;
}

.app-footer {
    background: linear-gradient(135deg, #1a1a1a00 0%, #2d2d2d00 100%) !important;
    backdrop-filter: blur(10px) !important;
    color: #ffffff !important;
}

.app-footer h5, .app-footer h6, .app-footer p, .app-footer a, .app-footer .text-muted, .app-footer span {
    color: #0f172a !important;
}

.app-footer a:hover {
	color: #cccccc !important;
}

.app-footer .bi-whatsapp {
	color: #25d366 !important;
}

.app-footer hr {
	border-color: rgba(255, 255, 255, 0.2) !important;
}

.btn-primary,
.btn-success,
.btn-warning,
.btn-outline-primary {
	border-radius: var(--radius-sm);
	font-weight: 600;
}

.btn-primary {
	background: linear-gradient(120deg, var(--clr-primary), var(--clr-primary-dark));
	border: none;
	box-shadow: 0 15px 25px rgba(103, 89, 255, 0.35);
}

.btn-primary:focus-visible { box-shadow: 0 0 0 0.25rem rgba(103, 89, 255, 0.25); }

.btn-outline-primary {
	border-color: rgba(103, 89, 255, 0.5);
	color: var(--clr-primary);
}

.btn-outline-primary:hover {
	background: rgba(103, 89, 255, 0.1);
}

.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, 0.4); border-radius: 999px; }

.auth-body {
	background: #f8f9fa;
	color: #1f2937;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.auth-shell {
	flex: 1;
	display: flex;
}

.auth-illustration {
	background: url('examihome.png') center/cover;
	position: relative;
	min-height: 35vh;
}

@media (min-width: 992px) {
	.auth-illustration {
		flex: 0 0 45%;
		min-height: auto;
	}
}

.auth-illustration > * { position: relative; z-index: 1; }

.auth-panel {
	background: rgba(255, 255, 255, 0.98);
}

@media (min-width: 992px) {
	.auth-panel {
		flex: 0 0 55%;
	}
}

.auth-panel .card,
.auth-panel form {
	background: transparent;
}

.auth-footer {
	background: #ffffff;
	color: #6b7280;
	border-color: #e5e7eb !important;
}

.auth-footer a {
	color: #3b82f6;
}

.auth-footer a:hover {
	color: rgba(255, 255, 255, 1);
}

.auth-logo-dot {
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: linear-gradient(120deg, #22d3ee, #6366f1);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.letter-spaced { letter-spacing: 0.25em; }

.form-control,
.form-select {
	border-radius: var(--radius-sm);
	border-color: rgba(71, 85, 105, 0.25);
	padding: 0.75rem 0.95rem;
}

.form-control:focus,
.form-select:focus {
	border-color: var(--clr-primary);
	box-shadow: 0 0 0 0.2rem rgba(103, 89, 255, 0.25);
}

.sr-only,
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 991px) {
	.app-navbar .brand-glyph { width: 38px; height: 38px; }
	.app-navbar .brand-text { font-size: 1rem; }
	.page-title { font-size: 1.35rem; }
	.data-table { border-radius: var(--radius-md); }
}
