/* -------------------------------------------------------------
 * PKKMB Attendance System - Student Client Style
 * Premium Dark Mode with Glassmorphism & Subtle Micro-animations
 * ------------------------------------------------------------- */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.35);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.25);
    
    --danger: #ef4444;
    --dark-bg: #090d16;
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    isolation: isolate;
}

@supports (overflow: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

/* Background Ambient Glows */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    background: var(--primary);
    top: -200px;
    left: -200px;
}

.bg-glow-2 {
    background: var(--success);
    bottom: -200px;
    right: -200px;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 768px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin: 0 auto;
}

.app-section {
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    min-width: 0;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2.25rem;
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px var(--primary-glow));
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.1;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.user-profile {
    display: flex;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.35rem 0.5rem 0.35rem 0.75rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 0 10px var(--primary-glow);
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-meta h3 {
    font-size: 0.8rem;
    font-weight: 600;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta span {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* Clock Section */
/* Clock Section - Double Line Stacked Layout */
.clock-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0.75rem 0 1.25rem 0;
    gap: 0.25rem;
}

.digital-clock {
    font-size: 3.8rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.date-display {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #93c5fd;
    margin-top: 0.15rem;
}

/* Alert Container */
.alert-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1rem;
    border-radius: 12px;
    color: #fca5a5;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.alert-icon {
    font-size: 1.1rem;
    color: var(--danger);
}

/* Main Card */
.main-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.main-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.status-indicator-bar {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--card-border);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
}

.pulse-active {
    background-color: var(--success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.card-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Attendance Action Buttons */
.attendance-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 480px) {
    .attendance-actions {
        grid-template-columns: 1fr;
    }
}

.action-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.btn-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition-smooth);
}

.btn-label {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Check In State - Ready */
.check-in-btn.ready {
    border-color: rgba(79, 70, 229, 0.3);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
}

.check-in-btn.ready:hover:not(:disabled) {
    border-color: var(--primary);
    box-shadow: 0 8px 25px var(--primary-glow);
    transform: translateY(-2px);
}

.check-in-btn.ready:hover:not(:disabled) .btn-icon {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* Check Out State - Ready */
.check-out-btn.ready {
    border-color: rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
}

.check-out-btn.ready:hover:not(:disabled) {
    border-color: var(--success);
    box-shadow: 0 8px 25px var(--success-glow);
    transform: translateY(-2px);
}

.check-out-btn.ready:hover:not(:disabled) .btn-icon {
    background: var(--success);
    color: white;
    transform: scale(1.05);
}

/* Loading/Disabled Buttons */
.action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.action-btn.loading .btn-icon i {
    animation: spin 1s linear infinite;
}

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

/* Today's Stats Cards */
.today-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
}

@media (max-width: 580px) {
    .today-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
}

.status-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    width: fit-content;
    max-width: 100%;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.status-badge i {
    margin-right: 0.35rem;
}

.badge-ontime {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-late {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-incomplete {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* History Section */
.history-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    padding: 1.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.history-table th {
    padding: 0.85rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--card-border);
}

.history-table td {
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    white-space: nowrap;
}

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

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-primary);
}

.empty-row td {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.5rem 0;
}

.app-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Scrollbar customizations */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Landing Page Styles */
.landing-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3.5rem 1.75rem;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 520px;
    margin: auto auto; /* Center vertically and horizontally */
    box-sizing: border-box;
}

.landing-logo {
    font-size: 4.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px var(--primary-glow));
    margin-bottom: 0.5rem;
}

.landing-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.landing-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.landing-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 360px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.login-action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    transition: var(--transition-smooth);
    margin-top: 1rem;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.login-action-btn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 20px var(--primary-glow);
    transform: translateY(-1px);
}

/* Student Identity Card */
.identity-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition-smooth);
}

.identity-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.identity-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.location-header {
    justify-content: space-between;
}

.location-header-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.75rem;
}

.gps-refresh-btn {
    flex: 0 0 auto;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.identity-badge-icon {
    font-size: 1.25rem;
    color: var(--primary);
    filter: drop-shadow(0 2px 4px var(--primary-glow));
}

.identity-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
    overflow-wrap: anywhere;
}

.identity-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2rem;
}

@media (max-width: 480px) {
    .identity-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.identity-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.identity-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.identity-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

#locationMap {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 480px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    margin: 1.25rem auto 0;
    overflow: hidden;
    z-index: 1;
}

/* Attendance score summary */
.attendance-score-card {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
}

.attendance-score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attendance-score-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    text-align: center;
}

.attendance-score-stat {
    min-width: 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.6rem 0.3rem;
    overflow-wrap: anywhere;
}

/* Sessions Schedule Cards */
.sessions-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.session-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.session-card:hover {
    border-color: rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
}

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
    gap: 0.75rem;
}

.session-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
    overflow-wrap: anywhere;
}

.session-card-header > div {
    min-width: 0;
}

.session-date-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.session-times-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 0.75rem;
}

.session-time-item {
    display: flex;
    flex-direction: column;
}

.session-time-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}

.session-time-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* SPA Page Views */
.page-view {
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.page-view.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    opacity: 1;
}

/* Fixed Bottom Navigation Bar */
.bottom-nav-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 768px;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10000;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.nav-item {
    background: transparent;
    border: none;
    color: #94a3b8; /* High-contrast slate color for unactive bottom nav tabs */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.35rem 0.05rem;
    border-radius: 10px;
    transition: all 0.25s ease;
    flex: 0 0 20%;
    min-width: 0;
    width: 20%;
    max-width: 20%;
    text-align: center;
    box-sizing: border-box;
}

.nav-item span {
    font-size: 0.62rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: block;
    text-align: center;
}

.nav-item i {
    font-size: 1.2rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item.active {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.12);
    width: 20% !important;
    max-width: 20% !important;
}

.nav-item.active i {
    transform: translateY(-2px) scale(1.1);
    color: #3b82f6;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.6));
}

/* Mobile Touch Target & Interaction Micro-feedback */
@media (pointer: coarse) {
    .action-btn,
    .login-action-btn,
    .logout-btn,
    .nav-item,
    #refreshGpsBtn {
        min-height: 44px; /* Touch target minimum height guidelines */
        -webkit-tap-highlight-color: transparent;
    }
}

.action-btn:active:not(:disabled),
.login-action-btn:active,
.logout-btn:active,
.nav-item:active,
#refreshGpsBtn:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s ease;
}

.identity-value {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Responsive Overrides for Mobile Devices */
@media (max-width: 480px) {
    .app-container {
        padding: 1rem 0.75rem;
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
    }

    .app-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .user-profile {
        max-width: 100%;
    }

    .landing-card {
        padding: 2rem 0.75rem;
        width: 100%;
        max-width: 100%;
        margin: auto;
        align-self: center;
        box-sizing: border-box;
    }

    .landing-card p {
        font-size: 0.8rem;
        max-width: 100%;
        line-height: 1.5;
    }

    .login-action-btn {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.75rem 0.75rem !important;
        font-size: 0.82rem !important;
        gap: 0.4rem !important;
        text-align: center !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    .bottom-nav-bar {
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: max(0.15rem, env(safe-area-inset-bottom, 0px));
    }

    .nav-item {
        padding: 0.3rem 0.02rem !important;
        font-size: 0.58rem !important;
        gap: 2px !important;
        width: 20% !important;
        max-width: 20% !important;
        flex: 0 0 20% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .nav-item i {
        font-size: 1.1rem;
    }

    .ad-card img {
        height: 110px !important;
    }

    #locationMap {
        max-height: 270px;
        aspect-ratio: 16 / 10;
    }

    .card-content {
        padding: 1.25rem 0.85rem;
    }

    .history-section,
    .identity-card {
        padding: 1rem;
    }

    .session-card {
        padding: 1rem;
    }

    .location-header,
    .session-card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .location-header-title {
        width: 100%;
    }

    .gps-refresh-btn {
        width: 100%;
    }

    .session-card-header > div {
        justify-content: flex-start;
    }

    .session-times-grid {
        grid-template-columns: 1fr;
    }

    .attendance-score-card {
        padding: 1rem;
    }

    .attendance-score-grid {
        gap: 0.4rem;
    }

    .digital-clock {
        font-size: 3rem;
    }

    .date-display {
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    .nav-item {
        font-size: 0.58rem;
    }

    .nav-item i {
        font-size: 1.02rem;
    }

    .digital-clock {
        font-size: 2.4rem;
    }

    .date-display {
        font-size: 0.85rem;
    }
}

/* Full-Screen Initial App Loading Overlay */
.initial-app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--dark-bg);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 2rem;
    box-sizing: border-box;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
}

.loader-logo-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: loaderPulse 2s infinite ease-in-out;
}

.loader-logo-icon {
    font-size: 2.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 10px var(--primary-glow));
}

.loader-spinner {
    width: 42px;
    height: 42px;
    border: 3.5px solid rgba(255, 255, 255, 0.1);
    border-top: 3.5px solid #60a5fa;
    border-right: 3.5px solid #a855f7;
    border-radius: 50%;
    animation: loaderSpin 0.8s linear infinite;
    margin: 0.5rem 0;
}

.loader-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

@keyframes loaderPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* Bilingual Side-by-Side Statement Layout */
.bilingual-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.bilingual-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.bilingual-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.bilingual-id {
    color: var(--text-primary);
    font-size: 0.82rem;
    line-height: 1.55;
}

.bilingual-en {
    color: #cbd5e1;
    font-size: 0.81rem;
    line-height: 1.55;
    font-style: italic;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 0.85rem;
}

@media (max-width: 600px) {
    .bilingual-item {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    
    .bilingual-en {
        border-left: 2px solid rgba(96, 165, 250, 0.4);
        padding-left: 0.65rem;
        margin-left: 0.5rem;
    }
}






