/* =======================
   Base Styling
======================== */
body {
	font-family: Arial, sans-serif;
	margin: 0;
	padding: 0;
	background-color: #f4f7f6;
	color: #333;
}

@media (min-width: 769px) {
	body {
		padding: 0px;
	}
}

.ai-brand {
	color: #0056b3;
}
@media (prefers-color-scheme: dark) {
	.ai-brand {
		color: #00d2ff;
	}
}

h2 {
	font-size: 2.5rem;
	color: #2c3e50;
	font-weight: bold;
	margin: 0 0 8px 0;
	text-align: center;
	border-bottom: none;
	padding-bottom: 0;
}

.tagline {
	display: block;
	font-size: 1.1rem;
	color: #7f8c8d;
	font-weight: normal;
	margin-top: 8px;
	font-style: italic;
	letter-spacing: 0.5px;
}

p {
	font-size: 1.2rem;
	color: #666;
	text-align: center;
	margin-top: 20px;
}

/* =======================
   Header & Global Home Button (Bulletproof Layout)
======================== */
.header-container {
	display: flex;
	flex-direction: row !important; 
	justify-content: flex-start; /* FIX: Packs items together on the left side */
	align-items: center;
	background: #ffffff; 
	border-bottom: none;
	padding: 15px 20px;
	margin-bottom: 0px;
	gap: 15px; /* Adds a nice 15px space between the button and the title */
}

.header-container h2 {
	margin: 0;
	font-size: 1.5rem;
	color: #333;
	text-align: left;
	line-height: 1.2;
	flex: 1; /* Allows text to take available space */
}

.tagline {
	display: block;
	font-size: 0.85rem;
	color: #666;
	font-weight: normal;
	margin-top: 4px;
}

#globalHomeBtn {
	background: transparent;
	color: #2c3e50;
	border: none;
	border-radius: 8px;
	display: none; /* Let your Javascript Auth turn this on naturally! */
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 6px 12px;
	width: auto !important; /* Absolutely forbids full-width stretching */
	min-width: 50px;
	flex-shrink: 0; /* Protects the button from being squished by long titles */
	margin: 0;
	cursor: pointer;
	box-shadow: none;
	transition: all 0.2s ease;
}

#globalHomeBtn svg {
	width: 24px;
	height: 24px;
	fill: currentColor;
}

#globalHomeBtn span {
	font-weight: bold;
	font-size: 13px;
}

#globalHomeBtn:hover {
	background: #e0ecf8;
	transform: translateY(-2px);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
	.header-container {
		padding: 15px 10px;
	}
	.header-container h2 {
		font-size: 1.25rem; /* Scales text down slightly so it fits on small phones */
	}
	.tagline {
		font-size: 0.75rem;
	}
}

/* =======================
   Sign in & Login Container
======================== */
.g_id_signin {
	margin: 20px auto;
	display: flex;
	justify-content: center;
}

#loginContainer {
	text-align: center;
	margin-top: 20vh;
	display: none; /* Prevent first-paint login flicker before auth resolves */
}

.bulk-action-bar {
	background-color: #fff3cd;
	border: 1px solid #ffeeba;
	color: #856404;
	padding: 10px 15px;
	border-radius: 8px;
	margin-bottom: 15px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: bold;
}
.edit-input-field {
	width: 100%; padding: 10px; margin-top: 5px; margin-bottom: 15px;
	border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box;
}


/* =======================
   Subject Cards Styling
======================== */

/* Subject Card Container */
.subject-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-start;
	text-align: left;
	border-radius: 12px;
	padding: 16px;
	margin: 12px 0;
	color: #ffffff;
	box-shadow: 0 4px 10px rgba(0,0,0,0.1);
	width: 100%;
	box-sizing: border-box;
}

/* Ensure buttons inside subject cards occupy full width on the home screen
   and are not constrained by the global button max-width rule. Exclude the
   three-dots options button which should remain compact. */
.subject-card button:not(.options-btn) {
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	display: block !important;
	box-sizing: border-box;
}

/* Text inside card */
.subject-card h3, 
.subject-card p {
	margin: 0;
	text-align: left;
	color: #ffffff;
	width: auto;          /* IMPORTANT FIX */
	max-width: 100%;
}

/* Title */
.card-subject-name {
	font-size: 1.2rem;
	font-weight: bold;
	margin-bottom: 4px;
	padding-right: 45px;  /* space for dots */
}

/* Section */
.card-section {
	font-size: 1rem;
	font-weight: 500;
	margin-bottom: 6px;
}

/* Timing */
.card-room-line, 
.card-timing-row {
	font-size: 0.85rem;
	margin-top: 2px;
}

/* =======================
   3-Dots Button (FINAL)
======================== */
.options-btn {
	position: absolute;
	top: 0px;
	right: 6px;

	background: none;
	border: none;
	color: #ffffff;

	font-size: 20px;
	cursor: pointer;

	padding: 6px;
	width: auto;          /* override global button */
	height: auto;

	line-height: 1;
	box-shadow: none;

	z-index: 1000;        /* enough, no need crazy values */
}

/* In subject action screen header card, dots must never appear */
#actionsContainer .options-btn {
	display: none !important;
}

/* =======================
   Buttons (General Styling)
======================== */
button {
	padding: 18px 18px;
	background-color: #3498db;
	color: white;
	font-size: 26px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	width: 100%;
	max-width: 400px;
	margin: 15px auto;
	display: block;
	transition: background-color 0.3s ease, transform 0.2s ease;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:hover {
	background-color: #2980b9;
	transform: translateY(-2px);
}

/* =======================
   Buttons (Specific Styles & Overrides)
======================== */
/* Red buttons (delete/upload student data) */
button#uploadStudentDataBtn,
button#addNewSubjectBtn,
#uploadContainer button,
button#deleteSubjectBtn,
button.delete-confirm-btn,
button	.delete-confirm-btn,
button.delete-student-btn {
	background-color: #dc3545;
}

button#uploadStudentDataBtn:hover,
button#addNewSubjectBtn:hover,
#uploadContainer button:hover,
button#deleteSubjectBtn:hover,
button.delete-confirm-btn:hover,
button#addStudentFormContainer button.delete-confirm-btn:hover,
button.delete-student-btn:hover {
	background-color: #c82333;
}

/* Grey buttons (cancel delete) */
button.delete-cancel-btn,
button#addStudentFormContainer button.delete-cancel-btn {
	background-color: #6c757d;
}
button.delete-cancel-btn:hover,
button#addStudentFormContainer button.delete-cancel-btn:hover {
	background-color: #5a6268;
}

/* Green buttons (confirm add subject, add/update student) */
button#confirmAddSubjectBtn,
button#addStudentBtn,
button#updateStudentBtn {
	background-color: #2ecc71;
}
button#confirmAddSubjectBtn:hover,
button#addStudentBtn:hover,
button#updateStudentBtn:hover {
	background-color: #27ae60;
}

/* Orange/Warning buttons (cancel add student/subject) */
button#cancelAddSubjectBtn,
button#cancelAddStudentBtn {
	background-color: #f0ad4e;
}
button#cancelAddSubjectBtn:hover,
button#cancelAddStudentBtn:hover {
	background-color: #ec971f;
}

/* Export Excel button */
button#exportExcelBtn {
	background-color: #673ab7;
}

button#exportExcelBtn:hover {
	background-color: #512da8;
}

/* Back to Subjects button */
button#backToSubjectsBtn {
	width: max-content;
	margin-left: 0px;
	margin-right: auto;
	display: block;
}

button#backToSubjectsBtn:hover {
	background-color: #0d47a1;
}

/* Delete Subject button (positioned absolutely) */
button#deleteSubjectBtn {
	position: absolute;
	top: 20px;
	right: 20px;
	width: max-content;
	padding: 10px 20px;
	font-size: 20px;
	margin: 0;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* =======================
   Educator Action Grid
======================== */
.educator-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 10px;
    margin-bottom: 15px;
    width: 100%;
}
.educator-action-grid button {
    margin: 0 !important;
    font-size: 16px;
    padding: 14px 10px;
    max-width: none;
}
.educator-action-grid .full-width-btn {
    grid-column: span 2;
    font-size: 18px;
}

/* =======================
   Forms and Inputs
======================== */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"] {
	padding: 15px;
	font-size: 22px;
	border: 1px solid #ccc;
	border-radius: 5px;
	width: calc(100% - 30px);
	max-width: 380px;
	margin-bottom: 15px;
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.upload-menu-btn {
	cursor: pointer;
	color: white;
	font-size: 22px;
	padding: 18px 20px;
	border-radius: 8px;
	display: block;
	width: 100%;
	max-width: 400px;
	margin: 0 auto 15px auto;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	transition: opacity 0.3s ease, transform 0.2s ease;
	box-sizing: border-box;
	font-weight: bold;
}
.upload-menu-btn:hover {
	opacity: 0.9;
	transform: translateY(-2px);
}

#fileNameDisplay {
	margin-top: 10px;
	font-size: 1.1rem;
	color: #555;
	text-align: center;
	margin-bottom: 20px;
}

/* =======================
   Main Content Containers
======================== */
#uploadContainer, #dataTableContainer, #subjectsContainer {
	display: none;
	background-color: #fff;
	border-radius: 10px;
	box-shadow: 0 5px 15px rgba(0,0,0,0.08);
	margin-top: 10px;
	text-align: center;
	box-sizing: border-box;
	width: calc(100% - 2vw);
	margin-left: 1vw;
	margin-right: 1vw;
	padding: 1vw;	
}

#actionsContainer {
    display: none;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    box-sizing: border-box;
    width: calc(100% - 2vw);
    margin-left: 1vw;
    margin-right: 1vw;
    
    /* 1. REMOVE THE TOP GAP: Set margin and padding to 0 */
    margin-top: 0px !important; 
    padding-top: 0px !important;
    position: relative;
   
}

/* 3. ENSURE THE FIRST ELEMENT INSIDE DOESN'T ADD SPACE */
#actionsContainer > div:first-child {
    margin-top: 0 !important;
    padding-top: 10px !important;
}

/* 4. REMOVE HEADER GAPS INSIDE THIS CONTAINER */
#actionsContainer h2, 
#actionsContainer h3 {
    margin-top: 0 !important;
    padding-top: 0 !important;
}



#dataTableContainer {            
	padding: 0 !important;
	margin-top: 15px !important; /* Keeps it snug against the top card */
	margin-bottom: 0 !important;
	/* Notice we removed the left/right margin overrides so desktop centering works again! */
	background-color: transparent; 
	box-shadow: none; 
}

#subjectsContainer {
	position: relative;
	padding-top: 10px;
}

/* =======================
   Add Subject Form Container
======================== */
#addSubjectFormContainer {
	background-color: #f9f9f9;
	border-radius: 8px;
	padding: 20px;
	margin: 20px auto;
	max-width: 450px;
	box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
	display: none;
	text-align: center;
}
#addSubjectFormContainer input {
	width: calc(100% - 40px);
	max-width: 380px;
	margin-bottom: 15px;
}
#addSubjectFormContainer button {
	width: calc(50% - 10px);
	display: inline-block;
	margin: 5px;
	padding: 12px 20px;
	font-size: 20px;
}
#addSubjectFormContainer button#confirmAddSubjectBtn {
	margin-right: 5px;
}
#addSubjectFormContainer button#cancelAddSubjectBtn {
	margin-left: 5px;
}                                               

/* =======================
   Add/Edit Student Form Container
======================== */
#addStudentFormContainer {
	background-color: #f9f9f9;
	border-radius: 8px;
	padding: 20px;
	margin: 20px auto;
	max-width: 450px;
	box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
	display: none;
	text-align: center;
}

#addStudentFormContainer .form-group {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin-bottom: 15px;
}

#addStudentFormContainer .form-group label {
	font-size: 1.1rem;
	color: #555;
	margin-bottom: 5px;
	font-weight: bold;
}

#addStudentFormContainer input[type="text"],
#addStudentFormContainer input[type="number"],
#addStudentFormContainer input[type="email"],
#addStudentFormContainer input[type="tel"] {
	width: 100%;
	box-sizing: border-box;
	max-width: none;
	margin: 0;
}

/* New side-by-side layout for Add/Cancel */
#addStudentFormContainer .form-button-row {
	display: flex;
	gap: 10px;
	margin-top: 20px;
	justify-content: center;
}

#addStudentFormContainer .form-button-row button {
	flex: 1;
	max-width: 200px;
	margin: 0 !important;
	padding: 12px;
	font-size: 20px;
	border-radius: 8px;
}

/* Styling for the new Attendance Table */
.attendance-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
	background: white;
}
.attendance-table th, .attendance-table td {
	border: 1px solid #ddd;
	padding: 8px;
	text-align: center;
}
.attendance-table th {
	background-color: #f2f2f2;
	font-size: 0.9rem;
}
.attendance-table input[type="radio"] {
	transform: scale(1.5);
	cursor: pointer;
}

/* Attendance fields in student form */
#addStudentFormContainer .attendance-fields {
	margin-top: 20px;
	border-top: 1px solid #eee;
	padding-top: 15px;
	text-align: left;
}
#addStudentFormContainer .attendance-date-group {
	display: flex;
	align-items: center;
	margin-bottom: 10px;
	flex-wrap: wrap;
}
#addStudentFormContainer .attendance-date-group label {
	font-size: 1.1rem;
	font-weight: bold;
	color: #555;
	margin-bottom: 5px;
	display: block;
	width: 100%;
}
#addStudentFormContainer .attendance-date-group .radio-pair {
	display: flex;
	align-items: center;
	margin-right: 15px;
}

#addStudentFormContainer .attendance-date-group input[type="radio"] {
	margin-right: 5px;
	transform: scale(1.5);
}
#addStudentFormContainer .attendance-date-group .radio-pair label {
	margin-bottom: 0;
	margin-right: 0;
	font-size: 0.9em;
	cursor: pointer;
}

/* Responsive containers */
@media (min-width: 769px) {
	#actionsContainer, #uploadContainer, #dataTableContainer, #subjectsContainer {
		width: auto;
		margin-left: auto;
		margin-right: auto;
		max-width: 900px;
		padding: 0px;
	}
}

/* =======================
   Table: Single Day Attendance (Take Attendance)
======================== */
table {
	border-collapse: collapse;
	margin-top: 5px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	background-color: white;
	width: max-content;
	min-width: 100%;
	table-layout: fixed;
}

th, td {
	border: 1px solid #ddd;
	padding: 12px;
	text-align: left;
	font-size: 1.1rem;
}

th {
	white-space: nowrap;
	background-color: #f2f2f2;
	font-weight: bold;
	position: sticky;
	top: 0;
	z-index: 3; /* Elevated to keep headers above scrolling rows */
	box-sizing: border-box;
	background-clip: padding-box; /* Stops content from bleeding through */
	outline: 1px solid #ddd; /* Seals transparent border seams */
	outline-offset: -1px;
}

tr:nth-child(even) { background-color: #f9f9f9; }
tr:hover { background-color: #f1f1f1; }

/* --- TARGETED FIXES FOR WRAPPING & SIZING --- */
.take-attendance-table {
	table-layout: auto !important; /* Lets the browser size columns based on content */
}

.take-attendance-table th:nth-child(1), 
.take-attendance-table td:nth-child(1) { 
	width: auto; 
	white-space: nowrap; /* NEVER wrap the roll number */
	word-break: normal;
}

.take-attendance-table th:nth-child(2), 
.take-attendance-table td:nth-child(2) { 
	width: 100%; /* Pushes the name column to take all remaining space */
	word-break: normal; 
	white-space: normal; 
	overflow-wrap: break-word; 
}

.take-attendance-table th:nth-child(3), 
.take-attendance-table td:nth-child(3) {
	width: 60px; /* Locks the P/A column to a small square */
	min-width: 60px;
	text-align: center;
}

.take-attendance-table td:nth-child(1),
.take-attendance-table td:nth-child(2),
.take-attendance-table td:nth-child(3) {
  color: white; /* Applies the green/red to text, or you can remove this if you prefer black text on green/red bg */
  padding-top: 14px !important;
  padding-bottom: 14px !important;
}

.take-attendance-table td:nth-child(3) {
	font-weight: bold;
	font-size: 1.2rem; /* Makes the 'P' and 'A' stand out */
}

.take-attendance-table td:nth-child(1) { text-align:center;}

/* Styling for date input within the header */
.take-attendance-table th input[type="date"] {
	box-sizing: border-box;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	padding: 0;
	border: none;
	background: transparent;
}
.take-attendance-table th {
  font-size: 0.85rem;          
}

/* Responsive table for single day attendance */
@media (max-width: 768px) {
	th, td {
		padding: 4px;
		font-size: 1em;
	}
	.take-attendance-table td:nth-child(3) { font-size: 1.2rem; }
}

/* =======================
   Table: View Attendance (Multi-Day)
======================== */
.view-attendance-table {
	table-layout: auto;
	width: 100%;
	margin: 0;
	padding: 0;
}
.view-attendance-table th {
	font-size: 0.8rem;         
}

.table-responsive {
	margin: 0;
	padding: 0;
	width: 100%;
	overflow-x: auto;
	overflow-y: clip; /* CRITICAL: Lets headers stick to the main screen! */
	-webkit-overflow-scrolling: touch;
}

/* --- FROZEN (STICKY) COLUMNS --- */
.view-attendance-table .select-cell {
	position: sticky;
	left: 0;
	z-index: 2;
	background-color: #f8f8f8;
	min-width: 45px;
	max-width: 45px;
	text-align: center;
	box-sizing: border-box;
	background-clip: padding-box; /* Seals the edge bleed */
	outline: 1px solid #ddd; /* Paints over transparent border seams */
	outline-offset: -1px;
}

.view-attendance-table .roll-no-cell {
	position: sticky;
	left: 0; 
	z-index: 2;
	background-color: #f8f8f8;
	min-width: 135px; /* Dialed back to 135px */
	max-width: 135px;
	padding: 8px 0px;
	color: black;
	white-space: nowrap; 
	overflow: hidden;
	text-overflow: clip; 
	font-size: 0.85em;
	box-sizing: border-box; 
	background-clip: padding-box; 
	outline: 1px solid #ddd; 
	outline-offset: -1px;
}
.bulk-mode .roll-no-cell { left: 45px; } 

.view-attendance-table .full-name-cell {
	position: sticky;
	left: 135px; /* Matches the new 135px Roll No width */
	z-index: 2;
	background-color: #f8f8f8;
	min-width: 140px;
	max-width: 140px;
	text-align: left;
	padding: 8px 0px;
	color: black;
	white-space: normal;
	word-break: normal; 
	overflow-wrap: normal;
	font-size: 0.85em; 
	box-sizing: border-box; 
	background-clip: padding-box; 
	outline: 1px solid #ddd; 
	outline-offset: -1px;
	box-shadow: 4px 0 5px -2px rgba(0, 0, 0, 0.1); 
}
.bulk-mode .full-name-cell { left: 180px; } /* 45 + 135 */

/* Ensure Headers stay above the scrolling rows */
.view-attendance-table th.select-cell,
.view-attendance-table th.roll-no-cell,
.view-attendance-table th.full-name-cell {
	z-index: 5; /* Highest priority to protect the top-left corner */
	top: 0;
	background-color: #f2f2f2;
}

/* --- REDUCED DATE COLUMNS FOR 'P' and 'A' --- */
.view-attendance-table th.attendance-date-cell {
  white-space: normal;           
  min-width: 25px; 
  max-width: 35px;
  padding: 0px;
  text-align: center;
  font-size: 0.75rem; 
  line-height: 1.2;
}

.view-attendance-table td.attendance-cell {
  color: white;          
  min-width: 35px; 
  padding: 1px;
  text-align: center;
  font-weight: bold;
  font-size: 1.1rem;
}       

.view-attendance-table td.phone-cell,
.view-attendance-table td.email-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: none;
  width: auto;
  font-size: 0.95em;
  padding: 6px 8px;
  color: black;
}

.view-attendance-table td.phone-cell { min-width: 100px; }
.view-attendance-table td.email-cell { min-width: 130px; }

/* Responsive overrides for smaller phones */
@media (max-width: 768px) {
	.view-attendance-table .roll-no-cell { min-width: 100px; max-width: 125px; }
	.bulk-mode .roll-no-cell { left: 45px; }
	
	.view-attendance-table .full-name-cell {
		left: 125px; /* Matches mobile Roll No width */
		min-width: 120px; max-width: 120px;
	}
	.bulk-mode .full-name-cell { left: 170px; } /* 45 + 125 */

	.view-attendance-table th.attendance-date-cell { min-width: 25px; max-width: 35px; font-size: 0.7rem; }
	.view-attendance-table td.attendance-cell { min-width: 35px; }
}

/* =======================
   Toast Notifications
======================== */
.toast {
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	position: fixed;
	z-index: 2147483647;
	left: 50%;
	bottom: 10%;
	transform: translateX(-50%) translateY(10px);
	background-color: rgba(0, 0, 0, 0.88);
	color: #fff;
	padding: 10px 16px;
	border-radius: 20px;
	font-size: 0.95rem;
	font-weight: 500;
	text-align: center;
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
	max-width: 92%;
	min-width: 120px;
	max-width: 360px;
	line-height: 1.4;
	letter-spacing: 0.01em;
	box-sizing: border-box;
	word-break: break-word;
}

.toast.show {
	visibility: visible;
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* =======================
   Attendance Toggle Radio Buttons
======================== */
.attendance-toggle-container {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 15px;
	border-bottom: 1px solid #eee;
	margin-top: 10px;
	margin-bottom: 10px;
	line-height: 1.2;
	padding: 10px 0;
}

.attendance-toggle-container label {
	cursor: pointer;
	font-size: 1.3em;
	color: #555;
}

.attendance-toggle-container input[type="radio"] {
	margin-right: 5px;
	transform: scale(2);
}

/* =======================
   Marks and Remarks Entry UI Styling
======================== */
#enterMarksFormContainer, #enterRemarksFormContainer {
  background-color: #eef6ff;
  padding: 0px;
  margin: 25px auto;
  max-width: 450px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  text-align: center;
  border: 1px solid #d3e0ef;
}

#enterMarksFormContainer input[type="text"],
#enterRemarksFormContainer input[type="text"],
#enterMarksFormContainer input[type="number"],
#enterRemarksFormContainer textarea {
  font-size: 20px;
  padding: 12px;
  margin-bottom: 15px;
  width: calc(100% - 30px);
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#enterMarksFormContainer button,
#enterRemarksFormContainer button {
  font-size: 20px;
  padding: 12px 24px;
  margin: 5px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#enterMarksFormContainer button:first-of-type,
#enterRemarksFormContainer button:first-of-type {
  background-color: #3498db;
  color: white;
}

#enterMarksFormContainer button:last-of-type,
#enterRemarksFormContainer button:last-of-type {
  background-color: #6c757d;
  color: white;
}

.enter-marks-table input[type="number"] {
  font-size: 16px;
  padding: 2px 2px;
  height: 60px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  width: 100%;
  min-height: 60px;
  resize: horizontal;
  text-align: left;
}

.table-responsive .enter-remarks-table {
  table-layout: fixed;
  width: 100%;
}

.table-responsive .enter-remarks-table th:nth-child(1),
.table-responsive .enter-remarks-table td:nth-child(1) {
  width: 100px;
  padding: 4px;
  text-align: center;
}

.table-responsive .enter-remarks-table th:nth-child(2),
.table-responsive .enter-remarks-table td:nth-child(2) {
  width: 80px;
  padding: 4px;
}

.table-responsive .enter-remarks-table th:nth-child(3),
.table-responsive .enter-remarks-table td:nth-child(3) {
  width: auto;
}

.table-responsive .enter-remarks-table textarea {
  width: 100% !important; 
  min-height: 80px;
  max-width: none !important;
  padding: 6px;
  font-size: 12px !important;
  box-sizing: border-box;
  resize: vertical;
  border-radius: 4px;
}

.enter-marks-table th,
.enter-remarks-table th {
  background-color: #f0f8ff;
  font-size: 1.1em;
}

/* =======================
   VIEW MARKS TABLE STYLING
======================== */
.view-marks-table td.fullname {
 text-align: left;
 white-space: normal;
 word-break: break-word;
 overflow-wrap: break-word;
 hyphens: auto;
}

.view-marks-table {
 table-layout: auto;
 width: auto;
 margin: 0;
 padding: 0;
}

.view-marks-table th,
.view-marks-table td {
 border: 1px solid #ccc;
 padding: 10px;
 text-align: center;
 white-space: nowrap;
}

.view-marks-table th {
 background-color: #f0f8ff;
 font-weight: bold;
 font-size: 1.1em;
 cursor: pointer;
}

.view-marks-table td {
 font-size: 15px;
}

.view-marks-table td.remarks-cell {
 white-space: normal !important;
 min-width: 200px;
 max-width: 400px;
 text-align: left;
}

.view-marks-table tr:nth-child(even) {
 background-color: #fafafa;
}

.view-marks-table tr:hover {
 background-color: #f5f5f5;
}

.view-marks-table th.highlighted,
.view-marks-table td.highlighted {
   background-color: #fff59d !important;
}

.view-attendance-table th.highlighted-attendance,
.view-attendance-table td.highlighted-attendance {
   background-color: #fff59d !important;
   color: black;
}

.view-attendance-table tr.highlighted-student {
	background-color: #b3e5fc !important;
	color: black;
}
.view-attendance-table tr.highlighted-student td {
	color: black !important;
}
/* --- FIX: Force the blue highlight onto all sticky columns --- */
.view-attendance-table tr.highlighted-student td.select-cell,
.view-attendance-table tr.highlighted-student td.roll-no-cell,
.view-attendance-table tr.highlighted-student td.full-name-cell {
   background-color: #b3e5fc !important;
}

.view-marks-table td.phone-cell,
.view-marks-table td.email-cell {
 white-space: nowrap;
 overflow: hidden;
 text-overflow: ellipsis;
 font-size: 0.95em;
 padding: 6px 8px;
 color: black;
 width: auto;
 max-width: none;
}

.view-marks-table td.phone-cell {
 width: 120px;
}

@media (max-width: 768px) {
 .view-marks-table td.phone-cell {
   width: 120px;
 }

 .view-marks-table td.email-cell {
   width: 180px;
 }
}

/* =======================
   Swipe to Delete UI (Reusable styles)
======================== */
.swipe-container {
	margin: 20px auto;
	width: 90%;
	height: 40px;
	background: #eee;
	border-radius: 20px;
	position: relative;
	overflow: hidden;
	border: 1px solid #ccc;
}

.swipe-instruction-text {
	position: absolute;
	right: 15px;
	top: 50%;
	transform: translateY(-50%);
	color: #777;
	user-select: none;
	z-index: 0;
	font-size: 1.2em;
}

.swipe-thumb {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 60px;
	background: #d9534f;
	color: #fff;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 20px;
	cursor: pointer;
	transition: left 0.2s;
	user-select: none;
	font-weight: bold;
	z-index: 1;
}

/* =======================
   Attendance Summary Display
======================== */
#attendanceSummary {
	font-size: 1.2em;
	margin: 10px 0;
	padding: 10px;
	background-color: #e0f2f7;
	border-radius: 8px;
	text-align: center;
	display: flex;
	justify-content: space-around;
	flex-wrap: wrap;
	gap: 10px;
}
#attendanceSummary span {
	font-weight: bold;
	padding: 5px 10px;
	border-radius: 5px;
}
#attendanceSummary .present {
	color: #1b5e20;
}
#attendanceSummary .absent {
	color: #b71c1c;
}
#attendanceSummary .total {
	color: #1a237e;
}

#liveBannerSummaryWrapper #attendanceSummary {
	margin: 5px 0 0 0 !important;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
	border: 1px solid #cce9f4;
}

/* =======================
   Attendance Chart
======================== */
.attendance-chart-container h3 {
	margin-top: 0;
	margin-bottom: 15px;
	color: #333;
	font-size: 1.3rem;
	text-align: center;
	line-height: 1.4;
	word-wrap: break-word;
}
.attendance-chart-subtitle {
	display: block;
	font-size: 1rem;
	color: #666;
	font-weight: normal;
	margin-top: 4px;
}
.chart-row {
	display: flex;
	align-items: center;
	margin-bottom: 12px;
}
.chart-label {
	width: 70px;
	font-size: 0.95rem;
	text-align: right;
	margin-right: 15px;
	color: #555;
	font-weight: bold;
}
.chart-bar-bg {
	flex-grow: 1;
	background-color: #e0e0e0;
	height: 22px;
	border-radius: 11px;
	overflow: hidden;
	position: relative;
}
.chart-bar-fill {
	height: 100%;
	width: 0%;
	transition: width 0.8s ease-out;
}
.chart-bar-fill.red { background-color: #ff4d4d; }
.chart-bar-fill.orange { background-color: #ffa500; }
.chart-bar-fill.yellow { background-color: #ffd700; }
.chart-bar-fill.green { background-color: #4caf50; }

.chart-value {
	width: 50px;
	font-size: 0.95rem;
	text-align: right;
	margin-left: 10px;
	font-weight: bold;
	color: #333;
}

/* =======================
	font-size: 0.85rem;
	color: #7f8c8d;
	margin-top: 8px;
	font-style: italic;
}

#navBackupBtn { background-color: #0f9d58; font-weight: bold; margin:0; }
#navBackupBtn:hover { background-color: #0b8043; }

/* =======================
   Staging Area (Mapping UI)
======================== */
.mapping-table {
	width: 100%;
	table-layout: fixed; /* NEW: Forces table to stay on screen! */
	border-collapse: collapse;
	margin-top: 15px;
	background: white;
	text-align: left;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.mapping-table th, .mapping-table td {
	border: 1px solid #ddd;
	padding: 6px; 
	font-size: 0.9rem;
	word-wrap: break-word; /* NEW: Prevents long text from breaking layout */
}
.mapping-table th {
	background-color: #34495e;
	color: white;
	position: sticky;
	top: 0;
	font-size: 0.85rem;
}
.mapping-table th {
	background-color: #34495e;
	color: white;
	position: sticky;
	top: 0;
	font-size: 0.85rem;
}
.mapping-table tr:hover { background-color: #f1f8ff; }

.mapping-select {
	padding: 8px 4px;
	font-size: 0.85rem;
	border-radius: 5px;
	border: 1px solid #ccc;
	width: 100%;
	box-sizing: border-box;
	background-color: #f9f9f9;
	cursor: pointer;
}
.mapping-select.mapped {
	background-color: #d4edda;
	border-color: #28a745;
	font-weight: bold;
	color: #155724;
}
.mapping-header-input {
	width: 100%;
	padding: 6px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-weight: bold;
	font-size: 0.9rem;
	box-sizing: border-box;
}
.mapping-sample-data {
	color: #777;
	font-size: 0.75rem;
	margin-top: 4px;
	font-style: italic;
	word-wrap: break-word;
}
.mapping-date-input {
	margin-top: 8px;
	padding: 6px;
	width: 100%;
	box-sizing: border-box;
	font-size: 0.85rem;
	border: 1px solid #3498db;
	border-radius: 4px;
	display: none;
}

/* =======================
   CONSISTENT COLUMN BEHAVIOR (MATCH ATTENDANCE TABLE LOGIC)
======================= */

/* Core principle:
   - Roll: min-content (never wraps)
   - Name: wraps ONLY at spaces, sized by longest word
   - Notes: takes ALL remaining space
*/

/* =======================
   1. ENTER REMARKS TABLE
======================= */
.table-responsive .enter-remarks-table {
  table-layout: auto !important;
  width: 100%;
}

/* Roll No → tight, no wrap */
.table-responsive .enter-remarks-table th:nth-child(1),
.table-responsive .enter-remarks-table td:nth-child(1) {
  width: 1%;
  white-space: nowrap;
}

/* Name → break ONLY at spaces, respect longest word */
.table-responsive .enter-remarks-table th:nth-child(2),
.table-responsive .enter-remarks-table td:nth-child(2) {
  min-width: 120px;
  max-width: 220px;
  white-space: normal;
  word-break: normal;              /* key: no breaking inside words */
  overflow-wrap: break-word;       /* wrap only when needed */
  hyphens: auto;
}

/* Remarks → take ALL remaining width */
.table-responsive .enter-remarks-table th:nth-child(3),
.table-responsive .enter-remarks-table td:nth-child(3) {
  width: auto;
}

/* Bigger, consistent textarea */
.table-responsive .enter-remarks-table textarea {
  width: 100%;
  min-height: 120px;
  font-size: 14px !important;
  line-height: 1.4;
}


/* =======================
   2. VIEW MARKS TABLE (KEEP SAME BEHAVIOR)
======================= */
.view-marks-table {
  table-layout: auto !important;
  width: 100%;
}

/* Roll */
.view-marks-table td:first-child {
  white-space: nowrap;
  width: 1%;
}

/* Name */
.view-marks-table td.fullname {
  min-width: 120px;
  max-width: 220px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Remarks → consistent with enter screen */
.view-marks-table td.remarks-cell {
  width: auto;
  min-width: 250px;
  max-width: none; /* allow expansion */
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.4;
}


/* =======================
   3. GLOBAL TEXT SAFETY (CONTROLLED)
======================= */
th, td {
  overflow-wrap: break-word;
}


/* =======================
   4. PREVENT SQUEEZING → SCROLL INSTEAD
======================= */
.table-responsive {
  overflow-x: auto;
}


/* =======================
   5. OPTIONAL: MATCH ATTENDANCE FEEL EXACTLY
======================= */
/* Uncomment if you want even tighter consistency */
/*
.enter-remarks-table {
  table-layout: auto !important;
}

.enter-remarks-table td:nth-child(2) {
  width: 100%;
}
*/

/* =======================
   Attention Flasher for GPS
======================== */
@keyframes rowTextFlash {
	0% { color: #FFE600; text-shadow: 0 0 10px rgba(255, 230, 0, 0.8); }
	50% { color: #ffffff; text-shadow: none; }
	100% { color: #FFE600; text-shadow: 0 0 10px rgba(255, 230, 0, 0.8); }
}
.attention-row td {
	/* The !important flag ensures it overrides the default white text */
	animation: rowTextFlash 1s infinite alternate ease-in-out !important;
}

/* --- PROGRESSIVE CAPTURE BAR --- */
.capture-progress-container {
    width: 100%;
    max-width: 250px;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    margin: 10px auto;
    overflow: hidden;
    border: 1px solid #ccc;
}

.capture-progress-fill {
    height: 100%;
    width: 0%; 
    background: linear-gradient(90deg, #9b59b6, #8e44ad);
    transition: width 0.2s ease-out;
}

.capture-status-text {
    font-size: 0.85rem;
    font-weight: bold;
    color: #8e44ad;
    margin-top: 5px;
}


/* --- PEER VERIFICATION UI (Smart Connection Lines) --- */

/* Ensure positioning works, but keep the native dark green background */
.peer-from-above td,
.peer-from-below td {
    position: relative;
}

/* --- PEER VERIFICATION UI (Sub-text approach) --- */

/* Ensure the background stays dark green */
.peer-receiver td {
    background-color: #1b5e20 !important; 
}

/* Ensure the text stays white so the yellow sub-text pops */
.peer-receiver td {
    color: white !important;
}

/* Add a tiny bit of padding to the name column so the sub-text looks nice */
.peer-receiver td:nth-child(2) {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}


/* --- Educator Mode Final Layout Fix --- */

/* Center the main container and keep it tight to the top */
#educatorModeContainer {
    max-width: 500px !important;
    margin: 0 auto !important;
    padding-top: 0 !important;
}


/* Keep the global header tight to the top */
.header-container {
    margin-top: 0 !important;
    padding-top: 10px !important;
}


/* --- Fix the Big Gap under the Header Card in Sub-Views --- */

/* 1. When a sub-screen is active, the main Upload button hides.
      We use this trigger to remove the giant bottom padding so the table slides up! */
#actionsContainer:has(#uploadStudentDataBtn[style*="display: none"]) {
    padding-bottom: 5px !important;
}

/* 2. Override the hardcoded 25px bottom margin on the header card */
#actionsContainer .subject-card {
    margin-bottom: 10px !important;
}

/* 3. Pull the data table tighter to the card */
#dataTableContainer {
    margin-top: 5px !important;
    padding-top: 0px !important;
}


/* ====================================================
   THE UNIVERSAL BOTTOM OVERLAP FIX
   ==================================================== */

/* 1. The Ultimate Bumper: Forces the entire webpage to leave 130px of empty space 
      at the absolute bottom, so the scrollbar ALWAYS clears the fixed tabs. */
body {
    padding-bottom: 130px !important;
}

/* 2. Reset the tabs so they just have a normal 15px bottom padding 
      (The body tag above is now doing all the heavy lifting) */
#globalProfileTab, 
#subjectsContainer, 
#educatorArchivesTab,
#actionsContainer,
#uploadContainer,
#dataTableContainer,
#manageDataContainer,
[id*="FormContainer"] {
    padding-bottom: 15px !important; 
    padding-top: 10px !important;    
}

/* 3. Safety Net for popups (like "Add Student Manually") 
      Ensures dark overlays always cover the bottom nav bar */
div[style*="position:fixed"][style*="background:rgba"],
div[style*="position: fixed"][style*="background: rgba"] {
    z-index: 99999 !important;
}

/* =======================
   Back Button (consistent look)
======================== */
.back-btn {
	background-color: #34495e; /* unified back button color */
	color: #ffffff;
	border: none;
	padding: 8px 15px;
	border-radius: 8px;
	cursor: pointer;
	font-weight: bold;
	display: inline-block;
}
.back-btn:hover { background-color: #2c3e50; transform: translateY(-1px); }

.fetch-enrollments-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    margin-right: 10px;
}
.fetch-enrollments-btn:hover { background-color: #2980b9; }

/* =======================
   Upload Marks UI
======================== */
.upload-marks-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.6);
    z-index: 10005;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.upload-marks-modal {
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.upload-marks-btn {
    width: 100%;
    max-width: 350px;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    margin: 0 !important;
}

.upload-marks-btn-excel { background: #27ae60; color: white; }
.upload-marks-btn-photo { background: #e67e22; color: white; }
.upload-marks-btn-cancel { background: #95a5a6; color: white; padding: 12px; }

/* =======================
   Toggle Switches (iOS Style)
======================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2ecc71;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Chat Settings List Row */
.chat-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

/* =======================
   Notification Badge
======================== */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}