* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== LOGO / BRANDING ===== */
.logo {
    text-align: center;
    margin-bottom: 28px;
}

.logo .logo-img {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    margin: 0 auto 12px;
    display: block;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.logo .logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.logo h1 {
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 4px;
    font-weight: 700;
}

.logo p {
    color: #94a3b8;
    font-size: 14px;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
    background: #f8fafc;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== BUTTONS ===== */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-filter {
    padding: 10px 20px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ===== LINKS ===== */
.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #94a3b8;
}

.auth-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.footer-text {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.footer-text strong {
    color: rgba(255, 255, 255, 0.9);
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ===== ROLE SELECTOR ===== */
.role-selector {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.role-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}

.role-option input {
    display: none;
}

.role-option .role-icon {
    font-size: 28px;
}

.role-option .role-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.role-option.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.role-option.active .role-label {
    color: #2563eb;
}

.role-option:hover {
    border-color: #93c5fd;
}

/* ===== BADGES ===== */
.admin-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    margin-top: 2px;
}

.role-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    margin-top: 2px;
}

.today-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-top: 4px;
}

.status-badge.check-in {
    background: #d1fae5;
    color: #059669;
}

.status-badge.check-out {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.no-checkout {
    background: #fef3c7;
    color: #d97706;
}

/* ===== DASHBOARD HEADER ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-header h2 {
    font-size: 20px;
    color: #1e293b;
    line-height: 1.2;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.logout-btn {
    display: inline-block;
    background: none;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 500;
}

.logout-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.admin-link {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff !important;
    border-color: #f59e0b;
}

.admin-link:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    border-color: #d97706;
}

/* ===== STATUS CARD ===== */
.status-card {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #f8faff, #eef2ff);
    border-radius: 16px;
    margin-bottom: 20px;
}

.status-indicator {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 44px;
    transition: all 0.3s;
}

.status-checked-in {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    color: #fff;
}

.status-checked-out {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    box-shadow: 0 6px 20px rgba(148, 163, 184, 0.3);
    color: #fff;
}

.status-text {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.status-time {
    font-size: 14px;
    color: #94a3b8;
}

/* ===== CHECK BUTTON ===== */
.check-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.check-btn:active {
    transform: scale(0.98);
}

/* ===== HISTORY SECTION ===== */
.history-section {
    margin-top: 8px;
}

.history-section h3 {
    font-size: 16px;
    color: #475569;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-list {
    max-height: 320px;
    overflow-y: auto;
}

.history-item {
    padding: 14px;
    background: #f8faff;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eef2ff;
}

.history-date {
    font-size: 13px;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-date .day {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.history-times {
    text-align: right;
    font-size: 13px;
    color: #64748b;
}

.history-times .check-in {
    color: #10b981;
    font-weight: 600;
}

.history-times .check-out {
    color: #ef4444;
    font-weight: 600;
}

.history-times .no-checkout {
    color: #94a3b8;
}

/* ===== OFFLINE & PENDING BANNERS ===== */
.offline-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 12px;
    color: #fff;
    animation: slideUp 0.3s ease;
    font-size: 13px;
    line-height: 1.4;
}

.offline-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.offline-text {
    flex: 1;
}

.pending-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 12px;
    color: #fff;
    animation: slideUp 0.3s ease;
    font-size: 13px;
}

.pending-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.pending-text {
    flex: 1;
}

.sync-now-btn {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.sync-now-btn:hover {
    background: rgba(255,255,255,0.35);
}

.sync-now-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== INSTALL BANNER ===== */
.install-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #fff;
    animation: slideUp 0.3s ease;
    gap: 12px;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.install-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}

.install-text {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    line-height: 1.3;
}

.install-text strong {
    font-size: 14px;
    font-weight: 700;
}

.install-text span {
    opacity: 0.85;
    font-size: 11px;
}

.install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.install-btn {
    background: #fff;
    color: #2563eb;
    border: none;
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s;
    white-space: nowrap;
}

.install-btn:hover {
    transform: scale(1.05);
}

.install-btn:active {
    transform: scale(0.95);
}

.install-dismiss {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.install-dismiss:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== GPS LOADING ===== */
.gps-loading {
    display: none;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    color: #2563eb;
}

.gps-loading.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== ADMIN DASHBOARD STYLES ===== */

/* Date Filter */
.date-filter {
    background: #f8faff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #eef2ff;
}

.date-filter label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 8px;
}

.date-input-group {
    display: flex;
    gap: 8px;
}

.date-input-group input[type="date"] {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.2s;
}

.date-input-group input[type="date"]:focus {
    outline: none;
    border-color: #2563eb;
}

.today-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 10px;
    font-weight: 500;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 16px;
    border-radius: 14px;
    text-align: center;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.stat-total .stat-number { color: #2563eb; }
.stat-in .stat-number { color: #10b981; }
.stat-out .stat-number { color: #3b82f6; }
.stat-absent .stat-number { color: #f59e0b; }

/* Student Records */
.student-record {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f8faff;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid #eef2ff;
    transition: all 0.2s;
}

.student-record:hover {
    border-color: #c7d2fe;
    background: #f0f4ff;
}

.student-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.student-info {
    flex: 1;
    min-width: 0;
}

.student-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-email {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-status {
    text-align: right;
    flex-shrink: 0;
}

.student-status .check-in {
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
}

.student-status .check-out {
    font-size: 11px;
    color: #ef4444;
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .card {
        padding: 24px 16px;
        border-radius: 16px;
    }
    
    .logo h1 {
        font-size: 22px;
    }
    
    .logo .logo-img {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }
    
    .logo .logo-icon {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
    
    .status-indicator {
        width: 80px;
        height: 80px;
        font-size: 36px;
    }
    
    .check-btn {
        font-size: 16px;
        padding: 16px;
    }
    
    .stats-row {
        gap: 8px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .stat-card {
        padding: 12px 8px;
    }
    
    .student-record {
        padding: 12px;
        gap: 10px;
    }
    
    .student-avatar-sm {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .date-input-group {
        flex-direction: column;
    }
    
    .btn-filter {
        width: 100%;
    }
    
    .role-selector {
        gap: 8px;
    }
    
    .role-option {
        padding: 12px 8px;
    }
    
    .role-option .role-icon {
        font-size: 24px;
    }
}