/* Design System and Variables */
:root {
    --bg-main: hsl(224, 71%, 4%);
    --bg-card: hsla(223, 47%, 8%, 0.75);
    --bg-header: hsla(223, 47%, 6%, 0.85);
    
    --border-color: hsla(222, 32%, 18%, 0.7);
    --border-hover: hsla(222, 32%, 30%, 0.9);
    
    --color-primary: hsl(250, 95%, 68%);
    --color-primary-hover: hsl(250, 95%, 74%);
    --color-primary-glow: hsla(250, 95%, 68%, 0.35);
    
    --color-success: hsl(156, 90%, 40%);
    --color-success-hover: hsl(156, 90%, 46%);
    --color-success-glow: hsla(156, 90%, 40%, 0.3);
    
    --color-danger: hsl(354, 85%, 56%);
    --color-danger-hover: hsl(354, 85%, 62%);
    --color-danger-glow: hsla(354, 85%, 56%, 0.3);
    
    --text-primary: hsl(210, 40%, 98%);
    --text-secondary: hsl(217, 18%, 70%);
    --text-muted: hsl(217, 10%, 50%);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.8);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-sans: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Global Resets & Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Ambient glow blobs */
.bg-glow {
    position: fixed;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(160px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.25;
}

.bg-glow-1 {
    top: -20%;
    left: -10%;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
}

.bg-glow-2 {
    bottom: -20%;
    right: -10%;
    background: radial-gradient(circle, var(--color-success) 0%, transparent 70%);
}

/* Glassmorphism panels */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* View panel control */
.view-panel {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn var(--transition-normal);
}

.view-panel.active {
    display: flex;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Headers */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-radius: 16px;
}

.header-left h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    gap: 1rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-admin {
    background-color: hsla(250, 95%, 68%, 0.15);
    color: var(--color-primary);
    border: 1px solid hsla(250, 95%, 68%, 0.25);
}

.badge-school {
    background-color: hsla(156, 90%, 40%, 0.15);
    color: var(--color-success);
    border: 1px solid hsla(156, 90%, 40%, 0.25);
}

/* Cards */
.card {
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.card h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Layout Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.dashboard-grid.single-col {
    grid-template-columns: 1fr;
}

.school-layout {
    grid-template-columns: 380px 1fr;
}

@media (max-width: 1024px) {
    .dashboard-grid, .school-layout {
        grid-template-columns: 1fr;
    }
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.input-group.search-group {
    flex: 2;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background: rgba(255, 255, 255, 0.05);
}

textarea {
    resize: none;
}

/* Custom inputs wrappers with icons */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .field-icon,
.input-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    width: 1.1rem;
    height: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
}

.input-wrapper input {
    padding-left: 2.75rem;
}

.input-wrapper input:focus + .field-icon,
.input-wrapper input:focus + .search-icon {
    color: var(--color-primary);
}

/* Select wrapper for custom arrow style */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.65rem;
    color: var(--text-muted);
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--text-primary);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--color-success-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: hsla(222, 32%, 18%, 0.5);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: hsla(222, 32%, 25%, 0.7);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Glowing buttons */
.btn-glow {
    box-shadow: 0 4px 14px var(--color-primary-glow);
}

.btn-glow:hover:not(:disabled) {
    box-shadow: 0 6px 20px var(--color-primary-glow);
}

/* Login Panel Styling */
.login-card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    width: 100%;
    max-width: 440px;
    border-radius: 20px;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-success) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--text-primary);
    box-shadow: 0 8px 20px rgba(110, 89, 255, 0.4);
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.role-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.25rem;
    margin-bottom: 1.5rem;
}

.role-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.role-btn.active {
    background: var(--color-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Admin Tabs Styling */
.admin-tabs {
    display: flex;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--color-primary);
}

.tab-content {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.tab-content.active {
    display: block;
}

/* Tables design */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table th {
    background-color: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Action icons inside tables */
.btn-icon-grid {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: hsla(222, 32%, 18%, 0.3);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn-icon-edit:hover {
    background-color: hsla(250, 95%, 68%, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-icon-delete:hover {
    background-color: hsla(354, 85%, 56%, 0.15);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.btn-icon-photo {
    background-color: hsla(156, 90%, 40%, 0.1);
    border-color: hsla(156, 90%, 40%, 0.2);
    color: var(--color-success);
}

.btn-icon-photo:hover {
    background-color: hsla(156, 90%, 40%, 0.2);
    border-color: var(--color-success);
    color: var(--color-success-hover);
}

.btn-icon svg {
    width: 1rem;
    height: 1rem;
}

/* Photo Thumbnail inside table */
.student-avatar {
    width: 2.75rem;
    height: 3.5rem;
    border-radius: 6px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.student-avatar:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

/* School Export Details Stats */
.school-stats-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: inline-flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-success);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Photo Selector & Preview inside Student Form */
.photo-selection-area {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    transition: var(--transition-fast);
}

.photo-selection-area:focus-within {
    border-color: var(--color-primary);
}

.photo-selection-area label {
    margin-bottom: 0.75rem;
}

.photo-preview-container {
    width: 150px;
    height: 187px; /* 4:5 Portrait ratio standard for ID cards */
    margin: 0 auto 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

.photo-placeholder span {
    font-size: 0.75rem;
}

.photo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* Filters UI */
.filter-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.25rem 0.25rem;
    margin-bottom: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-row .input-group {
    flex: 1;
    min-width: 150px;
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-fast);
}

.btn-close:hover {
    color: var(--text-primary);
}

/* Camera Stream layout */
.camera-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4 / 3;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background-color: #000;
    border: 1px solid var(--border-color);
}

#webcam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror effect */
}

/* Face guides inside camera overlay */
.face-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.face-oval {
    width: 40%;
    aspect-ratio: 3 / 4;
    max-width: 180px;
    max-height: 240px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6); /* dims the outer bounds */
    border-radius: 50%;
    transition: var(--transition-normal);
}

.face-guide-text {
    position: absolute;
    bottom: 2rem;
    font-size: 0.85rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    letter-spacing: 0.03em;
}

.camera-controls {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Countdown overlay */
.camera-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
}

/* Dynamic Toasts styling */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: hsla(223, 47%, 8%, 0.9);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: var(--transition-normal);
    transform: translateY(0);
    opacity: 1;
    backdrop-filter: blur(10px);
}

.toast.hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
}

.toast.success {
    border-color: var(--color-success);
    box-shadow: 0 4px 20px var(--color-success-glow);
}

.toast.error {
    border-color: var(--color-danger);
    box-shadow: 0 4px 20px var(--color-danger-glow);
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

.mt-05 { margin-top: 0.5rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.max-w-xl { max-width: 36rem; }
.max-w-md { max-width: 28rem; }

.icon-circle {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: hsla(250, 95%, 68%, 0.1);
    border: 1px solid hsla(250, 95%, 68%, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

/* ================= RESPONSIVE MEDIA QUERIES ================= */

/* Tablet & Mobile layout adjustments (under 1024px) */
@media (max-width: 1024px) {
    .app-container {
        padding: 1rem;
    }
    .app-header {
        padding: 1rem 1.5rem;
    }
}

/* Mobile & Tablet UI refinements (under 768px) */
@media (max-width: 768px) {
    .app-container {
        padding: 0.75rem 0.5rem;
        gap: 1rem;
    }
    
    .app-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
        border-radius: 12px;
    }
    
    .header-left {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }
    
    .header-left h1 {
        font-size: 1.35rem;
    }
    
    .header-right {
        width: 100%;
    }
    
    .header-right .btn {
        width: 100%;
    }
    
    .card {
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }
    
    .dashboard-grid, .school-layout {
        gap: 1rem;
    }
    
    .filter-panel {
        padding: 1rem 1rem 0.25rem;
        margin-bottom: 0.75rem;
    }
    
    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .filter-row .input-group {
        margin-bottom: 0.5rem;
        width: 100% !important;
        min-width: 0;
    }
    
    /* Responsive Cards from Tables for Students */
    .records-card .table-container {
        background: none;
        border: none;
    }
    
    .records-card .data-table thead {
        display: none;
    }
    
    .records-card .data-table, 
    .records-card .data-table tbody, 
    .records-card .data-table tr, 
    .records-card .data-table td {
        display: block;
        width: 100%;
    }
    
    .records-card .data-table tr {
        position: relative;
        min-height: 124px;
        padding: 1rem 1rem 1rem 95px !important;
        margin-bottom: 0.75rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 0.2rem;
    }
    
    .records-card .data-table td {
        padding: 0 !important;
        border: none !important;
        background: none !important;
        text-align: left !important;
        width: auto;
    }
    
    /* Photo Cell (Absolute positioned left) */
    .records-card .data-table td:nth-child(1) {
        position: absolute;
        left: 1rem;
        top: 1rem;
    }
    
    .records-card .data-table td:nth-child(1) .student-avatar {
        width: 66px;
        height: 82.5px; /* 4:5 Portrait */
        margin: 0;
        border-radius: 8px;
    }
    
    /* Full Name (prominent at top) */
    .records-card .data-table td:nth-child(6) {
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 0.2rem;
        order: -2;
        padding-right: 130px !important; /* Prevent overlap with inline action buttons */
    }
    
    /* Standard, Division, Roll No (display inline on second row) */
    .records-card .data-table td:nth-child(2),
    .records-card .data-table td:nth-child(3),
    .records-card .data-table td:nth-child(4) {
        display: inline-block;
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-right: 0.5rem;
        order: -1;
    }
    
    .records-card .data-table td:nth-child(2)::before { content: "Std: "; font-weight: 500; color: var(--text-muted); }
    .records-card .data-table td:nth-child(3)::before { content: "Div: "; font-weight: 500; color: var(--text-muted); }
    .records-card .data-table td:nth-child(4)::before { content: "Roll: "; font-weight: 500; color: var(--text-muted); }
    
    /* GR Number */
    .records-card .data-table td:nth-child(5) {
        font-size: 0.8rem;
        color: var(--text-muted);
    }
    .records-card .data-table td:nth-child(5)::before { content: "GR: "; font-weight: 500; }
    
    /* Parents Mobile */
    .records-card .data-table td:nth-child(7) {
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-top: 0.1rem;
    }
    .records-card .data-table td:nth-child(7)::before { content: "📞 "; }
    
    /* Actions (placed top right) */
    .records-card .data-table td:nth-child(8) {
        position: absolute;
        right: 0.75rem;
        top: 0.75rem;
    }
    
    /* Responsive Cards for Admin Registered Schools Table */
    #tab-schools .table-container {
        background: none;
        border: none;
    }
    
    #tab-schools .data-table thead {
        display: none;
    }
    
    #tab-schools .data-table,
    #tab-schools .data-table tbody,
    #tab-schools .data-table tr,
    #tab-schools .data-table td {
        display: block;
        width: 100%;
    }
    
    #schools-table-body tr {
        position: relative;
        display: flex;
        flex-direction: column;
        padding: 1rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        margin-bottom: 0.75rem;
        gap: 0.25rem;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
    }
    
    #schools-table-body td {
        padding: 0 !important;
        border: none !important;
        background: none !important;
        text-align: left !important;
    }
    
    #schools-table-body td:nth-child(1) {
        font-size: 1.05rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 0.1rem;
    }
    
    #schools-table-body td:nth-child(2) {
        font-size: 0.85rem;
        color: var(--color-primary);
        margin-bottom: 0.2rem;
    }
    
    #schools-table-body td:nth-child(2)::before {
        content: "User: ";
        color: var(--text-muted);
        font-weight: 500;
    }
    
    #schools-table-body td:nth-child(3) {
        font-size: 0.8rem;
        color: var(--text-muted);
    }
    #schools-table-body td:nth-child(3)::before {
        content: "Created: ";
    }
    
    #schools-table-body td:nth-child(4) {
        position: absolute;
        right: 0.75rem;
        top: 0.75rem;
    }
    
    /* Responsive Cards for Admin Registration Requests Table */
    #tab-requests .table-container {
        background: none;
        border: none;
    }
    
    #tab-requests .data-table thead {
        display: none;
    }
    
    #tab-requests .data-table,
    #tab-requests .data-table tbody,
    #tab-requests .data-table tr,
    #tab-requests .data-table td {
        display: block;
        width: 100%;
    }
    
    #requests-table-body tr {
        position: relative;
        display: flex;
        flex-direction: column;
        padding: 1rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        margin-bottom: 0.75rem;
        gap: 0.25rem;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
    }
    
    #requests-table-body td {
        padding: 0 !important;
        border: none !important;
        background: none !important;
        text-align: left !important;
    }
    
    #requests-table-body td:nth-child(1) {
        font-size: 1.05rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 0.1rem;
    }
    
    #requests-table-body td:nth-child(2)::before {
        content: "UDISE: ";
        color: var(--text-muted);
        font-weight: 500;
    }
    #requests-table-body td:nth-child(2) {
        font-size: 0.85rem;
        color: var(--text-secondary);
    }
    
    #requests-table-body td:nth-child(3)::before {
        content: "Contact: ";
        color: var(--text-muted);
        font-weight: 500;
    }
    #requests-table-body td:nth-child(3) {
        font-size: 0.85rem;
        color: var(--text-secondary);
    }
    
    #requests-table-body td:nth-child(4)::before {
        content: "Address: ";
        color: var(--text-muted);
        font-weight: 500;
    }
    #requests-table-body td:nth-child(4) {
        font-size: 0.85rem;
        color: var(--text-secondary);
        white-space: normal !important;
    }
    
    #requests-table-body td:nth-child(5)::before {
        content: "Contact Details: ";
        color: var(--text-muted);
        font-weight: 500;
        display: block;
    }
    #requests-table-body td:nth-child(5) {
        font-size: 0.85rem;
        color: var(--text-secondary);
        margin-top: 0.25rem;
    }
    
    #requests-table-body td:nth-child(6)::before {
        content: "Requested On: ";
        color: var(--text-muted);
        font-weight: 500;
    }
    #requests-table-body td:nth-child(6) {
        font-size: 0.8rem;
        color: var(--text-muted);
    }
    
    #requests-table-body td:nth-child(7) {
        position: absolute;
        right: 0.75rem;
        top: 0.75rem;
    }
    
    /* Camera Modal adjustments */
    .modal-overlay {
        padding: 0.75rem;
    }
    
    .modal-card {
        max-width: 100%;
        border-radius: 16px;
    }
    
    .camera-body {
        padding: 1rem;
        gap: 1rem;
    }
    
    .camera-controls {
        justify-content: space-between;
    }
    
    .camera-controls .btn {
        flex: 1;
    }
    
    /* Toast positioning */
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        text-align: center;
    }
}

/* Very small mobile displays (under 480px) */
@media (max-width: 480px) {
    .login-card {
        padding: 1.75rem 1.25rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .photo-btn-grid {
        grid-template-columns: 1fr;
    }
}
